Makefile.powerpc revision 7627
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
37627Snate#	$Id: Makefile.i386,v 1.61 1995/04/03 01:13:50 nate 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#
173698SwollmanCC?=	cc 
183698SwollmanCPP?=	cpp
195908SbdeLD?=	/usr/bin/ld
204Srgrimes
212056Swollman.if exists(./@/.)
222056SwollmanS=	./@
232056Swollman.else
244SrgrimesS=	../..
252056Swollman.endif
262056SwollmanI386=	${S}/i386
274Srgrimes
287432SbdeCWARNFLAGS?=-W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit
29798Swollman#
303863Sbde# The following flags are next up for working on:
317432Sbde#	-Wnested-externs (almost works)
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
602408SbdeSFILES=	${I386}/i386/exception.s ${I386}/i386/microtime.s \
613258Sdg	${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s
622408SbdeSYSTEM_CFILES= ioconf.c param.c vnode_if.c
632408SbdeSYSTEM_SFILES= ${I386}/i386/locore.s
645908SbdeSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o 
655908SbdeSYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} libkern.a
665908SbdeSYSTEM_LD_HEAD= @echo loading $@; rm -f $@
671549SrgrimesSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a
685908Sbde.if ${CFLAGS:M-g} == ""
695908SbdeSYMORDER_EXCLUDE=-x symbols.exclude
705908Sbde.endif
715908SbdeSYSTEM_LD_TAIL= @echo rearranging symbols; \
726018Sphk	symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \
735908Sbde	size $@; chmod 755 $@
744Srgrimes
755327Sgibbs%BEFORE_DEPEND
765327Sgibbs
774Srgrimes%OBJS
784Srgrimes
794Srgrimes%CFILES
804Srgrimes
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:
1085908Sbde	rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym \
1096802Sgibbs	      symbols.exclude symbols.sort ${CLEAN}
1104Srgrimes
111715Swollman#lint: /tmp param.c
1123863Sbde#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
113715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
114715Swollman#	    grep -v 'struct/union .* never defined' | \
115715Swollman#	    grep -v 'possible pointer alignment problem'
1164Srgrimes
1175908Sbdesymbols.exclude: Makefile
1185908Sbde	echo "gcc2_compiled." >symbols.exclude
1195908Sbde	echo "___gnu_compiled_c" >>symbols.exclude
1205908Sbde
1214Srgrimessymbols.sort: ${I386}/i386/symbols.raw
1224Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
1234Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
1244Srgrimes
1252464Sbdelocore.o: ${I386}/i386/locore.s assym.s
1262408Sbde	${NORMAL_S}
1274Srgrimes
1282408Sbde# everything potentially depends on the Makefile since everything potentially
1292408Sbde# depends on the options.  Some things are more dependent on the Makefile for
1302408Sbde# historical reasons.
1312408Sbdemachdep.o: Makefile
132757Sdg
1334Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1344Srgrimesautoconf.o: Makefile
1354Srgrimes
1364Srgrimes# depend on network configuration
1374Srgrimesaf.o uipc_proto.o locore.o: Makefile
1384Srgrimes
1394Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1404Srgrimestrap.o cons.o: Makefile
1414Srgrimes
1422408Sbde# this rule stops ./assym.s in .depend from causing problems
1432408Sbde./assym.s: assym.s
1442408Sbde
145649Snateassym.s: genassym
1463863Sbde	./genassym >assym.s
1474Srgrimes
148715Swollman# Some of the defines that genassym outputs may well depend on the 
149715Swollman# value of kernel options.
1503863Sbdegenassym.o: ${I386}/i386/genassym.c Makefile
1514508Sbde	${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1524Srgrimes
1533863Sbdegenassym: genassym.o
1543863Sbde	${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
1553863Sbde
1562408Sbde# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
1575327Sgibbsdepend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
1582408Sbde	mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
1594508Sbde	mkdep -a ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1602408Sbde	MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \
1613863Sbde	mkdep -a -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
1624Srgrimes
1634Srgrimeslinks:
1644Srgrimes	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1654Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1664Srgrimes	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1674Srgrimes	  sort -u | comm -23 - dontlink | \
1684Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1694Srgrimes	sh makelinks && rm -f dontlink
1704Srgrimes
1714Srgrimestags:
1724Srgrimes	@echo "see $S/kern/Makefile for tags"
1734Srgrimes
1742627Swollmaninstall:
1752823Sjkh	chflags noschg /kernel
1762627Swollman	mv /kernel /kernel.old
1772627Swollman	install -c -m 555 -o root -g wheel -fschg kernel /
1782627Swollman
1794Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1804Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1814Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1824Srgrimes
183509Srgrimesparam.c: $S/conf/param.c
1844Srgrimes	-rm -f param.c
1854Srgrimes	cp $S/conf/param.c .
1864Srgrimes
1874Srgrimesparam.o: param.c Makefile
1884Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1894Srgrimes
190509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1914Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1924Srgrimes	${CC} ${CFLAGS} -c vers.c
1934Srgrimes
1941549Srgrimesvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1951549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1961549Srgrimesvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1971549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1981549Srgrimes
1994Srgrimes%RULES
2004Srgrimes
2014Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
202