Makefile.powerpc revision 3863
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
33863Sbde#	$Id: Makefile.i386,v 1.47 1994/10/21 01:10:54 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#
233698SwollmanTOUCH?=	touch -f -c
243698SwollmanLD?=	/usr/bin/ld
253698SwollmanCC?=	cc 
263698SwollmanCPP?=	cpp
273698SwollmanDBSYM?=	/usr/sbin/dbsym
284Srgrimes
292056Swollman.if exists(./@/.)
302056SwollmanS=	./@
312056Swollman.else
324SrgrimesS=	../..
332056Swollman.endif
342056SwollmanI386=	${S}/i386
354Srgrimes
363698SwollmanCWARNFLAGS?=-W -Wreturn-type -Wcomment -Wredundant-decls
37798Swollman#
383863Sbde# The following flags are next up for working on:
393863Sbde# -Wimplicit -Wnested-externs 
40798Swollman#
41798Swollman# When working on removing warnings from code, the `-Werror' flag should be
42798Swollman# of material assistance.
43798Swollman#
443698SwollmanCOPTFLAGS?=-O
454SrgrimesINCLUDES= -I. -I$S -I$S/sys
462408SbdeCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DLOAD_ADDRESS=0x${LOAD_ADDRESS}
474SrgrimesASFLAGS=
48712SwollmanCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
49974SdgLOAD_ADDRESS?=	F0100000
504Srgrimes
514SrgrimesNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
524SrgrimesNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
532408Sbde# XXX errors leak out of all the pipes.  Should use cc *.S.
542408Sbde# XXX LOCORE means "don't declare C stuff" not "for locore.s".
553863SbdeNORMAL_S= ${CPP} -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
564SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
574SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
583863SbdePROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
592408Sbde
602408SbdeSFILES=	${I386}/i386/exception.s ${I386}/i386/microtime.s \
613258Sdg	${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s
622408SbdeSYSTEM_CFILES= ioconf.c param.c vnode_if.c
632408SbdeSYSTEM_SFILES= ${I386}/i386/locore.s
643022SphkSYSTEM_OBJS=locore.o vnode_if.o ${OBJS} ioconf.o param.o 
651549SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
664SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
671549SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
684SrgrimesSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
693863Sbde	${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@
704Srgrimes
714Srgrimes%OBJS
724Srgrimes
734Srgrimes%CFILES
744Srgrimes
754Srgrimes%LOAD
764Srgrimes
772232Sjkh# This is slightly different from before in that if you define PROF
782232Sjkh# to anything, it will assume profiling.  Don't do "PROF=" to turn
792232Sjkh# profiling off!
802232Sjkh.if exists($S/libkern/obj)
812232SjkhLIBKERNP=$S/libkern/obj
822232Sjkh.else
832232SjkhLIBKERNP=$S/libkern
842239Sjkh.endif
852239Sjkh
862232Sjkh.if defined(PROF)
872232SjkhLIBKERN=${LIBKERNP}/libkern_p.a
882232Sjkh.else
892232SjkhLIBKERN=${LIBKERNP}/libkern.a
902239Sjkh.endif
911549Srgrimes
922232Sjkhlibkern.a: ${LIBKERN}
932514Sjkh	@rm -f libkern.a
942232Sjkh	ln -s ${LIBKERN} libkern.a
952232Sjkh
962232Sjkh${LIBKERN}:
972232Sjkh	@(cd $S/libkern; make)
982232Sjkh
994Srgrimesclean:
1003863Sbde	rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym
1014Srgrimes
102715Swollman#lint: /tmp param.c
1033863Sbde#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
104715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
105715Swollman#	    grep -v 'struct/union .* never defined' | \
106715Swollman#	    grep -v 'possible pointer alignment problem'
1074Srgrimes
1084Srgrimessymbols.sort: ${I386}/i386/symbols.raw
1094Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
1104Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
1114Srgrimes
1122464Sbdelocore.o: ${I386}/i386/locore.s assym.s
1132408Sbde	${NORMAL_S}
1144Srgrimes
1152408Sbde# everything potentially depends on the Makefile since everything potentially
1162408Sbde# depends on the options.  Some things are more dependent on the Makefile for
1172408Sbde# historical reasons.
1182408Sbdemachdep.o: Makefile
119757Sdg
1204Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1214Srgrimesautoconf.o: Makefile
1224Srgrimes
1234Srgrimes# depend on network configuration
1244Srgrimesaf.o uipc_proto.o locore.o: Makefile
1254Srgrimes
1264Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1274Srgrimestrap.o cons.o: Makefile
1284Srgrimes
1292408Sbde# this rule stops ./assym.s in .depend from causing problems
1302408Sbde./assym.s: assym.s
1312408Sbde
132649Snateassym.s: genassym
1333863Sbde	./genassym >assym.s
1344Srgrimes
135715Swollman# Some of the defines that genassym outputs may well depend on the 
136715Swollman# value of kernel options.
1373863Sbdegenassym.o: ${I386}/i386/genassym.c Makefile
1383863Sbde	${CC} -c ${CFLAGS} ${PARAM} ${I386}/i386/genassym.c
1394Srgrimes
1403863Sbdegenassym: genassym.o
1413863Sbde	${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
1423863Sbde
1432408Sbde# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
1441549Srgrimesdepend: assym.s param.c vnode_if.h
1452408Sbde	mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
1463863Sbde	mkdep -a ${COPTS} ${PARAM} ${I386}/i386/genassym.c
1472408Sbde	MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \
1483863Sbde	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/' | \
1544Srgrimes	  sort -u | comm -23 - dontlink | \
1554Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1564Srgrimes	sh makelinks && rm -f dontlink
1574Srgrimes
1584Srgrimestags:
1594Srgrimes	@echo "see $S/kern/Makefile for tags"
1604Srgrimes
1612627Swollmaninstall:
1622823Sjkh	chflags noschg /kernel
1632627Swollman	mv /kernel /kernel.old
1642627Swollman	install -c -m 555 -o root -g wheel -fschg kernel /
1652627Swollman
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
170509Srgrimesparam.c: $S/conf/param.c
1714Srgrimes	-rm -f param.c
1724Srgrimes	cp $S/conf/param.c .
1734Srgrimes
1744Srgrimesparam.o: param.c Makefile
1754Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1764Srgrimes
177509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1784Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1794Srgrimes	${CC} ${CFLAGS} -c vers.c
1804Srgrimes
1811549Srgrimesvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1821549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1831549Srgrimesvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1841549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1851549Srgrimes
1864Srgrimes%RULES
1874Srgrimes
1884Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
189