1 # Makefile.ia64 -- with config changes.
2 # Copyright 1990 W. Jolitz
3 # from: src/sys/conf/Makefile.alpha,v 1.76
8 # This makefile is constructed from a machine description:
10 # Most changes should be made in the machine description
11 # /sys/alpha/conf/``machineid''
12 # after which you should do
14 # Generic makefile changes should be made in
15 # /sys/alpha/conf/Makefile.alpha
16 # after which config should be rerun for all machines.
19 # The Linux cross tools don't understand -fformat-extensions
20 CWARNFLAGS= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \
21 -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual \
23 CC= ia64-unknown-linux-gcc -D__FreeBSD__ -U__linux__
24 LD= ia64-unknown-linux-ld
25 SIZE= ia64-unknown-linux-size
26 OBJCOPY= ia64-unknown-linux-objcopy
29 # Which version of config(8) is required.
32 # Can be overridden by makeoptions or /etc/make.conf
35 KODIR?= /boot/${KERNEL}
51 INCLUDES= -nostdinc -I- ${INCLMAGIC} -I. -I$S
52 # This hack is to allow kernel compiles to succeed on machines w/out srcdist
53 .if exists($S/../include)
54 INCLUDES+= -I$S/../include
56 INCLUDES+= -I/usr/include
58 COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h
59 CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
61 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
62 ASM_CFLAGS= -x assembler-with-cpp -Wa,-x -DLOCORE ${CFLAGS}
64 # Select the correct set of tools. Can't set OBJFORMAT here because it
65 # doesn't get exported into the environment, and if it were exported
66 # then it might break building of utilities.
72 CFLAGS+= -malign-functions=4
74 IDENT+= -DGPROF4 -DGUPROF
75 PROF+= -mprofiler-epilogue
79 # Put configuration-specific C flags last (except for ${PROF}) so that they
80 # can override the others.
81 CFLAGS+= ${CONF_CFLAGS}
83 NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
84 NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC}
85 NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC}
86 PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC}
88 NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
89 ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
91 GEN_CFILES= $S/$M/$M/genassym.c
92 # setdef0.c and setdef1.c are intentionally
93 # omitted from SYSTEM_CFILES. They include setdefs.h, a header which
94 # is generated from all of ${OBJS}. We don't want to have to compile
95 # everything just to do a make depend.
96 SYSTEM_CFILES= param.c vnode_if.c hints.c config.c
97 SYSTEM_SFILES= $S/$M/$M/locore.s
98 SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
99 SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} param.o hints.o config.o \
100 setdef1.o # hack.So ski can't cope with dynamic relocs
101 SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
103 -export-dynamic -dynamic-linker /red/herring \
104 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
105 SYSTEM_LD_TAIL= @${OBJCOPY} --strip-symbol gcc2_compiled. ${.TARGET} ; \
106 ${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET}
107 SYSTEM_DEP+= $S/conf/ldscript.$M
124 depend: kernel-depend
126 cleandepend: kernel-cleandepend
128 install install.debug: kernel-install
129 reinstall reinstall.debug: kernel-reinstall
132 FULLKERNEL= ${KERNEL_KO}
134 FULLKERNEL= ${KERNEL_KO}.debug
135 ${KERNEL_KO}: ${FULLKERNEL}
136 ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO}
139 ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
141 @echo linking ${.TARGET}
146 ${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/}
149 .for mfile in ${MFILES}
150 ${mfile:T:S/.m$/.h/}: ${mfile}
151 perl5 $S/kern/makeobjops.pl -h ${mfile}
155 rm -f *.o *.so *.So *.ko *.s eddep errs \
156 ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks param.c \
157 setdef[01].c setdefs.h tags \
158 vers.c vnode_if.c vnode_if.h \
159 ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
163 # @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \
164 # $S/$M/$M/Locore.c ${CFILES} param.c | \
165 # grep -v 'struct/union .* never defined' | \
166 # grep -v 'possible pointer alignment problem'
168 locore.o: $S/$M/$M/locore.s assym.s
171 # This is a hack. BFD "optimizes" away dynamic mode if there are no
172 # dynamic references. We could probably do a '-Bforcedynamic' mode like
173 # in the a.out ld. For now, this works.
176 ${CC} ${FMT} -shared -nostdlib hack.c -o hack.So
179 .ORDER: setdefs.h setdef0.c setdef1.c
181 setdef0.o: setdef0.c setdefs.h
184 setdef1.o: setdef1.c setdefs.h
187 setdef0.c setdef1.c setdefs.h: Makefile ${OBJS}
188 @./gensetdefs ${OBJS}
190 # this rule stops ./assym.s in .depend from causing problems
193 assym.s: $S/$M/$M/genassym.sh genassym.o
194 sh $S/$M/$M/genassym.sh genassym.o > ${.TARGET}
196 genassym.o: $S/$M/$M/genassym.c
197 ${CC} -c ${CFLAGS} $S/$M/$M/genassym.c
199 ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
201 kernel-depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} \
202 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
203 ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/}
205 CC="${CC}" mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES}
206 env MKDEP_CPP="${CC} -E" \
207 mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES}
209 mv -f .newdep .depend
215 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
216 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
217 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
218 sort -u | comm -23 - dontlink | \
219 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
220 sh makelinks && rm -f dontlink
223 @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
224 sh $S/conf/systags.sh
226 sed -e 's, ../, ,' tags > tags1
228 kernel-install kernel-install.debug:
229 .if exists(${DESTDIR}/boot)
230 @if [ ! -f ${DESTDIR}/boot/device.hints ] ; then \
231 echo "You must set up a ${DESTDIR}/boot/device.hints file first." ; \
234 @if [ x"`grep device.hints ${DESTDIR}/boot/defaults/loader.conf ${DESTDIR}/boot/loader.conf`" = "x" ]; then \
235 echo "You must activate /boot/device.hints in loader.conf." ; \
239 @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \
240 echo "You must build a kernel first." ; \
243 .if exists(${DESTDIR}${KODIR})
244 .if exists(${DESTDIR}${KODIR}.old)
245 @-chflags -R noschg ${DESTDIR}${KODIR}.old
246 -rm -rf ${DESTDIR}${KODIR}.old
248 mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old
250 mkdir -p ${DESTDIR}${KODIR}
251 @if [ -f ${DESTDIR}${KODIR}/${KERNEL_KO} ] ; then \
252 chflags noschg ${DESTDIR}${KODIR}/${KERNEL_KO} ; \
254 install -c -m 555 -o root -g wheel -fschg \
255 ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}${KODIR}
257 kernel-reinstall kernel-reinstall.debug:
258 @if [ -f ${DESTDIR}${KODIR}/${KERNEL_KO} ] ; then \
259 chflags noschg ${DESTDIR}${KODIR}/${KERNEL_KO} ; \
261 install -c -m 555 -o root -g wheel -fschg \
262 ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}${KODIR}
264 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
266 depend: modules-depend
268 cleandepend: modules-cleandepend
270 install install.debug: modules-install
271 reinstall reinstall.debug: modules-reinstall
274 MKMODULESENV= MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
277 @mkdir -p ${.OBJDIR}/modules
278 cd $S/modules && env ${MKMODULESENV} ${MAKE} obj all
281 @mkdir -p ${.OBJDIR}/modules
282 cd $S/modules && env ${MKMODULESENV} ${MAKE} obj depend
285 cd $S/modules && env ${MKMODULESENV} ${MAKE} clean
288 cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandepend
291 cd $S/modules && env ${MKMODULESENV} ${MAKE} cleandir
294 cd $S/modules && env ${MKMODULESENV} ${MAKE} tags
296 modules-install modules-install.debug:
297 cd $S/modules && env ${MKMODULESENV} ${MAKE} install
299 modules-reinstall modules-reinstall.debug:
300 cd $S/modules && env ${MKMODULESENV} ${MAKE} install
305 param.c: $S/conf/param.c
312 vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
313 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
315 # XXX strictly, everything depends on Makefile because changes to ${PROF}
316 # only appear there, but we don't handle that.
323 vnode_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
326 vnode_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
332 .if exists($S/../share/mk)
333 .include "$S/../share/mk/bsd.kern.mk"
335 .include <bsd.kern.mk>
340 # DO NOT DELETE THIS LINE -- make depend uses it