Makefile.powerpc revision 1321
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
31321Sdg#	$Id: Makefile.i386,v 1.23 1994/03/21 20:48:47 ats Exp $
44Srgrimes#
5509Srgrimes# Makefile for FreeBSD
6509Srgrimes#
74Srgrimes# This makefile is constructed from a machine description:
84Srgrimes#	config machineid
94Srgrimes# Most changes should be made in the machine description
104Srgrimes#	/sys/i386/conf/``machineid''
114Srgrimes# after which you should do
124Srgrimes#	 config machineid
134Srgrimes# Generic makefile changes should be made in
144Srgrimes#	/sys/i386/conf/Makefile.i386
154Srgrimes# after which config should be rerun for all machines.
164Srgrimes#
174Srgrimes# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE
184Srgrimes#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
194Srgrimes#
204Srgrimes# -DTRACE	compile in kernel tracing hooks
214Srgrimes# -DQUOTA	compile in file system quotas
224Srgrimes#
234SrgrimesTOUCH=	touch -f -c
244SrgrimesLD=	/usr/bin/ld
254SrgrimesCC=	cc 
264SrgrimesCPP=	cpp
27509SrgrimesSTRIP=	strip
28509SrgrimesDBSYM=	/usr/sbin/dbsym
294Srgrimes
304SrgrimesS=	../..
314SrgrimesI386=	../../i386
324Srgrimes
33798SwollmanCWARNFLAGS=-W -Wreturn-type -Wcomment
34798Swollman#
35798Swollman# The following flags are next up for working on:
36879Swollman# -Wredundant-decls -Wnested-externs 
37798Swollman#
38798Swollman# When working on removing warnings from code, the `-Werror' flag should be
39798Swollman# of material assistance.
40798Swollman#
41712SwollmanCOPTFLAGS=-O
421169SrgrimesCOPTFLAGS+=-D__FreeBSD__
434SrgrimesINCLUDES= -I. -I$S -I$S/sys
444SrgrimesCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
454SrgrimesASFLAGS=
46712SwollmanCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
47974SdgLOAD_ADDRESS?=	F0100000
484Srgrimes
494SrgrimesNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
504SrgrimesNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
514SrgrimesNORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
524SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
534SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
54757SdgSYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
55757Sdg	ioconf.o conf.o machdep.o
564SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
574SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
581293SatsSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
594SrgrimesSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
60509Srgrimes	${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
614Srgrimes
62509Srgrimes# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
63509Srgrimes# the script is identical for either... -- cgd
64509Srgrimes#
654SrgrimesGPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
664SrgrimesPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
67509Srgrimes		ed - $*.s < ${GPROF.EX} ; \
684Srgrimes		${AS} -o $@ $*.s ; \
694Srgrimes		rm -f $*.s
704Srgrimes
714Srgrimes%OBJS
724Srgrimes
734Srgrimes%CFILES
744Srgrimes
754Srgrimes%LOAD
764Srgrimes
774Srgrimesclean:
784Srgrimes	rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
79715Swollman		errs linterrs makelinks genassym ,assym.s stamp-assym
804Srgrimes
81715Swollman#lint: /tmp param.c
82715Swollman#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
83715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
84715Swollman#	    grep -v 'struct/union .* never defined' | \
85715Swollman#	    grep -v 'possible pointer alignment problem'
864Srgrimes
874Srgrimessymbols.sort: ${I386}/i386/symbols.raw
884Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
894Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
904Srgrimes
914Srgrimeslocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
924Srgrimes	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
931321Sdg	$S/sys/errno.h machine/specialreg.h \
94757Sdg	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
95757Sdg	machine/asmacros.h
964Srgrimes	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
974Srgrimes		${AS} ${ASFLAGS} -o locore.o
984Srgrimes
99757Sdgexception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
100757Sdg	${I386}/isa/vector.s ${I386}/isa/icu.s \
101757Sdg	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
102757Sdg	$S/net/netisr.h machine/asmacros.h
103757Sdg	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
104757Sdg		${AS} ${ASFLAGS} -o exception.o
105757Sdg
106757Sdgswtch.o: assym.s ${I386}/i386/swtch.s \
1071321Sdg	$S/sys/errno.h machine/asmacros.h
108757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
109757Sdg		${AS} ${ASFLAGS} -o swtch.o
110757Sdg
111757Sdgsupport.o: assym.s ${I386}/i386/support.s \
112757Sdg	$S/sys/errno.h machine/asmacros.h
113757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
114757Sdg		${AS} ${ASFLAGS} -o support.o
115757Sdg
116509Srgrimesmachdep.o: ${I386}/i386/machdep.c Makefile
117509Srgrimes	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
118509Srgrimes
1194Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1204Srgrimesautoconf.o: Makefile
1214Srgrimes
1224Srgrimes# depend on network configuration
1234Srgrimesaf.o uipc_proto.o locore.o: Makefile
1244Srgrimes
1254Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1264Srgrimestrap.o cons.o: Makefile
1274Srgrimes
128649Snateassym.s: genassym
129715Swollman	./genassym >,assym.s
130715Swollman	if cmp -s assym.s ,assym.s; then \
131715Swollman		rm -f ,assym.s; \
132715Swollman	else \
133715Swollman		rm -f assym.s; \
134715Swollman		mv ,assym.s assym.s; \
135715Swollman	fi
1364Srgrimes
137715Swollman# Some of the defines that genassym outputs may well depend on the 
138715Swollman# value of kernel options.
139715Swollmangenassym:	Makefile
1404Srgrimes	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
1411030Snate		 ${I386}/i386/genassym.c -static -o genassym
1424Srgrimes
1434Srgrimesdepend: assym.s param.c
144509Srgrimes	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
1454Srgrimes	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1464Srgrimes
1474Srgrimeslinks:
1484Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1494Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1504Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1514Srgrimes	  sort -u | comm -23 - dontlink | \
1524Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1534Srgrimes	sh makelinks && rm -f dontlink
1544Srgrimes
1554Srgrimestags:
1564Srgrimes	@echo "see $S/kern/Makefile for tags"
1574Srgrimes
1584Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1594Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1604Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1614Srgrimes
162798Swollmanconf.o: ${I386}/i386/conf.c $S/sys/conf.h
163798Swollman	${CC} -c ${CFLAGS} ${I386}/i386/conf.c
1644Srgrimes
165509Srgrimesparam.c: $S/conf/param.c
1664Srgrimes	-rm -f param.c
1674Srgrimes	cp $S/conf/param.c .
1684Srgrimes
1694Srgrimesparam.o: param.c Makefile
1704Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1714Srgrimes
172509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1734Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1744Srgrimes	${CC} ${CFLAGS} -c vers.c
1754Srgrimes
1764Srgrimes%RULES
1774Srgrimes
1784Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
1794Srgrimes
180