Makefile.powerpc revision 2112
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
32112Swollman#	$Id: Makefile.i386,v 1.28 1994/08/13 03:49:32 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
27509SrgrimesDBSYM=	/usr/sbin/dbsym
284Srgrimes
292056Swollman.if exists(./@/.)
302056SwollmanS=	./@
312056Swollman.else
324SrgrimesS=	../..
332056Swollman.endif
342056SwollmanI386=	${S}/i386
354Srgrimes
362112SwollmanCWARNFLAGS=-W -Wreturn-type -Wcomment -Wredundant-decls
37798Swollman#
38798Swollman# The following flags are next up for working on:
39879Swollman# -Wredundant-decls -Wnested-externs 
40798Swollman#
41798Swollman# When working on removing warnings from code, the `-Werror' flag should be
42798Swollman# of material assistance.
43798Swollman#
44712SwollmanCOPTFLAGS=-O
454SrgrimesINCLUDES= -I. -I$S -I$S/sys
464SrgrimesCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
474SrgrimesASFLAGS=
48712SwollmanCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
49974SdgLOAD_ADDRESS?=	F0100000
504Srgrimes
514SrgrimesNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
524SrgrimesNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
534SrgrimesNORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
544SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
554SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
56757SdgSYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
571549Srgrimes	ioconf.o conf.o machdep.o vnode_if.o
581549SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
594SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
601549SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
614SrgrimesSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
621891Sdg	${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@
634Srgrimes
64509Srgrimes# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
65509Srgrimes# the script is identical for either... -- cgd
66509Srgrimes#
674SrgrimesGPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
684SrgrimesPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
69509Srgrimes		ed - $*.s < ${GPROF.EX} ; \
704Srgrimes		${AS} -o $@ $*.s ; \
714Srgrimes		rm -f $*.s
724Srgrimes
734Srgrimes%OBJS
744Srgrimes
754Srgrimes%CFILES
764Srgrimes
774Srgrimes%LOAD
784Srgrimes
791549Srgrimeslibkern.a:
801549Srgrimes	-@if [ X${PROF} = X ]; \
811549Srgrimes	then ln -s $S/libkern/obj/libkern.a libkern.a; \
821549Srgrimes	else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
831549Srgrimes	fi; \
841549Srgrimes	echo ln -s $S/libkern/obj/libkern.a libkern.a
851549Srgrimes
864Srgrimesclean:
871569Srgrimes	rm -f eddep *kernel tags *.o locore.i [a-uw-z]*.s \
88715Swollman		errs linterrs makelinks genassym ,assym.s stamp-assym
894Srgrimes
90715Swollman#lint: /tmp param.c
91715Swollman#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
92715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
93715Swollman#	    grep -v 'struct/union .* never defined' | \
94715Swollman#	    grep -v 'possible pointer alignment problem'
954Srgrimes
964Srgrimessymbols.sort: ${I386}/i386/symbols.raw
974Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
984Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
994Srgrimes
1004Srgrimeslocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
1014Srgrimes	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
1021321Sdg	$S/sys/errno.h machine/specialreg.h \
103757Sdg	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
104757Sdg	machine/asmacros.h
1054Srgrimes	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
1064Srgrimes		${AS} ${ASFLAGS} -o locore.o
1074Srgrimes
108757Sdgexception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
109757Sdg	${I386}/isa/vector.s ${I386}/isa/icu.s \
110757Sdg	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
111757Sdg	$S/net/netisr.h machine/asmacros.h
112757Sdg	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
113757Sdg		${AS} ${ASFLAGS} -o exception.o
114757Sdg
115757Sdgswtch.o: assym.s ${I386}/i386/swtch.s \
1161321Sdg	$S/sys/errno.h machine/asmacros.h
117757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
118757Sdg		${AS} ${ASFLAGS} -o swtch.o
119757Sdg
120757Sdgsupport.o: assym.s ${I386}/i386/support.s \
121757Sdg	$S/sys/errno.h machine/asmacros.h
122757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
123757Sdg		${AS} ${ASFLAGS} -o support.o
124757Sdg
125509Srgrimesmachdep.o: ${I386}/i386/machdep.c Makefile
126509Srgrimes	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
127509Srgrimes
1284Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1294Srgrimesautoconf.o: Makefile
1304Srgrimes
1314Srgrimes# depend on network configuration
1324Srgrimesaf.o uipc_proto.o locore.o: Makefile
1334Srgrimes
1344Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1354Srgrimestrap.o cons.o: Makefile
1364Srgrimes
137649Snateassym.s: genassym
138715Swollman	./genassym >,assym.s
139715Swollman	if cmp -s assym.s ,assym.s; then \
140715Swollman		rm -f ,assym.s; \
141715Swollman	else \
142715Swollman		rm -f assym.s; \
143715Swollman		mv ,assym.s assym.s; \
144715Swollman	fi
1454Srgrimes
146715Swollman# Some of the defines that genassym outputs may well depend on the 
147715Swollman# value of kernel options.
148715Swollmangenassym:	Makefile
1494Srgrimes	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
1501030Snate		 ${I386}/i386/genassym.c -static -o genassym
1514Srgrimes
1521549Srgrimesdepend: assym.s param.c vnode_if.h
153509Srgrimes	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
1544Srgrimes	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1554Srgrimes
1564Srgrimeslinks:
1574Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1584Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1594Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1604Srgrimes	  sort -u | comm -23 - dontlink | \
1614Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1624Srgrimes	sh makelinks && rm -f dontlink
1634Srgrimes
1644Srgrimestags:
1654Srgrimes	@echo "see $S/kern/Makefile for tags"
1664Srgrimes
1674Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1684Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1694Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1704Srgrimes
171798Swollmanconf.o: ${I386}/i386/conf.c $S/sys/conf.h
172798Swollman	${CC} -c ${CFLAGS} ${I386}/i386/conf.c
1734Srgrimes
174509Srgrimesparam.c: $S/conf/param.c
1754Srgrimes	-rm -f param.c
1764Srgrimes	cp $S/conf/param.c .
1774Srgrimes
1784Srgrimesparam.o: param.c Makefile
1794Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1804Srgrimes
181509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1824Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1834Srgrimes	${CC} ${CFLAGS} -c vers.c
1844Srgrimes
1851549Srgrimesvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1861549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1871549Srgrimesvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1881549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1891549Srgrimes
1904Srgrimes%RULES
1914Srgrimes
1924Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
1934Srgrimes
194