Makefile.powerpc revision 4836
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
3757Sdg#	$Id: Makefile.i386,v 1.50 1994/11/24 14:26:11 davidg 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
27509SrgrimesDBSYM?=	/usr/sbin/dbsym
28509Srgrimes
294Srgrimes.if exists(./@/.)
304SrgrimesS=	./@
314Srgrimes.else
324SrgrimesS=	../..
33712Swollman.endif
34712SwollmanI386=	${S}/i386
354Srgrimes
364SrgrimesCWARNFLAGS?=-W -Wreturn-type -Wcomment -Wredundant-decls
374Srgrimes#
38712Swollman# The following flags are next up for working on:
39509Srgrimes# -Wimplicit -Wnested-externs 
404Srgrimes#
414Srgrimes# When working on removing warnings from code, the `-Werror' flag should be
424Srgrimes# of material assistance.
434Srgrimes#
444SrgrimesCOPTFLAGS?=-O
454SrgrimesINCLUDES= -I. -I$S -I$S/sys
46757SdgCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DLOAD_ADDRESS=0x${LOAD_ADDRESS}
47757SdgASFLAGS=
484SrgrimesCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
494SrgrimesLOAD_ADDRESS?=	F0100000
50509Srgrimes
514SrgrimesNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
52509SrgrimesNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
534Srgrimes# XXX errors leak out of all the pipes.  Should use cc *.S.
54509Srgrimes# XXX LOCORE means "don't declare C stuff" not "for locore.s".
55509SrgrimesNORMAL_S= ${CPP} -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
56509SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
574SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
584SrgrimesPROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
59509Srgrimes
604SrgrimesSFILES=	${I386}/i386/exception.s ${I386}/i386/microtime.s \
614Srgrimes	${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s
624SrgrimesSYSTEM_CFILES= ioconf.c param.c vnode_if.c
634SrgrimesSYSTEM_SFILES= ${I386}/i386/locore.s
644SrgrimesSYSTEM_OBJS=locore.o vnode_if.o ${OBJS} ioconf.o param.o 
654SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
664SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
674SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
684SrgrimesSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
694Srgrimes	${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@
704Srgrimes
71715Swollman%OBJS
724Srgrimes
73715Swollman%CFILES
74715Swollman
75715Swollman%LOAD
76715Swollman
77715Swollman# This is slightly different from before in that if you define PROF
784Srgrimes# to anything, it will assume profiling.  Don't do "PROF=" to turn
794Srgrimes# profiling off!
804Srgrimes.if exists($S/libkern/obj)
814SrgrimesLIBKERNP=$S/libkern/obj
824Srgrimes.else
834SrgrimesLIBKERNP=$S/libkern
844Srgrimes.endif
854Srgrimes
86757Sdg.if defined(PROF)
87757SdgLIBKERN=${LIBKERNP}/libkern_p.a
884Srgrimes.else
894SrgrimesLIBKERN=${LIBKERNP}/libkern.a
904Srgrimes.endif
91757Sdg
92757Sdglibkern.a: ${LIBKERN}
93757Sdg	@rm -f libkern.a
94757Sdg	ln -s ${LIBKERN} libkern.a
95757Sdg
96757Sdg${LIBKERN}:
97757Sdg	@(cd $S/libkern; make)
98757Sdg
99757Sdgclean:
100757Sdg	rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym
101757Sdg
102757Sdg#lint: /tmp param.c
103757Sdg#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
104757Sdg#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
105757Sdg#	    grep -v 'struct/union .* never defined' | \
106757Sdg#	    grep -v 'possible pointer alignment problem'
107757Sdg
108509Srgrimessymbols.sort: ${I386}/i386/symbols.raw
109509Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
110509Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
1114Srgrimes
1124Srgrimeslocore.o: ${I386}/i386/locore.s assym.s
1134Srgrimes	${NORMAL_S}
1144Srgrimes
1154Srgrimes# everything potentially depends on the Makefile since everything potentially
1164Srgrimes# depends on the options.  Some things are more dependent on the Makefile for
1174Srgrimes# historical reasons.
1184Srgrimesmachdep.o: Makefile
1194Srgrimes
120649Snate# the following is necessary because autoconf.o depends on #if GENERIC
121715Swollmanautoconf.o: Makefile
122715Swollman
123715Swollman# depend on network configuration
124715Swollmanaf.o uipc_proto.o locore.o: Makefile
125715Swollman
126715Swollman# depends on KDB (cons.o also depends on GENERIC)
127715Swollmantrap.o cons.o: Makefile
1284Srgrimes
129715Swollman# this rule stops ./assym.s in .depend from causing problems
130715Swollman./assym.s: assym.s
131715Swollman
1324Srgrimesassym.s: genassym
133648Snate	./genassym >assym.s
1344Srgrimes
1354Srgrimes# Some of the defines that genassym outputs may well depend on the 
136509Srgrimes# value of kernel options.
1374Srgrimesgenassym.o: ${I386}/i386/genassym.c Makefile
1384Srgrimes	${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1394Srgrimes
1404Srgrimesgenassym: genassym.o
1414Srgrimes	${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
1424Srgrimes
1434Srgrimes# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
1444Srgrimesdepend: assym.s param.c vnode_if.h
1454Srgrimes	mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
1464Srgrimes	mkdep -a ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1474Srgrimes	MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \
1484Srgrimes	mkdep -a -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
1494Srgrimes
1504Srgrimeslinks:
1514Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1524Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1534Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
154509Srgrimes	  sort -u | comm -23 - dontlink | \
1554Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1564Srgrimes	sh makelinks && rm -f dontlink
157509Srgrimes
1584Srgrimestags:
1594Srgrimes	@echo "see $S/kern/Makefile for tags"
1604Srgrimes
1614Srgrimesinstall:
1624Srgrimes	chflags noschg /kernel
1634Srgrimes	mv /kernel /kernel.old
164509Srgrimes	install -c -m 555 -o root -g wheel -fschg kernel /
1654Srgrimes
1664Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1674Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1684Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1694Srgrimes
1704Srgrimesparam.c: $S/conf/param.c
1714Srgrimes	-rm -f param.c
172	cp $S/conf/param.c .
173
174param.o: param.c Makefile
175	${CC} -c ${CFLAGS} ${PARAM} param.c
176
177vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
178	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
179	${CC} ${CFLAGS} -c vers.c
180
181vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
182	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
183vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
184	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
185
186%RULES
187
188# DO NOT DELETE THIS LINE -- make depend uses it
189