Fully synchronize sys/boot from FreeBSD-5.x, but add / to the module path
[dragonfly.git] / sys / conf / Makefile.alpha
CommitLineData
984263bc
MD
1# Makefile.alpha -- with config changes.
2# Copyright 1990 W. Jolitz
3# from: @(#)Makefile.alpha 7.1 5/10/91
4# $FreeBSD: src/sys/conf/Makefile.alpha,v 1.47.2.15 2002/11/18 11:26:49 ru Exp $
dc62b251 5# $DragonFly: src/sys/conf/Attic/Makefile.alpha,v 1.3 2003/11/10 06:12:03 dillon Exp $
984263bc
MD
6#
7# Makefile for FreeBSD
8#
9# This makefile is constructed from a machine description:
10# config machineid
11# Most changes should be made in the machine description
12# /sys/alpha/conf/``machineid''
13# after which you should do
14# config machineid
15# Generic makefile changes should be made in
16# /sys/conf/Makefile.alpha
17# after which config should be rerun for all machines.
18#
19
20# Which version of config(8) is required.
21%VERSREQ= 400019
22
23# Can be overridden by makeoptions or /etc/make.conf
24KERNEL?= kernel
25STD8X16FONT?= iso
26
27.if !defined(S)
28.if exists(./@/.)
29S= ./@
30.else
31S= ../..
32.endif
33.endif
34M= ${MACHINE_ARCH}
35
36SIZE?= size
37OBJCOPY?= objcopy
38
39COPTFLAGS?=-O -pipe
40.if !defined(NO_CPU_COPTFLAGS)
41COPTFLAGS+= ${_CPUCFLAGS}
42.endif
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
50
51# This hack lets us use the ipfilter code without spamming a new
52# include path into 100+ source files.
53INCLUDES+= -I$S/contrib/ipfilter
54
55COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h
56CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
57
58# XXX LOCORE means "don't declare C stuff" not "for locore.s".
59ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS}
60
61DEFINED_PROF= ${PROF}
62.if defined(PROF)
63CFLAGS+= -malign-functions=4
64.if ${PROFLEVEL} >= 2
65IDENT+= -DGPROF4 -DGUPROF
66PROF+= -mprofiler-epilogue
67.endif
68.endif
69
70# Put configuration-specific C flags last (except for ${PROF}) so that they
71# can override the others.
72CFLAGS+= ${CONF_CFLAGS}
73
74NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
75NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
76NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC}
77PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC}
78
79GEN_CFILES= $S/$M/$M/genassym.c
984263bc
MD
80SYSTEM_CFILES= ioconf.c vnode_if.c config.c
81SYSTEM_SFILES= $S/$M/$M/locore.s
82SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
dc62b251 83SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o config.o hack.So
984263bc
MD
84SYSTEM_LD= @${LD} -Bdynamic -T $S/conf/ldscript.$M \
85 -e locorestart \
86 -export-dynamic -dynamic-linker /red/herring \
87 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
88SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
89 ${SIZE} ${.TARGET} ; chmod 755 ${.TARGET}
90SYSTEM_DEP+= $S/conf/ldscript.$M
91
92%BEFORE_DEPEND
93
94%OBJS
95
96%CFILES
97
98%SFILES
99
100%MFILES
101
102%CLEAN
103
104.PHONY: all modules
105all: ${KERNEL}
106
107depend: kernel-depend
108clean: kernel-clean
109cleandepend: kernel-cleandepend
110tags: kernel-tags
111install install.debug: kernel-install
112reinstall reinstall.debug: kernel-reinstall
113
114.if !defined(DEBUG)
115FULLKERNEL= ${KERNEL}
116.else
117FULLKERNEL= ${KERNEL}.debug
118${KERNEL}: ${FULLKERNEL}
119 ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL}
120.endif
121
122${FULLKERNEL}: ${SYSTEM_DEP} vers.o
123 @rm -f ${.TARGET}
124 @echo linking ${.TARGET}
125 ${SYSTEM_LD}
126 ${SYSTEM_LD_TAIL}
127
128.if !exists(.depend)
129${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h}
130.endif
131
132kernel-clean:
133 rm -f *.o *.so *.So *.ko *.s eddep errs \
134 ${FULLKERNEL} ${KERNEL} linterrs makelinks \
135 setdef[01].c setdefs.h tags \
136 vers.c vnode_if.c vnode_if.h ${CLEAN}
137
138#lint: /tmp
139# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \
140# $S/$M/$M/Locore.c ${CFILES} ioconf.c | \
141# grep -v 'struct/union .* never defined' | \
142# grep -v 'possible pointer alignment problem'
143
144locore.o: $S/$M/$M/locore.s assym.s
145 ${NORMAL_S}
146
147# This is a hack. BFD "optimizes" away dynamic mode if there are no
148# dynamic references. We could probably do a '-Bforcedynamic' mode like
149# in the a.out ld. For now, this works.
150hack.So: Makefile
151 touch hack.c
152 ${CC} -shared -nostdlib hack.c -o hack.So
153 rm -f hack.c
154
984263bc
MD
155# this rule stops ./assym.s in .depend from causing problems
156./assym.s: assym.s
157
158assym.s: $S/kern/genassym.sh genassym.o
159 sh $S/kern/genassym.sh genassym.o > ${.TARGET}
160
161genassym.o: $S/$M/$M/genassym.c
162 ${CC} -c ${CFLAGS} $S/$M/$M/genassym.c
163
164SYSTEM_OBJS+= __divqu.o __divq.o __divlu.o __divl.o
165SYSTEM_OBJS+= __remqu.o __remq.o __remlu.o __reml.o
166CLEAN+= __divqu.S __divq.S __divlu.S __divl.S
167CLEAN+= __remqu.S __remq.S __remlu.S __reml.S
168
169__divqu.S: $S/$M/$M/divrem.m4
170 @echo 'building ${.TARGET} from ${.ALLSRC}'
171 @(echo "define(NAME,\`__divqu')define(OP,\`div')define(S,\`false')"; \
172 echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
173
174__divq.S: $S/$M/$M/divrem.m4
175 @echo 'building ${.TARGET} from ${.ALLSRC}'
176 @(echo "define(NAME,\`__divq')define(OP,\`div')define(S,\`true')"; \
177 echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
178
179__divlu.S: $S/$M/$M/divrem.m4
180 @echo 'building ${.TARGET} from ${.ALLSRC}'
181 @(echo "define(NAME,\`__divlu')define(OP,\`div')define(S,\`false')"; \
182 echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
183
184__divl.S: $S/$M/$M/divrem.m4
185 @echo 'building ${.TARGET} from ${.ALLSRC}'
186 @(echo "define(NAME,\`__divl')define(OP,\`div')define(S,\`true')"; \
187 echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
188
189__remqu.S: $S/$M/$M/divrem.m4
190 @echo 'building ${.TARGET} from ${.ALLSRC}'
191 @(echo "define(NAME,\`__remqu')define(OP,\`rem')define(S,\`false')"; \
192 echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
193
194__remq.S: $S/$M/$M/divrem.m4
195 @echo 'building ${.TARGET} from ${.ALLSRC}'
196 @(echo "define(NAME,\`__remq')define(OP,\`rem')define(S,\`true')"; \
197 echo "define(WORDSIZE,64)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
198
199__remlu.S: $S/$M/$M/divrem.m4
200 @echo 'building ${.TARGET} from ${.ALLSRC}'
201 @(echo "define(NAME,\`__remlu')define(OP,\`rem')define(S,\`false')"; \
202 echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
203
204__reml.S: $S/$M/$M/divrem.m4
205 @echo 'building ${.TARGET} from ${.ALLSRC}'
206 @(echo "define(NAME,\`__reml')define(OP,\`rem')define(S,\`true')"; \
207 echo "define(WORDSIZE,32)"; cat ${.ALLSRC}) | m4 > ${.TARGET}
208
209${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
210
211kernel-depend: assym.s vnode_if.h ${BEFORE_DEPEND} \
212 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} ${SYSTEM_SFILES}
213 rm -f .newdep
214 mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES}
215 env MKDEP_CPP="${CC} -E" \
216 mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES}
217 rm -f .depend
218 mv -f .newdep .depend
219
220kernel-cleandepend:
221 rm -f .depend
222
223links:
224 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
225 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
226 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
227 sort -u | comm -23 - dontlink | \
228 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
229 sh makelinks && rm -f dontlink
230
231kernel-tags:
232 @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
233 sh $S/conf/systags.sh
234 rm -f tags1
235 sed -e 's, ../, ,' tags > tags1
236
237kernel-install kernel-install.debug:
238 @if [ ! -f ${KERNEL}${.TARGET:S/kernel-install//} ] ; then \
239 echo "You must build a kernel first." ; \
240 exit 1 ; \
241 fi
242.if exists(${DESTDIR}/${KERNEL})
243 -chflags noschg ${DESTDIR}/${KERNEL}
244 mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old
245.endif
246 ${INSTALL} -m 555 -o root -g wheel -fschg \
247 ${KERNEL}${.TARGET:S/kernel-install//} ${DESTDIR}/${KERNEL}
248
249kernel-reinstall kernel-reinstall.debug:
250 ${INSTALL} -m 555 -o root -g wheel -fschg \
251 ${KERNEL}${.TARGET:S/kernel-reinstall//} ${DESTDIR}/${KERNEL}
252
253.if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
254all: modules
255depend: modules-depend
256clean: modules-clean
257cleandepend: modules-cleandepend
258cleandir: modules-cleandir
259tags: modules-tags
260install install.debug: modules-install
261reinstall reinstall.debug: modules-reinstall
262.endif
263
264MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules
265.if defined(MODULES_OVERRIDE)
266MKMODULESENV+= MODULES_OVERRIDE="${MODULES_OVERRIDE}"
267.endif
268.if defined(DEBUG)
269MKMODULESENV+= DEBUG="${DEBUG}" DEBUG_FLAGS="${DEBUG}"
270.endif
271
272modules:
273 @mkdir -p ${.OBJDIR}/modules
274 cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \
275 env ${MKMODULESENV} ${MAKE} all
276
277modules-depend:
278 @mkdir -p ${.OBJDIR}/modules
279 cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \
280 env ${MKMODULESENV} ${MAKE} depend
281
282modules-clean:
283 cd $S/modules ; env ${MKMODULESENV} ${MAKE} clean
284
285modules-cleandepend:
286 cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandepend
287
288modules-clobber: modules-clean
289 rm -rf ${MKMODULESENV}
290
291modules-cleandir:
292 cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandir
293
294modules-tags:
295 cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags
296
297modules-install modules-install.debug:
298.if !defined(NO_MODULES_OLD)
299 if [ -d ${DESTDIR}/modules -a -n "`ls ${DESTDIR}/modules`" ]; then \
300 mkdir -p ${DESTDIR}/modules.old; \
301 cp -p ${DESTDIR}/modules/* ${DESTDIR}/modules.old; \
302 fi;
303.endif
304 cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
305
306modules-reinstall modules-reinstall.debug:
307 cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
308
309config.o:
310 ${NORMAL_C}
311
312ioconf.o:
313 ${NORMAL_C}
314
315vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
316 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
317
318# XXX strictly, everything depends on Makefile because changes to ${PROF}
319# only appear there, but we don't handle that.
320vers.o:
321 ${NORMAL_C}
322
323vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src
324 perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src
325
326vnode_if.h: $S/kern/vnode_if.pl $S/kern/vnode_if.src
327 perl5 $S/kern/vnode_if.pl -h $S/kern/vnode_if.src
328
329vnode_if.o:
330 ${NORMAL_C}
331
332.if exists($S/../share/mk)
333.include "$S/../share/mk/bsd.kern.mk"
334.else
335.include <bsd.kern.mk>
336.endif
337
338%RULES
339
340# DO NOT DELETE THIS LINE -- make depend uses it