Makefile.powerpc revision 1891
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
31891Sdg#	$Id: Makefile.i386,v 1.26 1994/05/26 13:38:01 rgrimes 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
294SrgrimesS=	../..
304SrgrimesI386=	../../i386
314Srgrimes
32798SwollmanCWARNFLAGS=-W -Wreturn-type -Wcomment
33798Swollman#
34798Swollman# The following flags are next up for working on:
35879Swollman# -Wredundant-decls -Wnested-externs 
36798Swollman#
37798Swollman# When working on removing warnings from code, the `-Werror' flag should be
38798Swollman# of material assistance.
39798Swollman#
40712SwollmanCOPTFLAGS=-O
414SrgrimesINCLUDES= -I. -I$S -I$S/sys
424SrgrimesCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
434SrgrimesASFLAGS=
44712SwollmanCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
45974SdgLOAD_ADDRESS?=	F0100000
464Srgrimes
474SrgrimesNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
484SrgrimesNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
494SrgrimesNORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
504SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
514SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
52757SdgSYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \
531549Srgrimes	ioconf.o conf.o machdep.o vnode_if.o
541549SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
554SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
561549SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
574SrgrimesSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
581891Sdg	${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@
594Srgrimes
60509Srgrimes# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
61509Srgrimes# the script is identical for either... -- cgd
62509Srgrimes#
634SrgrimesGPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
644SrgrimesPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
65509Srgrimes		ed - $*.s < ${GPROF.EX} ; \
664Srgrimes		${AS} -o $@ $*.s ; \
674Srgrimes		rm -f $*.s
684Srgrimes
694Srgrimes%OBJS
704Srgrimes
714Srgrimes%CFILES
724Srgrimes
734Srgrimes%LOAD
744Srgrimes
751549Srgrimeslibkern.a:
761549Srgrimes	-@if [ X${PROF} = X ]; \
771549Srgrimes	then ln -s $S/libkern/obj/libkern.a libkern.a; \
781549Srgrimes	else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
791549Srgrimes	fi; \
801549Srgrimes	echo ln -s $S/libkern/obj/libkern.a libkern.a
811549Srgrimes
824Srgrimesclean:
831569Srgrimes	rm -f eddep *kernel tags *.o locore.i [a-uw-z]*.s \
84715Swollman		errs linterrs makelinks genassym ,assym.s stamp-assym
854Srgrimes
86715Swollman#lint: /tmp param.c
87715Swollman#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
88715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
89715Swollman#	    grep -v 'struct/union .* never defined' | \
90715Swollman#	    grep -v 'possible pointer alignment problem'
914Srgrimes
924Srgrimessymbols.sort: ${I386}/i386/symbols.raw
934Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
944Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
954Srgrimes
964Srgrimeslocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
974Srgrimes	machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \
981321Sdg	$S/sys/errno.h machine/specialreg.h \
99757Sdg	${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \
100757Sdg	machine/asmacros.h
1014Srgrimes	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
1024Srgrimes		${AS} ${ASFLAGS} -o locore.o
1034Srgrimes
104757Sdgexception.o: assym.s ${I386}/i386/exception.s machine/trap.h \
105757Sdg	${I386}/isa/vector.s ${I386}/isa/icu.s \
106757Sdg	$S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \
107757Sdg	$S/net/netisr.h machine/asmacros.h
108757Sdg	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \
109757Sdg		${AS} ${ASFLAGS} -o exception.o
110757Sdg
111757Sdgswtch.o: assym.s ${I386}/i386/swtch.s \
1121321Sdg	$S/sys/errno.h machine/asmacros.h
113757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \
114757Sdg		${AS} ${ASFLAGS} -o swtch.o
115757Sdg
116757Sdgsupport.o: assym.s ${I386}/i386/support.s \
117757Sdg	$S/sys/errno.h machine/asmacros.h
118757Sdg	${CPP} -I. ${COPTS} ${I386}/i386/support.s | \
119757Sdg		${AS} ${ASFLAGS} -o support.o
120757Sdg
121509Srgrimesmachdep.o: ${I386}/i386/machdep.c Makefile
122509Srgrimes	${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $<
123509Srgrimes
1244Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1254Srgrimesautoconf.o: Makefile
1264Srgrimes
1274Srgrimes# depend on network configuration
1284Srgrimesaf.o uipc_proto.o locore.o: Makefile
1294Srgrimes
1304Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1314Srgrimestrap.o cons.o: Makefile
1324Srgrimes
133649Snateassym.s: genassym
134715Swollman	./genassym >,assym.s
135715Swollman	if cmp -s assym.s ,assym.s; then \
136715Swollman		rm -f ,assym.s; \
137715Swollman	else \
138715Swollman		rm -f assym.s; \
139715Swollman		mv ,assym.s assym.s; \
140715Swollman	fi
1414Srgrimes
142715Swollman# Some of the defines that genassym outputs may well depend on the 
143715Swollman# value of kernel options.
144715Swollmangenassym:	Makefile
1454Srgrimes	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
1461030Snate		 ${I386}/i386/genassym.c -static -o genassym
1474Srgrimes
1481549Srgrimesdepend: assym.s param.c vnode_if.h
149509Srgrimes	sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c
1504Srgrimes	sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1514Srgrimes
1524Srgrimeslinks:
1534Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1544Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1554Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1564Srgrimes	  sort -u | comm -23 - dontlink | \
1574Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1584Srgrimes	sh makelinks && rm -f dontlink
1594Srgrimes
1604Srgrimestags:
1614Srgrimes	@echo "see $S/kern/Makefile for tags"
1624Srgrimes
1634Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1644Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1654Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1664Srgrimes
167798Swollmanconf.o: ${I386}/i386/conf.c $S/sys/conf.h
168798Swollman	${CC} -c ${CFLAGS} ${I386}/i386/conf.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
1894Srgrimes
190