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