Makefile.powerpc revision 18518
116239Sjkh# Makefile.i386 -- with config changes.
24Srgrimes# Copyright 1990 W. Jolitz
3509Srgrimes#	from: @(#)Makefile.i386	7.1 5/10/91
418518Sbde#	$Id: Makefile.i386,v 1.87 1996/08/31 14:47:08 bde 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 \
3117971Sbde		-Winline -Wunused -Wpointer-arith
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
4018518SbdeINCLUDES= -nostdinc -I- -I. -I$S
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
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 LOCORE means "don't declare C stuff" not "for locore.s".
5416028SpeterNORMAL_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
554SrgrimesDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
564SrgrimesDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
5716028SpeterDRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
583863SbdePROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
592408Sbde
6016239SjkhSYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c
612408SbdeSYSTEM_SFILES= ${I386}/i386/locore.s
6216239SjkhSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
6313031SbdeSYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
645908SbdeSYSTEM_LD_HEAD= @echo loading $@; rm -f $@
6513031SbdeSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
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
854Srgrimesclean:
8613031Sbde	rm -f *.o *.s eddep errs genassym kernel linterrs \
879647Sbde	      makelinks param.c symbols.exclude symbols.sort tags \
889647Sbde	      vers.c vnode_if.c vnode_if.h ${CLEAN}
894Srgrimes
90715Swollman#lint: /tmp param.c
913863Sbde#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
92715Swollman#	  ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \
93715Swollman#	    grep -v 'struct/union .* never defined' | \
94715Swollman#	    grep -v 'possible pointer alignment problem'
954Srgrimes
965908Sbdesymbols.exclude: Makefile
975908Sbde	echo "gcc2_compiled." >symbols.exclude
985908Sbde	echo "___gnu_compiled_c" >>symbols.exclude
995908Sbde
1004Srgrimessymbols.sort: ${I386}/i386/symbols.raw
1014Srgrimes	grep -v '^#' ${I386}/i386/symbols.raw \
1024Srgrimes	    | sed 's/^	//' | sort -u > symbols.sort
1034Srgrimes
1042464Sbdelocore.o: ${I386}/i386/locore.s assym.s
1052408Sbde	${NORMAL_S}
1064Srgrimes
1072408Sbde# everything potentially depends on the Makefile since everything potentially
1082408Sbde# depends on the options.  Some things are more dependent on the Makefile for
1092408Sbde# historical reasons.
1102408Sbdemachdep.o: Makefile
111757Sdg
1124Srgrimes# the following is necessary because autoconf.o depends on #if GENERIC
1134Srgrimesautoconf.o: Makefile
1144Srgrimes
11513259Swollman# XXX - may no longer be needed
11613259Swollmanlocore.o: Makefile
1174Srgrimes
1184Srgrimes# depends on KDB (cons.o also depends on GENERIC)
1194Srgrimestrap.o cons.o: Makefile
1204Srgrimes
1212408Sbde# this rule stops ./assym.s in .depend from causing problems
1222408Sbde./assym.s: assym.s
1232408Sbde
124649Snateassym.s: genassym
1253863Sbde	./genassym >assym.s
1264Srgrimes
1278876Srgrimes# Some of the defines that genassym outputs may well depend on the
128715Swollman# value of kernel options.
1293863Sbdegenassym.o: ${I386}/i386/genassym.c Makefile
1304508Sbde	${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
1314Srgrimes
1323863Sbdegenassym: genassym.o
1333863Sbde	${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
1343863Sbde
1352408Sbde# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
1365327Sgibbsdepend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
13714924Speter	rm -f .newdep
13814924Speter	mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
13914924Speter	mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
14014924Speter	MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \
14114924Speter	mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
14214331Speter	rm -f .depend
14315679Swosch	mv -f .newdep .depend
1444Srgrimes
1454Srgrimeslinks:
1468457Swollman	egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \
1474Srgrimes	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1488457Swollman	echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1494Srgrimes	  sort -u | comm -23 - dontlink | \
1504Srgrimes	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1514Srgrimes	sh makelinks && rm -f dontlink
1524Srgrimes
1534Srgrimestags:
1544Srgrimes	@echo "see $S/kern/Makefile for tags"
1554Srgrimes
15615558Sjoerginstall:
15715558Sjoerg	@if [ ! -f kernel ] ; then \
15815558Sjoerg		echo "You must first build your kernel before trying to install." ; \
15915558Sjoerg		exit 1 ; \
16015558Sjoerg	fi
1612823Sjkh	chflags noschg /kernel
1622627Swollman	mv /kernel /kernel.old
16317742Sache	if [ `/usr/sbin/sysctl -n kern.bootfile` = /kernel ] ; then \
16417742Sache		/usr/sbin/sysctl -w kern.bootfile=/kernel.old ; \
16513330Speter		mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
16613321Sphk	fi
1672627Swollman	install -c -m 555 -o root -g wheel -fschg kernel /
1682627Swollman
16915543Sphkioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \
1704Srgrimes    ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h
1714Srgrimes	${CC} -c ${CFLAGS} ioconf.c
1724Srgrimes
173509Srgrimesparam.c: $S/conf/param.c
1744Srgrimes	-rm -f param.c
1754Srgrimes	cp $S/conf/param.c .
1764Srgrimes
1774Srgrimesparam.o: param.c Makefile
1784Srgrimes	${CC} -c ${CFLAGS} ${PARAM} param.c
1794Srgrimes
180509Srgrimesvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1814Srgrimes	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1824Srgrimes	${CC} ${CFLAGS} -c vers.c
1834Srgrimes
1841549Srgrimesvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1851549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1861549Srgrimesvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1871549Srgrimes	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1881549Srgrimes
1894Srgrimes%RULES
1904Srgrimes
1914Srgrimes# DO NOT DELETE THIS LINE -- make depend uses it
192