Makefile.pc98 revision 19551
1# Makefile for FreeBSD(98) after:
2#
3# Makefile.i386 -- with config changes.
4# Copyright 1990 W. Jolitz
5#	from: @(#)Makefile.i386	7.1 5/10/91
6#	$Id: Makefile.pc98,v 1.7 1996/10/23 07:24:48 asami Exp $
7#
8# Makefile for FreeBSD
9#
10# This makefile is constructed from a machine description:
11#	config machineid
12# Most changes should be made in the machine description
13#	/sys/i386/conf/``machineid''
14# after which you should do
15#	 config machineid
16# Generic makefile changes should be made in
17#	/sys/i386/conf/Makefile.i386
18# after which config should be rerun for all machines.
19#
20CC?=	cc
21CPP?=	cpp
22LD?=	/usr/bin/ld
23
24.if exists(./@/.)
25S=	./@
26.else
27S=	../..
28.endif
29PC98=	${S}/pc98
30I386=	${S}/i386
31
32COPTFLAGS?=-O
33INCLUDES= -nostdinc -I- -I. -I$S
34# This hack is to allow kernel compiles to succeed on machines w/out srcdist
35.if exists($S/../include)
36INCLUDES+= -I$S/../include
37.else
38INCLUDES+= -I/usr/include
39.endif
40COPTS=	${INCLUDES} ${IDENT} -DKERNEL
41CFLAGS=	${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
42LOAD_ADDRESS?=	F0100000
43
44NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $<
45NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
46# XXX LOCORE means "don't declare C stuff" not "for locore.s".
47NORMAL_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
48DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
49DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
50DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $<
51PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $<
52
53SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c
54SYSTEM_SFILES= ${PC98}/i386/locore.s
55SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o
56SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS}
57SYSTEM_LD_HEAD= @echo loading $@; rm -f $@
58SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o
59.if ${CFLAGS:M-g} == ""
60SYMORDER_EXCLUDE=-x symbols.exclude
61.endif
62SYSTEM_LD_TAIL= @echo rearranging symbols; \
63	symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \
64	size $@; chmod 755 $@
65
66%BEFORE_DEPEND
67
68%OBJS
69
70%CFILES
71
72%SFILES
73
74%LOAD
75
76%CLEAN
77
78clean:
79	rm -f *.o *.s eddep errs genassym kernel linterrs \
80	      makelinks param.c symbols.exclude symbols.sort tags \
81	      vers.c vnode_if.c vnode_if.h ${CLEAN}
82
83#lint: /tmp param.c
84#	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \
85#	  ${PC98}/i386/Locore.c ${CFILES} ioconf.c param.c | \
86#	    grep -v 'struct/union .* never defined' | \
87#	    grep -v 'possible pointer alignment problem'
88
89symbols.exclude: Makefile
90	echo "gcc2_compiled." >symbols.exclude
91	echo "___gnu_compiled_c" >>symbols.exclude
92
93symbols.sort: ${I386}/i386/symbols.raw
94	grep -v '^#' ${I386}/i386/symbols.raw \
95	    | sed 's/^	//' | sort -u > symbols.sort
96
97locore.o: ${PC98}/i386/locore.s assym.s
98	${NORMAL_S}
99
100# everything potentially depends on the Makefile since everything potentially
101# depends on the options.  Some things are more dependent on the Makefile for
102# historical reasons.
103machdep.o: Makefile
104
105# the following is necessary because autoconf.o depends on #if GENERIC
106autoconf.o: Makefile
107
108# XXX - may no longer be needed
109locore.o: Makefile
110
111# depends on KDB (cons.o also depends on GENERIC)
112trap.o cons.o: Makefile
113
114# this rule stops ./assym.s in .depend from causing problems
115./assym.s: assym.s
116
117assym.s: genassym
118	./genassym >assym.s
119
120# Some of the defines that genassym outputs may well depend on the
121# value of kernel options.
122genassym.o: ${I386}/i386/genassym.c Makefile
123	rm -f ./machine ; ln -s ${I386}/include ./machine
124	${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
125
126genassym: genassym.o
127	${CC} ${CFLAGS} ${PARAM} genassym.o -o $@
128
129# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical.
130depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND}
131	rm -f .newdep
132	mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES}
133	mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c
134	MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \
135	mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES}
136	rm -f .depend
137	mv -f .newdep .depend
138
139links:
140	egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \
141	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
142	echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
143	  sort -u | comm -23 - dontlink | \
144	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
145	sh makelinks && rm -f dontlink
146
147tags:
148	@echo "see $S/kern/Makefile for tags"
149
150install:
151	@if [ ! -f kernel ] ; then \
152		echo "You must first build your kernel before trying to install." ; \
153		exit 1 ; \
154	fi
155	chflags noschg /kernel
156	mv /kernel /kernel.old
157	if [ `/usr/sbin/sysctl -n kern.bootfile` = /kernel ] ; then \
158		/usr/sbin/sysctl -w kern.bootfile=/kernel.old ; \
159		mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \
160	fi
161	install -c -m 555 -o root -g wheel -fschg kernel /
162
163ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \
164    ${I386}/isa/isa_device.h ${PC98}/pc98/pc98.h ${I386}/isa/icu.h
165	${CC} -c ${CFLAGS} ioconf.c
166
167param.c: $S/conf/param.c
168	-rm -f param.c
169	cp $S/conf/param.c .
170
171param.o: param.c Makefile
172	${CC} -c ${CFLAGS} ${PARAM} param.c
173
174vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
175	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
176	${CC} ${CFLAGS} -c vers.c
177
178vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
179	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
180vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
181	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
182
183.include <bsd.kern.mk>
184
185%RULES
186
187# DO NOT DELETE THIS LINE -- make depend uses it
188