Makefile.powerpc revision 14924
14Srgrimes# Copyright 1990 W. Jolitz
2509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
314924Speter#	$Id: Makefile.i386,v 1.77 1996/03/29 14:08:30 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 \
2912880Sbde		-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes \
3012880Sbde		-Winline
31798Swollman#
323863Sbde# The following flags are next up for working on:
3312880Sbde#	-Wall
34798Swollman#
35798Swollman# When working on removing warnings from code, the `-Werror' flag should be
36798Swollman# of material assistance.
37798Swollman#
384836SdgCOPTFLAGS?=-O
396733Sbde# Not ready for -I- yet.  #include "foo.h" where foo.h is in the srcdir fails.
407627SnateINCLUDES= -nostdinc -I. -I$S -I$S/sys
417627Snate# This hack is to allow kernel compiles to succeed on machines w/out srcdist
427627Snate.if exists($S/../include)
437627SnateINCLUDES+= -I$S/../include
447627Snate.else
457627SnateINCLUDES+= -I/usr/include
467627Snate.endif
4712400SdgCOPTS=	${INCLUDES} ${IDENT} -DKERNEL
484SrgrimesASFLAGS=
49712SwollmanCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
50974SdgLOAD_ADDRESS?=	F0100000
514Srgrimes
524SrgrimesNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
534SrgrimesNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
542408Sbde# XXX errors leak out of all the pipes.  Should use cc *.S.
552408Sbde# XXX LOCORE means "don't declare C stuff" not "for locore.s".
563863SbdeNORMAL_S= ${CPP} -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
574SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
584SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
5911999SpeterDRIVER_S= ${CPP} -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o
603863SbdePROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
612408Sbde
622408SbdeSYSTEM_CFILES= ioconf.c param.c vnode_if.c
632408SbdeSYSTEM_SFILES= ${I386}/i386/locore.s
648876SrgrimesSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o
6513031SbdeSYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
665908SbdeSYSTEM_LD_HEAD= @echo loading $@; rm -f $@
6713031SbdeSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
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
8111918Sdg%SFILES
8211918Sdg
834Srgrimes%LOAD
844Srgrimes
856802Sgibbs%CLEAN
866802Sgibbs
874Srgrimesclean:
8813031Sbde	rm -f *.o *.s eddep errs genassym kernel linterrs \
899647Sbde	      makelinks param.c symbols.exclude symbols.sort tags \
909647Sbde	      vers.c vnode_if.c vnode_if.h ${CLEAN}
914Srgrimes
92715Swollman#lint: /tmp param.c
933863Sbde#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
94715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
95715Swollman#	    grep -v 'struct/union .* never defined' | \
96715Swollman#	    grep -v 'possible pointer alignment problem'
974Srgrimes
985908Sbdesymbols.exclude: Makefile
995908Sbde	echo "gcc2_compiled." >symbols.exclude
1005908Sbde	echo "___gnu_compiled_c" >>symbols.exclude
1015908Sbde
1024Srgrimessymbols.sort: ${I386}/i386/symbols.raw
1034Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
1044Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
1054Srgrimes
1062464Sbdelocore.o: ${I386}/i386/locore.s assym.s
1072408Sbde	${NORMAL_S}
1084Srgrimes
1092408Sbde# everything potentially depends on the Makefile since everything potentially
1102408Sbde# depends on the options.  Some things are more dependent on the Makefile for
1112408Sbde# historical reasons.
1122408Sbdemachdep.o: Makefile
113757Sdg
1144Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1154Srgrimesautoconf.o: Makefile
1164Srgrimes
11713259Swollman# XXX - may no longer be needed
11813259Swollmanlocore.o: Makefile
1194Srgrimes
1204Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1214Srgrimestrap.o cons.o: Makefile
1224Srgrimes
1232408Sbde# this rule stops ./assym.s in .depend from causing problems
1242408Sbde./assym.s: assym.s
1252408Sbde
126649Snateassym.s: genassym
1273863Sbde	./genassym >assym.s
1284Srgrimes
1298876Srgrimes# Some of the defines that genassym outputs may well depend on the
130715Swollman# value of kernel options.
1313863Sbdegenassym.o: ${I386}/i386/genassym.c Makefile
1324508Sbde	${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1334Srgrimes
1343863Sbdegenassym: genassym.o
1353863Sbde	${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
1363863Sbde
1372408Sbde# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
1385327Sgibbsdepend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
13914924Speter	rm -f .newdep
14014924Speter	mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
14114924Speter	mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
14214924Speter	MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \
14314924Speter	mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
14414331Speter	rm -f .depend
14514924Speter	mv .newdep .depend
1464Srgrimes
1474Srgrimeslinks:
1488457Swollman	egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \
1494Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1508457Swollman	echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1514Srgrimes	  sort -u | comm -23 - dontlink | \
1524Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1534Srgrimes	sh makelinks && rm -f dontlink
1544Srgrimes
1554Srgrimestags:
1564Srgrimes	@echo "see $S/kern/Makefile for tags"
1574Srgrimes
1582627Swollmaninstall:
1592823Sjkh	chflags noschg /kernel
1602627Swollman	mv /kernel /kernel.old
16114915Sbde	if [ `sysctl -n kern.bootfile` = /kernel ] ; then \
16213321Sphk		sysctl -w kern.bootfile=/kernel.old ; \
16313330Speter		mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
16413321Sphk	fi
1652627Swollman	install -c -m 555 -o root -g wheel -fschg kernel /
1662627Swollman
1674Srgrimesioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \
1684Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1694Srgrimes	${CC} -c ${CFLAGS} ioconf.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
190