]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/conf/Makefile.ia64
This commit was generated by cvs2svn to compensate for changes in r69587,
[FreeBSD/FreeBSD.git] / sys / conf / Makefile.ia64
1 # Makefile.ia64 -- with config changes.
2 # Copyright 1990 W. Jolitz
3 #       from: src/sys/conf/Makefile.alpha,v 1.76
4 # $FreeBSD$
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/alpha/conf/``machineid''
12 # after which you should do
13 #        config machineid
14 # Generic makefile changes should be made in
15 #       /sys/alpha/conf/Makefile.alpha
16 # after which config should be rerun for all machines.
17 #
18
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 \
22                 -ansi
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
27 MACHINE_ARCH=   ia64
28
29 # Which version of config(8) is required.
30 %VERSREQ=       500005
31
32 # Can be overridden by makeoptions or /etc/make.conf
33 KERNEL_KO?=     kernel
34 KERNEL?=        kernel
35 KODIR?=         /boot/${KERNEL}
36 STD8X16FONT?=   iso
37
38 .if !defined(S)
39 .if exists(./@/.)
40 S=      ./@
41 .else
42 S=      ../..
43 .endif
44 .endif
45 M=      ${MACHINE_ARCH}
46
47 SIZE?=          size
48 OBJCOPY?=       objcopy
49
50 COPTFLAGS?=-O
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
55 .else
56 INCLUDES+= -I/usr/include
57 .endif
58 COPTS=  ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h
59 CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS}
60
61 # XXX LOCORE means "don't declare C stuff" not "for locore.s".
62 ASM_CFLAGS= -x assembler-with-cpp -Wa,-x -DLOCORE ${CFLAGS}
63
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.
67 #FMT=           -elf
68 CFLAGS+=        ${FMT}
69
70 DEFINED_PROF=   ${PROF}
71 .if defined(PROF)
72 CFLAGS+=        -malign-functions=4
73 .if ${PROFLEVEL} >= 2
74 IDENT+= -DGPROF4 -DGUPROF
75 PROF+=  -mprofiler-epilogue
76 .endif
77 .endif
78
79 # Put configuration-specific C flags last (except for ${PROF}) so that they
80 # can override the others.
81 CFLAGS+=        ${CONF_CFLAGS}
82
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}
87
88 NORMAL_M= perl5 $S/kern/makeobjops.pl -c $<; \
89           ${CC} -c ${CFLAGS} ${PROF} ${.PREFIX}.c
90
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 \
102         -e locorestart \
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
108
109 %BEFORE_DEPEND
110
111 %OBJS
112
113 %FILES.c
114
115 %FILES.s
116
117 %FILES.m
118
119 %CLEAN
120
121 .PHONY: all modules
122 all: ${KERNEL_KO}
123
124 depend: kernel-depend
125 clean:  kernel-clean
126 cleandepend:  kernel-cleandepend
127 tags:  kernel-tags
128 install install.debug: kernel-install
129 reinstall reinstall.debug: kernel-reinstall
130
131 .if !defined(DEBUG)
132 FULLKERNEL=     ${KERNEL_KO}
133 .else
134 FULLKERNEL=     ${KERNEL_KO}.debug
135 ${KERNEL_KO}: ${FULLKERNEL}
136         ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO}
137 .endif
138
139 ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
140         @rm -f ${.TARGET}
141         @echo linking ${.TARGET}
142         ${SYSTEM_LD}
143         ${SYSTEM_LD_TAIL}
144
145 .if !exists(.depend)
146 ${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/}
147 .endif
148
149 .for mfile in ${MFILES}
150 ${mfile:T:S/.m$/.h/}: ${mfile}
151         perl5 $S/kern/makeobjops.pl -h ${mfile}
152 .endfor
153
154 kernel-clean:
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/} \
160               ${CLEAN}
161
162 #lint: /tmp param.c
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'
167
168 locore.o: $S/$M/$M/locore.s assym.s
169         ${NORMAL_S}
170
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.
174 hack.So: Makefile
175         touch hack.c
176         ${CC} ${FMT} -shared -nostdlib hack.c -o hack.So
177         rm -f hack.c
178
179 .ORDER: setdefs.h setdef0.c setdef1.c
180
181 setdef0.o: setdef0.c setdefs.h
182         ${NORMAL_C}
183
184 setdef1.o: setdef1.c setdefs.h
185         ${NORMAL_C}
186
187 setdef0.c setdef1.c setdefs.h: Makefile ${OBJS}
188         @./gensetdefs ${OBJS}
189
190 # this rule stops ./assym.s in .depend from causing problems
191 ./assym.s: assym.s
192
193 assym.s: $S/$M/$M/genassym.sh genassym.o
194         sh $S/$M/$M/genassym.sh genassym.o > ${.TARGET}
195
196 genassym.o: $S/$M/$M/genassym.c
197         ${CC} -c ${CFLAGS} $S/$M/$M/genassym.c
198
199 ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
200
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/}
204         rm -f .newdep
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}
208         rm -f .depend
209         mv -f .newdep .depend
210
211 kernel-cleandepend:
212         rm -f .depend
213
214 links:
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
221
222 kernel-tags:
223         @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
224         sh $S/conf/systags.sh
225         rm -f tags1
226         sed -e 's,      ../,    ,' tags > tags1
227
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." ; \
232                 exit 1 ; \
233         fi
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." ; \
236                 exit 1 ; \
237         fi
238 .endif
239         @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \
240                 echo "You must build a kernel first." ; \
241                 exit 1 ; \
242         fi
243 .if exists(${DESTDIR}${KODIR})
244 .if exists(${DESTDIR}${KODIR}.old)
245         @-chflags -R noschg ${DESTDIR}${KODIR}.old
246         -rm -rf ${DESTDIR}${KODIR}.old
247 .endif
248         mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old
249 .endif
250         mkdir -p ${DESTDIR}${KODIR}
251         @if [ -f ${DESTDIR}${KODIR}/${KERNEL_KO} ] ; then \
252             chflags noschg ${DESTDIR}${KODIR}/${KERNEL_KO} ; \
253         fi
254         install -c -m 555 -o root -g wheel -fschg \
255                 ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}${KODIR}
256
257 kernel-reinstall kernel-reinstall.debug:
258         @if [ -f ${DESTDIR}${KODIR}/${KERNEL_KO} ] ; then \
259             chflags noschg ${DESTDIR}${KODIR}/${KERNEL_KO} ; \
260         fi
261         install -c -m 555 -o root -g wheel -fschg \
262                 ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}${KODIR}
263
264 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
265 all:    modules
266 depend: modules-depend
267 clean:  modules-clean
268 cleandepend:  modules-cleandepend
269 tags:  modules-tags
270 install install.debug: modules-install
271 reinstall reinstall.debug: modules-reinstall
272 .endif
273
274 MKMODULESENV=   MAKEOBJDIRPREFIX=${.OBJDIR}/modules KMODDIR=${KODIR}
275
276 modules:
277         @mkdir -p ${.OBJDIR}/modules
278         cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \
279             env ${MKMODULESENV} ${MAKE} all
280
281 modules-depend:
282         @mkdir -p ${.OBJDIR}/modules
283         cd $S/modules ; env ${MKMODULESENV} ${MAKE} obj ; \
284             env ${MKMODULESENV} ${MAKE} depend
285
286 modules-clean:
287         cd $S/modules ; env ${MKMODULESENV} ${MAKE} clean
288
289 modules-cleandepend:
290         cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandepend
291
292 modules-cleandir:
293         cd $S/modules ; env ${MKMODULESENV} ${MAKE} cleandir
294
295 modules-tags:
296         cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags
297
298 modules-install modules-install.debug:
299         cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
300
301 modules-reinstall modules-reinstall.debug:
302         cd $S/modules ; env ${MKMODULESENV} ${MAKE} install
303
304 config.o:
305         ${NORMAL_C}
306
307 param.c: $S/conf/param.c
308         -rm -f param.c
309         cp $S/conf/param.c .
310
311 param.o:
312         ${NORMAL_C}
313
314 vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
315         sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
316
317 # XXX strictly, everything depends on Makefile because changes to ${PROF}
318 # only appear there, but we don't handle that.
319 vers.o:
320         ${NORMAL_C}
321
322 hints.o:        hints.c
323         ${NORMAL_C}
324
325 vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src
326         perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src
327
328 vnode_if.h: $S/kern/vnode_if.pl $S/kern/vnode_if.src
329         perl5 $S/kern/vnode_if.pl -h $S/kern/vnode_if.src
330
331 vnode_if.o:
332         ${NORMAL_C}
333
334 .if exists($S/../share/mk)
335 .include "$S/../share/mk/bsd.kern.mk"
336 .else
337 .include <bsd.kern.mk>
338 .endif
339
340 %RULES
341
342 # DO NOT DELETE THIS LINE -- make depend uses it