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