Makefile.powerpc revision 17742
116239Sjkh# Makefile.i386 -- with config changes.
24Srgrimes# Copyright 1990 W. Jolitz
3509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
417742Sache#	$Id: Makefile.i386,v 1.85 1996/06/12 05:54:46 gpalmer Exp $
54Srgrimes#
6509Srgrimes# Makefile for FreeBSD
7509Srgrimes#
84Srgrimes# This makefile is constructed from a machine description:
94Srgrimes#	config machineid
104Srgrimes# Most changes should be made in the machine description
114Srgrimes#	/sys/i386/conf/``machineid''
124Srgrimes# after which you should do
134Srgrimes#	 config machineid
144Srgrimes# Generic makefile changes should be made in
154Srgrimes#	/sys/i386/conf/Makefile.i386
164Srgrimes# after which config should be rerun for all machines.
174Srgrimes#
188876SrgrimesCC?=	cc
193698SwollmanCPP?=	cpp
205908SbdeLD?=	/usr/bin/ld
214Srgrimes
222056Swollman.if exists(./@/.)
232056SwollmanS=	./@
242056Swollman.else
254SrgrimesS=	../..
262056Swollman.endif
272056SwollmanI386=	${S}/i386
284Srgrimes
2910079SbdeCWARNFLAGS?=	-W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \
3012880Sbde		-Wnested-externs -Wstrict-prototypes -Wmissing-prototypes \
3116323Sgpalmer		-Winline -Wunused
32798Swollman#
333863Sbde# The following flags are next up for working on:
3412880Sbde#	-Wall
35798Swollman#
36798Swollman# When working on removing warnings from code, the `-Werror' flag should be
37798Swollman# of material assistance.
38798Swollman#
394836SdgCOPTFLAGS?=-O
406733Sbde# Not ready for -I- yet.  #include "foo.h" where foo.h is in the srcdir fails.
417627SnateINCLUDES= -nostdinc -I. -I$S -I$S/sys
427627Snate# This hack is to allow kernel compiles to succeed on machines w/out srcdist
437627Snate.if exists($S/../include)
447627SnateINCLUDES+= -I$S/../include
457627Snate.else
467627SnateINCLUDES+= -I/usr/include
477627Snate.endif
4812400SdgCOPTS=	${INCLUDES} ${IDENT} -DKERNEL
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 LOCORE means "don't declare C stuff" not "for locore.s".
5516028SpeterNORMAL_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
564SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
574SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
5816028SpeterDRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
593863SbdePROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
602408Sbde
6116239SjkhSYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c
622408SbdeSYSTEM_SFILES= ${I386}/i386/locore.s
6316239SjkhSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
6413031SbdeSYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
655908SbdeSYSTEM_LD_HEAD= @echo loading $@; rm -f $@
6613031SbdeSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
675908Sbde.if ${CFLAGS:M-g} == ""
685908SbdeSYMORDER_EXCLUDE=-x symbols.exclude
695908Sbde.endif
705908SbdeSYSTEM_LD_TAIL= @echo rearranging symbols; \
716018Sphk	symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \
725908Sbde	size $@; chmod 755 $@
734Srgrimes
745327Sgibbs%BEFORE_DEPEND
755327Sgibbs
764Srgrimes%OBJS
774Srgrimes
784Srgrimes%CFILES
794Srgrimes
8011918Sdg%SFILES
8111918Sdg
824Srgrimes%LOAD
834Srgrimes
846802Sgibbs%CLEAN
856802Sgibbs
864Srgrimesclean:
8713031Sbde	rm -f *.o *.s eddep errs genassym kernel linterrs \
889647Sbde	      makelinks param.c symbols.exclude symbols.sort tags \
899647Sbde	      vers.c vnode_if.c vnode_if.h ${CLEAN}
904Srgrimes
91715Swollman#lint: /tmp param.c
923863Sbde#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
93715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
94715Swollman#	    grep -v 'struct/union .* never defined' | \
95715Swollman#	    grep -v 'possible pointer alignment problem'
964Srgrimes
975908Sbdesymbols.exclude: Makefile
985908Sbde	echo "gcc2_compiled." >symbols.exclude
995908Sbde	echo "___gnu_compiled_c" >>symbols.exclude
1005908Sbde
1014Srgrimessymbols.sort: ${I386}/i386/symbols.raw
1024Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
1034Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
1044Srgrimes
1052464Sbdelocore.o: ${I386}/i386/locore.s assym.s
1062408Sbde	${NORMAL_S}
1074Srgrimes
1082408Sbde# everything potentially depends on the Makefile since everything potentially
1092408Sbde# depends on the options.  Some things are more dependent on the Makefile for
1102408Sbde# historical reasons.
1112408Sbdemachdep.o: Makefile
112757Sdg
1134Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1144Srgrimesautoconf.o: Makefile
1154Srgrimes
11613259Swollman# XXX - may no longer be needed
11713259Swollmanlocore.o: Makefile
1184Srgrimes
1194Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1204Srgrimestrap.o cons.o: Makefile
1214Srgrimes
1222408Sbde# this rule stops ./assym.s in .depend from causing problems
1232408Sbde./assym.s: assym.s
1242408Sbde
125649Snateassym.s: genassym
1263863Sbde	./genassym >assym.s
1274Srgrimes
1288876Srgrimes# Some of the defines that genassym outputs may well depend on the
129715Swollman# value of kernel options.
1303863Sbdegenassym.o: ${I386}/i386/genassym.c Makefile
1314508Sbde	${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1324Srgrimes
1333863Sbdegenassym: genassym.o
1343863Sbde	${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
1353863Sbde
1362408Sbde# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
1375327Sgibbsdepend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
13814924Speter	rm -f .newdep
13914924Speter	mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
14014924Speter	mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
14114924Speter	MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \
14214924Speter	mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
14314331Speter	rm -f .depend
14415679Swosch	mv -f .newdep .depend
1454Srgrimes
1464Srgrimeslinks:
1478457Swollman	egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \
1484Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1498457Swollman	echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1504Srgrimes	  sort -u | comm -23 - dontlink | \
1514Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1524Srgrimes	sh makelinks && rm -f dontlink
1534Srgrimes
1544Srgrimestags:
1554Srgrimes	@echo "see $S/kern/Makefile for tags"
1564Srgrimes
15715558Sjoerginstall:
15815558Sjoerg	@if [ ! -f kernel ] ; then \
15915558Sjoerg		echo "You must first build your kernel before trying to install." ; \
16015558Sjoerg		exit 1 ; \
16115558Sjoerg	fi
1622823Sjkh	chflags noschg /kernel
1632627Swollman	mv /kernel /kernel.old
16417742Sache	if [ `/usr/sbin/sysctl -n kern.bootfile` = /kernel ] ; then \
16517742Sache		/usr/sbin/sysctl -w kern.bootfile=/kernel.old ; \
16613330Speter		mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
16713321Sphk	fi
1682627Swollman	install -c -m 555 -o root -g wheel -fschg kernel /
1692627Swollman
17015543Sphkioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \
1714Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1724Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1734Srgrimes
174509Srgrimesparam.c: $S/conf/param.c
1754Srgrimes	-rm -f param.c
1764Srgrimes	cp $S/conf/param.c .
1774Srgrimes
1784Srgrimesparam.o: param.c Makefile
1794Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1804Srgrimes
181509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1824Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1834Srgrimes	${CC} ${CFLAGS} -c vers.c
1844Srgrimes
1851549Srgrimesvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1861549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1871549Srgrimesvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1881549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1891549Srgrimes
1904Srgrimes%RULES
1914Srgrimes
1924Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
193