Makefile.powerpc revision 1569
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
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 \
541549Srgrimes	ioconf.o conf.o machdep.o vnode_if.o
551549SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
564SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
571549SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
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
761549Srgrimeslibkern.a:
771549Srgrimes	-@if [ X${PROF} = X ]; \
781549Srgrimes	then ln -s $S/libkern/obj/libkern.a libkern.a; \
791549Srgrimes	else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
801549Srgrimes	fi; \
811549Srgrimes	echo ln -s $S/libkern/obj/libkern.a libkern.a
821549Srgrimes
834Srgrimesclean:
841569Srgrimes	rm -f eddep *kernel tags *.o locore.i [a-uw-z]*.s \
85715Swollman		errs linterrs makelinks genassym ,assym.s stamp-assym
864Srgrimes
87715Swollman#lint: /tmp param.c
88715Swollman#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
89715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
90715Swollman#	    grep -v 'struct/union .* never defined' | \
91715Swollman#	    grep -v 'possible pointer alignment problem'
924Srgrimes
934Srgrimessymbols.sort: ${I386}/i386/symbols.raw
944Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
954Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
964Srgrimes
974Srgrimeslocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
984Srgrimes	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
991321Sdg	$S/sys/errno.h machine/specialreg.h \
100757Sdg	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
101757Sdg	machine/asmacros.h
1024Srgrimes	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
1034Srgrimes		${AS} ${ASFLAGS} -o locore.o
1044Srgrimes
105757Sdgexception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
106757Sdg	${I386}/isa/vector.s ${I386}/isa/icu.s \
107757Sdg	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
108757Sdg	$S/net/netisr.h machine/asmacros.h
109757Sdg	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
110757Sdg		${AS} ${ASFLAGS} -o exception.o
111757Sdg
112757Sdgswtch.o: assym.s ${I386}/i386/swtch.s \
1131321Sdg	$S/sys/errno.h machine/asmacros.h
114757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
115757Sdg		${AS} ${ASFLAGS} -o swtch.o
116757Sdg
117757Sdgsupport.o: assym.s ${I386}/i386/support.s \
118757Sdg	$S/sys/errno.h machine/asmacros.h
119757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
120757Sdg		${AS} ${ASFLAGS} -o support.o
121757Sdg
122509Srgrimesmachdep.o: ${I386}/i386/machdep.c Makefile
123509Srgrimes	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
124509Srgrimes
1254Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1264Srgrimesautoconf.o: Makefile
1274Srgrimes
1284Srgrimes# depend on network configuration
1294Srgrimesaf.o uipc_proto.o locore.o: Makefile
1304Srgrimes
1314Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1324Srgrimestrap.o cons.o: Makefile
1334Srgrimes
134649Snateassym.s: genassym
135715Swollman	./genassym >,assym.s
136715Swollman	if cmp -s assym.s ,assym.s; then \
137715Swollman		rm -f ,assym.s; \
138715Swollman	else \
139715Swollman		rm -f assym.s; \
140715Swollman		mv ,assym.s assym.s; \
141715Swollman	fi
1424Srgrimes
143715Swollman# Some of the defines that genassym outputs may well depend on the 
144715Swollman# value of kernel options.
145715Swollmangenassym:	Makefile
1464Srgrimes	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
1471030Snate		 ${I386}/i386/genassym.c -static -o genassym
1484Srgrimes
1491549Srgrimesdepend: assym.s param.c vnode_if.h
150509Srgrimes	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
1514Srgrimes	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1524Srgrimes
1534Srgrimeslinks:
1544Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1554Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1564Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1574Srgrimes	  sort -u | comm -23 - dontlink | \
1584Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1594Srgrimes	sh makelinks && rm -f dontlink
1604Srgrimes
1614Srgrimestags:
1624Srgrimes	@echo "see $S/kern/Makefile for tags"
1634Srgrimes
1644Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1654Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1664Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1674Srgrimes
168798Swollmanconf.o: ${I386}/i386/conf.c $S/sys/conf.h
169798Swollman	${CC} -c ${CFLAGS} ${I386}/i386/conf.c
1704Srgrimes
171509Srgrimesparam.c: $S/conf/param.c
1724Srgrimes	-rm -f param.c
1734Srgrimes	cp $S/conf/param.c .
1744Srgrimes
1754Srgrimesparam.o: param.c Makefile
1764Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1774Srgrimes
178509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1794Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1804Srgrimes	${CC} ${CFLAGS} -c vers.c
1814Srgrimes
1821549Srgrimesvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1831549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1841549Srgrimesvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1851549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1861549Srgrimes
1874Srgrimes%RULES
1884Srgrimes
1894Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
1904Srgrimes
191