Makefile.powerpc revision 11918
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
311918Sdg#	$Id: Makefile.i386,v 1.66 1995/08/16 16:11:48 bde 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#
178876SrgrimesCC?=	cc
183698SwollmanCPP?=	cpp
195908SbdeLD?=	/usr/bin/ld
204Srgrimes
212056Swollman.if exists(./@/.)
222056SwollmanS=	./@
232056Swollman.else
244SrgrimesS=	../..
252056Swollman.endif
262056SwollmanI386=	${S}/i386
274Srgrimes
2810079SbdeCWARNFLAGS?=	-W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \
2910079Sbde		-Wnested-externs
30798Swollman#
313863Sbde# The following flags are next up for working on:
327367Sbde#	-Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations
33798Swollman#
34798Swollman# When working on removing warnings from code, the `-Werror' flag should be
35798Swollman# of material assistance.
36798Swollman#
374836SdgCOPTFLAGS?=-O
386733Sbde# Not ready for -I- yet.  #include "foo.h" where foo.h is in the srcdir fails.
397627SnateINCLUDES= -nostdinc -I. -I$S -I$S/sys
407627Snate# This hack is to allow kernel compiles to succeed on machines w/out srcdist
417627Snate.if exists($S/../include)
427627SnateINCLUDES+= -I$S/../include
437627Snate.else
447627SnateINCLUDES+= -I/usr/include
457627Snate.endif
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
602408SbdeSYSTEM_CFILES= ioconf.c param.c vnode_if.c
612408SbdeSYSTEM_SFILES= ${I386}/i386/locore.s
628876SrgrimesSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o
635908SbdeSYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} libkern.a
645908SbdeSYSTEM_LD_HEAD= @echo loading $@; rm -f $@
651549SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
665908Sbde.if ${CFLAGS:M-g} == ""
675908SbdeSYMORDER_EXCLUDE=-x symbols.exclude
685908Sbde.endif
695908SbdeSYSTEM_LD_TAIL= @echo rearranging symbols; \
706018Sphk	symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \
715908Sbde	size $@; chmod 755 $@
724Srgrimes
735327Sgibbs%BEFORE_DEPEND
745327Sgibbs
754Srgrimes%OBJS
764Srgrimes
774Srgrimes%CFILES
784Srgrimes
7911918Sdg%SFILES
8011918Sdg
814Srgrimes%LOAD
824Srgrimes
836802Sgibbs%CLEAN
846802Sgibbs
852232Sjkh# This is slightly different from before in that if you define PROF
862232Sjkh# to anything, it will assume profiling.  Don't do "PROF=" to turn
872232Sjkh# profiling off!
882232Sjkh.if exists($S/libkern/obj)
892232SjkhLIBKERNP=$S/libkern/obj
902232Sjkh.else
912232SjkhLIBKERNP=$S/libkern
922239Sjkh.endif
932239Sjkh
942232Sjkh.if defined(PROF)
952232SjkhLIBKERN=${LIBKERNP}/libkern_p.a
962232Sjkh.else
972232SjkhLIBKERN=${LIBKERNP}/libkern.a
982239Sjkh.endif
991549Srgrimes
1002232Sjkhlibkern.a: ${LIBKERN}
1012514Sjkh	@rm -f libkern.a
1022232Sjkh	ln -s ${LIBKERN} libkern.a
1032232Sjkh
1042232Sjkh${LIBKERN}:
1052232Sjkh	@(cd $S/libkern; make)
1062232Sjkh
1074Srgrimesclean:
1089647Sbde	rm -f *.o *.s eddep errs genassym kernel libkern.a linterrs \
1099647Sbde	      makelinks param.c symbols.exclude symbols.sort tags \
1109647Sbde	      vers.c vnode_if.c vnode_if.h ${CLEAN}
1114Srgrimes
112715Swollman#lint: /tmp param.c
1133863Sbde#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
114715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
115715Swollman#	    grep -v 'struct/union .* never defined' | \
116715Swollman#	    grep -v 'possible pointer alignment problem'
1174Srgrimes
1185908Sbdesymbols.exclude: Makefile
1195908Sbde	echo "gcc2_compiled." >symbols.exclude
1205908Sbde	echo "___gnu_compiled_c" >>symbols.exclude
1215908Sbde
1224Srgrimessymbols.sort: ${I386}/i386/symbols.raw
1234Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
1244Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
1254Srgrimes
1262464Sbdelocore.o: ${I386}/i386/locore.s assym.s
1272408Sbde	${NORMAL_S}
1284Srgrimes
1292408Sbde# everything potentially depends on the Makefile since everything potentially
1302408Sbde# depends on the options.  Some things are more dependent on the Makefile for
1312408Sbde# historical reasons.
1322408Sbdemachdep.o: Makefile
133757Sdg
1344Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1354Srgrimesautoconf.o: Makefile
1364Srgrimes
1374Srgrimes# depend on network configuration
1384Srgrimesaf.o uipc_proto.o locore.o: Makefile
1394Srgrimes
1404Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1414Srgrimestrap.o cons.o: Makefile
1424Srgrimes
1432408Sbde# this rule stops ./assym.s in .depend from causing problems
1442408Sbde./assym.s: assym.s
1452408Sbde
146649Snateassym.s: genassym
1473863Sbde	./genassym >assym.s
1484Srgrimes
1498876Srgrimes# Some of the defines that genassym outputs may well depend on the
150715Swollman# value of kernel options.
1513863Sbdegenassym.o: ${I386}/i386/genassym.c Makefile
1524508Sbde	${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1534Srgrimes
1543863Sbdegenassym: genassym.o
1553863Sbde	${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
1563863Sbde
1572408Sbde# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
1585327Sgibbsdepend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
1592408Sbde	mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
1604508Sbde	mkdep -a ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1612408Sbde	MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \
1623863Sbde	mkdep -a -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
1634Srgrimes
1644Srgrimeslinks:
1658457Swollman	egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \
1664Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1678457Swollman	echo ${CFILES:Nswapkernel.c} | 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
1724Srgrimestags:
1734Srgrimes	@echo "see $S/kern/Makefile for tags"
1744Srgrimes
1752627Swollmaninstall:
1762823Sjkh	chflags noschg /kernel
1772627Swollman	mv /kernel /kernel.old
1782627Swollman	install -c -m 555 -o root -g wheel -fschg kernel /
1792627Swollman
1804Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1814Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1824Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1834Srgrimes
184509Srgrimesparam.c: $S/conf/param.c
1854Srgrimes	-rm -f param.c
1864Srgrimes	cp $S/conf/param.c .
1874Srgrimes
1884Srgrimesparam.o: param.c Makefile
1894Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1904Srgrimes
191509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1924Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1934Srgrimes	${CC} ${CFLAGS} -c vers.c
1944Srgrimes
1951549Srgrimesvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1961549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1971549Srgrimesvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1981549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1991549Srgrimes
2004Srgrimes%RULES
2014Srgrimes
2024Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
203