Makefile.powerpc revision 974
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
3974Sdg#	$Id: Makefile.i386,v 1.18 1993/12/19 00:49:53 wollman 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
424SrgrimesINCLUDES= -I. -I$S -I$S/sys
434SrgrimesCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
444SrgrimesASFLAGS=
45712SwollmanCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
46974SdgLOAD_ADDRESS?=	F0100000
474Srgrimes
484SrgrimesNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
494SrgrimesNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
504SrgrimesNORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
514SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
524SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
53757SdgSYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
54757Sdg	ioconf.o conf.o machdep.o
554SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
564SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
57849SdgSYSTEM_LD= @${LD} -Bstatic -z -T ${LOAD_ADDRESS} -o $@ -X vers.o ${SYSTEM_OBJS}
584SrgrimesSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
59509Srgrimes	${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@
604Srgrimes
61509Srgrimes# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
62509Srgrimes# the script is identical for either... -- cgd
63509Srgrimes#
644SrgrimesGPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
654SrgrimesPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
66509Srgrimes		ed - $*.s < ${GPROF.EX} ; \
674Srgrimes		${AS} -o $@ $*.s ; \
684Srgrimes		rm -f $*.s
694Srgrimes
704Srgrimes%OBJS
714Srgrimes
724Srgrimes%CFILES
734Srgrimes
744Srgrimes%LOAD
754Srgrimes
764Srgrimesclean:
774Srgrimes	rm -f eddep *386bsd tags *.o locore.i [a-uw-z]*.s \
78715Swollman		errs linterrs makelinks genassym ,assym.s stamp-assym
794Srgrimes
80715Swollman#lint: /tmp param.c
81715Swollman#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
82715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
83715Swollman#	    grep -v 'struct/union .* never defined' | \
84715Swollman#	    grep -v 'possible pointer alignment problem'
854Srgrimes
864Srgrimessymbols.sort: ${I386}/i386/symbols.raw
874Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
884Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
894Srgrimes
904Srgrimeslocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
914Srgrimes	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
924Srgrimes	$S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h \
93757Sdg	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
94757Sdg	machine/asmacros.h
954Srgrimes	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
964Srgrimes		${AS} ${ASFLAGS} -o locore.o
974Srgrimes
98757Sdgexception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
99757Sdg	${I386}/isa/vector.s ${I386}/isa/icu.s \
100757Sdg	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
101757Sdg	$S/net/netisr.h machine/asmacros.h
102757Sdg	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
103757Sdg		${AS} ${ASFLAGS} -o exception.o
104757Sdg
105757Sdgswtch.o: assym.s ${I386}/i386/swtch.s \
106757Sdg	$S/sys/errno.h ${I386}/isa/debug.h machine/asmacros.h
107757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
108757Sdg		${AS} ${ASFLAGS} -o swtch.o
109757Sdg
110757Sdgsupport.o: assym.s ${I386}/i386/support.s \
111757Sdg	$S/sys/errno.h machine/asmacros.h
112757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
113757Sdg		${AS} ${ASFLAGS} -o support.o
114757Sdg
115509Srgrimesmachdep.o: ${I386}/i386/machdep.c Makefile
116509Srgrimes	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
117509Srgrimes
1184Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1194Srgrimesautoconf.o: Makefile
1204Srgrimes
1214Srgrimes# depend on network configuration
1224Srgrimesaf.o uipc_proto.o locore.o: Makefile
1234Srgrimes
1244Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1254Srgrimestrap.o cons.o: Makefile
1264Srgrimes
127649Snateassym.s: genassym
128715Swollman	./genassym >,assym.s
129715Swollman	if cmp -s assym.s ,assym.s; then \
130715Swollman		rm -f ,assym.s; \
131715Swollman	else \
132715Swollman		rm -f assym.s; \
133715Swollman		mv ,assym.s assym.s; \
134715Swollman	fi
1354Srgrimes
136715Swollman# Some of the defines that genassym outputs may well depend on the 
137715Swollman# value of kernel options.
138715Swollmangenassym:	Makefile
1394Srgrimes	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
140648Snate		 ${I386}/i386/genassym.c -o genassym
1414Srgrimes
1424Srgrimesdepend: assym.s param.c
143509Srgrimes	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
1444Srgrimes	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1454Srgrimes
1464Srgrimeslinks:
1474Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1484Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1494Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1504Srgrimes	  sort -u | comm -23 - dontlink | \
1514Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1524Srgrimes	sh makelinks && rm -f dontlink
1534Srgrimes
1544Srgrimestags:
1554Srgrimes	@echo "see $S/kern/Makefile for tags"
1564Srgrimes
1574Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1584Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1594Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1604Srgrimes
161798Swollmanconf.o: ${I386}/i386/conf.c $S/sys/conf.h
162798Swollman	${CC} -c ${CFLAGS} ${I386}/i386/conf.c
1634Srgrimes
164509Srgrimesparam.c: $S/conf/param.c
1654Srgrimes	-rm -f param.c
1664Srgrimes	cp $S/conf/param.c .
1674Srgrimes
1684Srgrimesparam.o: param.c Makefile
1694Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1704Srgrimes
171509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1724Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1734Srgrimes	${CC} ${CFLAGS} -c vers.c
1744Srgrimes
1754Srgrimes%RULES
1764Srgrimes
1774Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
1784Srgrimes
179