Makefile.pc98 revision 19122
116359Sasami# Makefile for FreeBSD(98) after:
216359Sasami#
316359Sasami# Makefile.i386 -- with config changes.
416359Sasami# Copyright 1990 W. Jolitz
516359Sasami#	from: @(#)Makefile.i386	7.1 5/10/91
619122Sasami#	$Id: Makefile.pc98,v 1.6 1996/10/09 21:45:45 asami Exp $
716359Sasami#
816359Sasami# Makefile for FreeBSD
916359Sasami#
1016359Sasami# This makefile is constructed from a machine description:
1116359Sasami#	config machineid
1216359Sasami# Most changes should be made in the machine description
1316359Sasami#	/sys/i386/conf/``machineid''
1416359Sasami# after which you should do
1516359Sasami#	 config machineid
1616359Sasami# Generic makefile changes should be made in
1716359Sasami#	/sys/i386/conf/Makefile.i386
1816359Sasami# after which config should be rerun for all machines.
1916359Sasami#
2016359SasamiCC?=	cc
2116359SasamiCPP?=	cpp
2216359SasamiLD?=	/usr/bin/ld
2316359Sasami
2416359Sasami.if exists(./@/.)
2516359SasamiS=	./@
2616359Sasami.else
2716359SasamiS=	../..
2816359Sasami.endif
2916359SasamiPC98=	${S}/pc98
3016359SasamiI386=	${S}/i386
3116359Sasami
3216359SasamiCOPTFLAGS?=-O
3318846SasamiINCLUDES= -nostdinc -I- -I. -I$S
3416359Sasami# This hack is to allow kernel compiles to succeed on machines w/out srcdist
3516359Sasami.if exists($S/../include)
3616359SasamiINCLUDES+= -I$S/../include
3716359Sasami.else
3816359SasamiINCLUDES+= -I/usr/include
3916359Sasami.endif
4016359SasamiCOPTS=	${INCLUDES} ${IDENT} -DKERNEL
4116359SasamiCFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
4216359SasamiLOAD_ADDRESS?=	F0100000
4316359Sasami
4416359SasamiNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
4516359SasamiNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
4616359Sasami# XXX LOCORE means "don't declare C stuff" not "for locore.s".
4716359SasamiNORMAL_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
4816359SasamiDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
4916359SasamiDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
5016359SasamiDRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
5116359SasamiPROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
5216359Sasami
5316359SasamiSYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c
5416359SasamiSYSTEM_SFILES= ${PC98}/i386/locore.s
5516359SasamiSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
5616359SasamiSYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
5716359SasamiSYSTEM_LD_HEAD= @echo loading $@; rm -f $@
5816359SasamiSYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
5916359Sasami.if ${CFLAGS:M-g} == ""
6016359SasamiSYMORDER_EXCLUDE=-x symbols.exclude
6116359Sasami.endif
6216359SasamiSYSTEM_LD_TAIL= @echo rearranging symbols; \
6316359Sasami	symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \
6416359Sasami	size $@; chmod 755 $@
6516359Sasami
6616359Sasami%BEFORE_DEPEND
6716359Sasami
6816359Sasami%OBJS
6916359Sasami
7016359Sasami%CFILES
7116359Sasami
7216359Sasami%SFILES
7316359Sasami
7416359Sasami%LOAD
7516359Sasami
7616359Sasami%CLEAN
7716359Sasami
7816359Sasamiclean:
7916359Sasami	rm -f *.o *.s eddep errs genassym kernel linterrs \
8016359Sasami	      makelinks param.c symbols.exclude symbols.sort tags \
8116359Sasami	      vers.c vnode_if.c vnode_if.h ${CLEAN}
8216359Sasami
8316359Sasami#lint: /tmp param.c
8416359Sasami#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
8516359Sasami#	  ${PC98}/i386/Locore.c ${CFILES} ioconf.c param.c | \
8616359Sasami#	    grep -v 'struct/union .* never defined' | \
8716359Sasami#	    grep -v 'possible pointer alignment problem'
8816359Sasami
8916359Sasamisymbols.exclude: Makefile
9016359Sasami	echo "gcc2_compiled." >symbols.exclude
9116359Sasami	echo "___gnu_compiled_c" >>symbols.exclude
9216359Sasami
9316359Sasamisymbols.sort: ${I386}/i386/symbols.raw
9416359Sasami	grep -v '^#' ${I386}/i386/symbols.raw \
9516359Sasami	    | sed 's/^	//' | sort -u > symbols.sort
9616359Sasami
9716359Sasamilocore.o: ${PC98}/i386/locore.s assym.s
9816359Sasami	${NORMAL_S}
9916359Sasami
10016359Sasami# everything potentially depends on the Makefile since everything potentially
10116359Sasami# depends on the options.  Some things are more dependent on the Makefile for
10216359Sasami# historical reasons.
10316359Sasamimachdep.o: Makefile
10416359Sasami
10516359Sasami# the following is necessary because autoconf.o depends on #if GENERIC
10616359Sasamiautoconf.o: Makefile
10716359Sasami
10816359Sasami# XXX - may no longer be needed
10916359Sasamilocore.o: Makefile
11016359Sasami
11116359Sasami# depends on KDB (cons.o also depends on GENERIC)
11216359Sasamitrap.o cons.o: Makefile
11316359Sasami
11416359Sasami# this rule stops ./assym.s in .depend from causing problems
11516359Sasami./assym.s: assym.s
11616359Sasami
11716359Sasamiassym.s: genassym
11816359Sasami	./genassym >assym.s
11916359Sasami
12016359Sasami# Some of the defines that genassym outputs may well depend on the
12116359Sasami# value of kernel options.
12216359Sasamigenassym.o: ${I386}/i386/genassym.c Makefile
12316359Sasami	rm -f ./machine ; ln -s ${I386}/include ./machine
12416359Sasami	${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
12516359Sasami
12616359Sasamigenassym: genassym.o
12716359Sasami	${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@
12816359Sasami
12916359Sasami# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
13016359Sasamidepend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
13116359Sasami	rm -f .newdep
13216359Sasami	mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
13316359Sasami	mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
13416359Sasami	MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \
13516359Sasami	mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
13616359Sasami	rm -f .depend
13716359Sasami	mv -f .newdep .depend
13816359Sasami
13916359Sasamilinks:
14016359Sasami	egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \
14116359Sasami	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
14216359Sasami	echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
14316359Sasami	  sort -u | comm -23 - dontlink | \
14416359Sasami	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
14516359Sasami	sh makelinks && rm -f dontlink
14616359Sasami
14716359Sasamitags:
14816359Sasami	@echo "see $S/kern/Makefile for tags"
14916359Sasami
15016359Sasamiinstall:
15116359Sasami	@if [ ! -f kernel ] ; then \
15216359Sasami		echo "You must first build your kernel before trying to install." ; \
15316359Sasami		exit 1 ; \
15416359Sasami	fi
15516359Sasami	chflags noschg /kernel
15616359Sasami	mv /kernel /kernel.old
15717947Sasami	if [ `/usr/sbin/sysctl -n kern.bootfile` = /kernel ] ; then \
15817947Sasami		/usr/sbin/sysctl -w kern.bootfile=/kernel.old ; \
15916359Sasami		mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
16016359Sasami	fi
16116359Sasami	install -c -m 555 -o root -g wheel -fschg kernel /
16216359Sasami
16316359Sasamiioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \
16418095Sasami    ${I386}/isa/isa_device.h ${PC98}/pc98/pc98.h ${I386}/isa/icu.h
16516359Sasami	${CC} -c ${CFLAGS} ioconf.c
16616359Sasami
16716359Sasamiparam.c: $S/conf/param.c
16816359Sasami	-rm -f param.c
16916359Sasami	cp $S/conf/param.c .
17016359Sasami
17116359Sasamiparam.o: param.c Makefile
17216359Sasami	${CC} -c ${CFLAGS} ${PARAM} param.c
17316359Sasami
17416359Sasamivers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
17516359Sasami	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
17616359Sasami	${CC} ${CFLAGS} -c vers.c
17716359Sasami
17816359Sasamivnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
17916359Sasami	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
18016359Sasamivnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
18116359Sasami	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
18216359Sasami
18319122Sasami.include <bsd.kern.mk>
18419122Sasami
18516359Sasami%RULES
18616359Sasami
18716359Sasami# DO NOT DELETE THIS LINE -- make depend uses it
188