Makefile.powerpc revision 2627
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
3757Sdg#	$Id: Makefile.i386,v 1.35 1994/09/05 19:10:01 jkh 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 flag is next up for working on:
39509Srgrimes# -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} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
56509SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
574SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
584Srgrimes
59509SrgrimesSFILES=	${I386}/i386/exception.s ${I386}/i386/microtime.s \
604Srgrimes	${I386}/i386/support.s ${I386}/i386/swtch.s
614SrgrimesSYSTEM_CFILES= ioconf.c param.c vnode_if.c
624SrgrimesSYSTEM_SFILES= ${I386}/i386/locore.s
634SrgrimesSYSTEM_OBJS=locore.o ${OBJS} ioconf.o param.o vnode_if.o
644SrgrimesSYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a
654SrgrimesSYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
664SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
674SrgrimesSYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \
684Srgrimes	${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@
694Srgrimes
704Srgrimes# (XXX) ok, this is weird.  but we've got a working ed, and a broken ex, and
71715Swollman# the script is identical for either... -- cgd
724Srgrimes#
73715SwollmanGPROF.EX=	/usr/src/lib/csu.i386/gprof.ex
74715SwollmanPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
75715Swollman		ed - $*.s < ${GPROF.EX} ; \
76715Swollman		${AS} -o $@ $*.s ; \
77715Swollman		rm -f $*.s
784Srgrimes
794Srgrimes%OBJS
804Srgrimes
814Srgrimes%CFILES
824Srgrimes
834Srgrimes%LOAD
844Srgrimes
854Srgrimes# This is slightly different from before in that if you define PROF
86757Sdg# to anything, it will assume profiling.  Don't do "PROF=" to turn
87757Sdg# profiling off!
884Srgrimes.if exists($S/libkern/obj)
894SrgrimesLIBKERNP=$S/libkern/obj
904Srgrimes.else
91757SdgLIBKERNP=$S/libkern
92757Sdg.endif
93757Sdg
94757Sdg.if defined(PROF)
95757SdgLIBKERN=${LIBKERNP}/libkern_p.a
96757Sdg.else
97757SdgLIBKERN=${LIBKERNP}/libkern.a
98757Sdg.endif
99757Sdg
100757Sdglibkern.a: ${LIBKERN}
101757Sdg	@rm -f libkern.a
102757Sdg	ln -s ${LIBKERN} libkern.a
103757Sdg
104757Sdg${LIBKERN}:
105757Sdg	@(cd $S/libkern; make)
106757Sdg
107757Sdgclean:
108509Srgrimes	rm -f eddep *kernel tags *.o locore.i [a-uw-z]*.s \
109509Srgrimes		errs linterrs makelinks genassym ,assym.s stamp-assym
110509Srgrimes
1114Srgrimes#lint: /tmp param.c
1124Srgrimes#	@lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
1134Srgrimes#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
1144Srgrimes#	    grep -v 'struct/union .* never defined' | \
1154Srgrimes#	    grep -v 'possible pointer alignment problem'
1164Srgrimes
1174Srgrimessymbols.sort: ${I386}/i386/symbols.raw
1184Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
1194Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
120649Snate
121715Swollmanlocore.o: ${I386}/i386/locore.s assym.s
122715Swollman	${NORMAL_S}
123715Swollman
124715Swollman# everything potentially depends on the Makefile since everything potentially
125715Swollman# depends on the options.  Some things are more dependent on the Makefile for
126715Swollman# historical reasons.
127715Swollmanmachdep.o: Makefile
1284Srgrimes
129715Swollman# the following is necessary because autoconf.o depends on #if GENERIC
130715Swollmanautoconf.o: Makefile
131715Swollman
1324Srgrimes# depend on network configuration
133648Snateaf.o uipc_proto.o locore.o: Makefile
1344Srgrimes
1354Srgrimes# depends on KDB (cons.o also depends on GENERIC)
136509Srgrimestrap.o cons.o: Makefile
1374Srgrimes
1384Srgrimes# this rule stops ./assym.s in .depend from causing problems
1394Srgrimes./assym.s: assym.s
1404Srgrimes
1414Srgrimesassym.s: genassym
1424Srgrimes	./genassym >,assym.s
1434Srgrimes	if cmp -s assym.s ,assym.s; then \
1444Srgrimes		rm -f ,assym.s; \
1454Srgrimes	else \
1464Srgrimes		rm -f assym.s; \
1474Srgrimes		mv ,assym.s assym.s; \
1484Srgrimes	fi
1494Srgrimes
1504Srgrimes# Some of the defines that genassym outputs may well depend on the 
1514Srgrimes# value of kernel options.
1524Srgrimesgenassym:	Makefile
1534Srgrimes	${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
154509Srgrimes		 ${I386}/i386/genassym.c -static -o genassym
1554Srgrimes
1564Srgrimes# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
157509Srgrimesdepend: assym.s param.c vnode_if.h
1584Srgrimes	mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
1594Srgrimes	mkdep -a -p ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \
1604Srgrimes		${I386}/i386/genassym.c
1614Srgrimes	MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \
1624Srgrimes	mkdep -a -I. -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
1634Srgrimes
164509Srgrimeslinks:
1654Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1664Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1674Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1684Srgrimes	  sort -u | comm -23 - dontlink | \
1694Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1704Srgrimes	sh makelinks && rm -f dontlink
1714Srgrimes
172tags:
173	@echo "see $S/kern/Makefile for tags"
174
175install:
176	mv /kernel /kernel.old
177	install -c -m 555 -o root -g wheel -fschg kernel /
178
179ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
180    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
181	${CC} -c ${CFLAGS} ioconf.c
182
183param.c: $S/conf/param.c
184	-rm -f param.c
185	cp $S/conf/param.c .
186
187param.o: param.c Makefile
188	${CC} -c ${CFLAGS} ${PARAM} param.c
189
190vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
191	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
192	${CC} ${CFLAGS} -c vers.c
193
194vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
195	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
196vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
197	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
198
199%RULES
200
201# DO NOT DELETE THIS LINE -- make depend uses it
202