Makefile.kern.inc revision 1.152.4.1 1 # $NetBSD: Makefile.kern.inc,v 1.152.4.1 2012/12/04 07:00:30 matt Exp $
2 #
3 # This file contains common `MI' targets and definitions and it is included
4 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
5 #
6 # Each target in this file should be protected with `if !target(target)'
7 # or `if !commands(target)' and each variable should only be conditionally
8 # assigned `VAR ?= VALUE', so that everything can be overriden.
9 #
10 # DEBUG is set to -g if debugging.
11 # PROF is set to -pg if profiling.
12 #
13 # To specify debugging, add the config line: makeoptions DEBUG="-g"
14 # A better way is to specify -g only for a few files.
15 #
16 # makeoptions DEBUGLIST="uvm* trap if_*"
17 #
18 # all ports are expected to include bsd.own.mk for toolchain settings
19
20 ##
21 ## (0) toolchain settings for things that aren't part of the standard
22 ## toolchain
23 ##
24 HOST_SH?= sh
25 DBSYM?= dbsym
26 MKDEP?= mkdep
27 STRIP?= strip
28 OBJCOPY?= objcopy
29 OBJDUMP?= objdump
30 CSCOPE?= cscope
31 MKID?= mkid
32 UUDECODE?= ${TOOL_UUDECODE:Uuudecode}
33 HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump}
34 GENASSYM?= ${TOOL_GENASSYM:Ugenassym}
35 .MAKEOVERRIDES+=USETOOLS # make sure proper value is propagated
36
37 _MKMSG?= @\#
38 _MKSHMSG?= echo
39 _MKSHECHO?= echo
40 _MKMSG_CREATE?= :
41 _MKTARGET_COMPILE?= :
42 _MKTARGET_CREATE?= :
43
44 ##
45 ## (1) port independent source tree identification
46 ##
47 # source tree is located via $S relative to the compilation directory
48 .ifndef S
49 S!= cd ../../../..; pwd
50 .endif
51
52 ##
53 ## (2) compile settings
54 ##
55 ## CPPFLAGS, CFLAGS, and AFLAGS must be set in the port's Makefile
56 ##
57 INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \
58 -I$S -nostdinc
59 CPPFLAGS+= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT
60 CPPFLAGS+= -std=gnu99
61 DEFCOPTS?= -O2
62 COPTS?= ${DEFCOPTS}
63 DBG= # might contain unwanted -Ofoo
64 DEFWARNINGS?= yes
65 .if (${DEFWARNINGS} == "yes")
66 CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith
67 CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes
68 CWARNFLAGS+= -Wold-style-definition
69 CWARNFLAGS+= -Wswitch -Wshadow
70 CWARNFLAGS+= -Wcast-qual -Wwrite-strings
71 CWARNFLAGS+= -Wno-unreachable-code
72 . if defined(HAVE_GCC) || defined(HAVE_PCC)
73 CWARNFLAGS+= -Wno-pointer-sign -Wno-attributes
74 . if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
75 ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
76 CWARNFLAGS+= -Wextra -Wno-unused-parameter
77 . endif
78 . if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
79 CWARNFLAGS+= -Wold-style-definition
80 . endif
81 . endif
82 # Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3,
83 # but our sources aren't up for it yet.
84 CWARNFLAGS+= -Wno-sign-compare
85 .endif
86
87 CWARNFLAGS.clang+= -Wno-unknown-pragmas -Wno-conversion \
88 -Wno-self-assign
89
90 CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \
91 -Wno-shift-count-negative -Wno-shift-count-overflow:}
92
93 CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss
94 CFLAGS+= ${DEBUG} ${COPTS}
95 AFLAGS+= -D_LOCORE -Wa,--fatal-warnings
96
97 # XXX
98 .if defined(HAVE_GCC)
99 CFLAGS+= -fno-strict-aliasing
100 .endif
101
102 .if ${USE_SSP:Uno} == "yes"
103 COPTS.kern_ssp.c+= -fno-stack-protector -D__SSP__
104 .endif
105
106 # for multi-cpu machines, cpu_hatch() straddles the init of
107 # __stack_chk_guard, so ensure stack protection is disabled
108 .if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
109 COPTS.cpu.c+= -fno-stack-protector
110 .endif
111
112 # If we want the bpendtsleep: label in kern_synch.c, we need to use
113 # -fno-reorder-blocks. Don't make this a config(1) defflag without
114 # making sure this fragment remains valid.
115 .if defined(HAVE_GCC) && !empty(${CFLAGS:M-DKERN_SYNCH_BPENDTSLEEP_LABEL})
116 COPTS.kern_synch.c+= -fno-reorder-blocks
117 .endif
118
119 # Use the per-source COPTS variables to add -g to just those
120 # files that match the shell patterns given in ${DEBUGLIST}
121 #
122 .for i in ${DEBUGLIST}
123 . for j in ${CFILES:T:M$i.c}
124 COPTS.${j}+=-g
125 . endfor
126 .endfor
127
128 # Always compile debugsyms.c with debug information.
129 # This allows gdb to use type informations.
130 #
131 COPTS.debugsyms.c+= -g
132
133 # Add CTF sections for DTrace
134 .if defined(CTFCONVERT)
135 COMPILE_CTFCONVERT= ${_MKSHECHO}\
136 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
137 ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
138 .else
139 COMPILE_CTFCONVERT= ${_MKSHECHO}
140 .endif
141
142 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
143 # NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
144 NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
145 ${_MKSHECHO}\
146 ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< && \
147 ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< && \
148 ${COMPILE_CTFCONVERT}
149 NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
150 ${_MKSHECHO}\
151 ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< && \
152 ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< && \
153 ${COMPILE_CTFCONVERT}
154 NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
155 ${_MKSHECHO}\
156 ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< && \
157 ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $<
158
159 ##
160 ## (3) libkern and compat
161 ##
162 ## Set KERN_AS in the port Makefile to "obj" or "library". The
163 ## default is "library", as documented in $S/lib/libkern/Makefile.inc.
164 ##
165
166 ### find out what to use for libkern
167 .include "$S/lib/libkern/Makefile.inc"
168 .ifndef PROF
169 LIBKERN?= ${KERNLIB}
170 .else
171 LIBKERN?= ${KERNLIB_PROF}
172 .endif
173
174 LIBKERNLN?= ${KERNLIBLN}
175
176 ### find out what to use for libcompat
177 .include "$S/compat/common/Makefile.inc"
178 .ifndef PROF
179 SYSLIBCOMPAT?= ${COMPATLIB}
180 .else
181 SYSLIBCOMPAT?= ${COMPATLIB_PROF}
182 .endif
183
184 SYSLIBCOMPATLN?= ${COMPATLIBLN}
185
186 ##
187 ## (4) local objects, compile rules, and dependencies
188 ##
189 ## Each port should have a corresponding section with settings for
190 ## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
191 ##
192 MI_CFILES=devsw.c ioconf.c param.c
193 # the need for a MI_SFILES variable is dubitable at best
194 MI_OBJS=${MI_CFILES:S/.c/.o/}
195
196 param.c: $S/conf/param.c
197 ${_MKTARGET_CREATE}
198 rm -f param.c
199 cp $S/conf/param.c .
200
201 param.o: Makefile
202
203 .for _cfile in ${MI_CFILES}
204 ${_cfile:T:R}.o: ${_cfile}
205 ${NORMAL_C}
206 .endfor
207
208 ##
209 ## (5) link settings
210 ##
211 ## TEXTADDR (or LOADADDRESS), LINKFORMAT, and any EXTRA_LINKFLAGS must
212 ## be set in the port's Makefile. The port specific definitions for
213 ## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
214 ## depending on the value of DEBUG.
215 ##
216 # load lines for config "xxx" will be emitted as:
217 # xxx: ${SYSTEM_DEP} swapxxx.o
218 # ${SYSTEM_LD_HEAD}
219 # ${SYSTEM_LD} swapxxx.o
220 # ${SYSTEM_LD_TAIL}
221 SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS:O} ${SYSLIBCOMPAT} ${LIBKERN}
222 SYSTEM_DEP?= Makefile ${SYSTEM_OBJ:O} .gdbinit
223 .if defined(KERNLDSCRIPT)
224 SYSTEM_DEP+= ${KERNLDSCRIPT}
225 .endif
226 .if defined(CTFMERGE)
227 SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
228 .else
229 SYSTEM_CTFMERGE= ${_MKSHECHO}
230 .endif
231 SYSTEM_LD_HEAD?=@rm -f $@
232 SYSTEM_LD?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \
233 ${_MKSHECHO}\
234 ${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \
235 ${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
236 SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \
237 ${SIZE} $@; chmod 755 $@; \
238 ${SYSTEM_CTFMERGE}
239 SYSTEM_LD_TAIL_DBSYM?= true
240
241 TEXTADDR?= ${LOADADDRESS} # backwards compatibility
242 LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/}
243 LINKDATA?= ${DATAADDR:C/.+/-Tdata &/}
244 ENTRYPOINT?= start
245 LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/}
246 LINKFLAGS?= ${LINKFORMAT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
247 ${EXTRA_LINKFLAGS}
248
249 LINKFLAGS_DEBUG?= -X
250 SYSTEM_LD_TAIL_DEBUG?=; \
251 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
252 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
253 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
254 LINKFLAGS_NORMAL?= -S
255 STRIPFLAGS?= -g
256
257 DEBUG?=
258 .if !empty(DEBUG:M-g*)
259 SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
260 LINKFLAGS+= ${LINKFLAGS_DEBUG}
261 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
262 CTFFLAGS+= -g
263 SYSTEM_LD_TAIL+=; \
264 if grep '^\#define.*SYMTAB_SPACE' opt_ksyms.h > /dev/null; then \
265 echo "${DBSYM} $@.gdb"; \
266 ${DBSYM} $@.gdb || (rm -f $@ ; exit 1) || exit 1; \
267 fi
268
269 .elifndef PROF
270 LINKFLAGS+= ${LINKFLAGS_NORMAL}
271 .endif
272
273 SYSTEM_LD_TAIL+=; \
274 if grep '^\#define.*SYMTAB_SPACE' opt_ksyms.h > /dev/null; then \
275 echo "${DBSYM} $@"; \
276 ${DBSYM} $@ || (rm -f $@ ; exit 1) || exit 1; \
277 fi
278
279 SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA}
280 SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_EXTRA}
281
282 ##
283 ## (6) port independent targets and dependencies: assym.h, vers.o
284 ##
285 .if !target(assym.h)
286 assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
287 ${_MKTARGET_CREATE}
288 cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
289 ${GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
290 > assym.h.tmp && \
291 mv -f assym.h.tmp assym.h
292 ${MD_SFILES:C/\.[Ss]/.o/} ${SFILES:C/\.[Ss]/.o/}: assym.h
293 .endif
294
295 MKREPRO?=no
296
297 .if ${MKREPRO} == "yes"
298 _NVFLAGS=${NVFLAGS} -r
299 .else
300 _NVFLAGS=${NVFLAGS}
301 .endif
302
303 .if !target(vers.o)
304 newvers: vers.o
305 vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} $S/conf/newvers.sh $S/conf/osrelease.sh
306 ${_MKMSG_CREATE} vers.c
307 ${HOST_SH} $S/conf/newvers.sh ${_NVFLAGS}
308 ${_MKTARGET_COMPILE}
309 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
310 .endif
311
312 .if defined(MEMORY_DISK_IMAGE)
313 md_root_image.h: ${MEMORY_DISK_IMAGE}
314 ${_MKTARGET_CREATE}
315 ${TOOL_HEXDUMP} -v -e '"\t" 8/1 "0x%02x, " "\n"' ${.ALLSRC} > ${.TARGET}
316
317 # XXX This is only needed when building md_root.o
318 CPPFLAGS+= -DMEMORY_DISK_IMAGE
319 md_root.o: md_root_image.h
320 .endif
321
322 # depend on MEMORY_DISK_IMAGE configuration
323 md_root.o: Makefile
324
325 # depend on root or device configuration
326 autoconf.o conf.o: Makefile
327
328 # depend on network or filesystem configuration
329 uipc_proto.o vfs_conf.o: Makefile
330
331 # depend on maxusers and CPU configuration
332 assym.h machdep.o: Makefile
333
334 ##
335 ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
336 ## cscope, mkid
337 ##
338 ## Any ports that have other stuff to be cleaned up should fill in
339 ## EXTRA_CLEAN. Some ports may want different settings for
340 ## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
341 ##
342 .if !target(__CLEANKERNEL)
343 __CLEANKERNEL: .USE
344 ${_MKMSG} "${.TARGET}ing the kernel objects"
345 rm -f ${KERNELS} eddep tags *.[io] *.ln [a-z]*.s vers.c \
346 [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
347 ${EXTRA_KERNELS} ${EXTRA_CLEAN}
348 .endif
349
350 .if !target(kernelnames)
351 kernelnames:
352 @echo "${KERNELS} ${EXTRA_KERNELS}"
353 .endif
354
355 .if !target(__CLEANDEPEND)
356 __CLEANDEPEND: .USE
357 echo .depend ${DEPS} | xargs rm -f --
358 .endif
359
360 # do not !target these, the kern and compat Makefiles augment them
361 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
362 clean: __CLEANKERNEL
363 depend: .depend
364 dependall: depend .WAIT all
365
366 .if !target(.depend)
367 MKDEP_AFLAGS?= ${AFLAGS}
368 MKDEP_CFLAGS?= ${CFLAGS}
369 SSRCS=${MD_SFILES} ${SFILES}
370 CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES}
371 SRCS=${SSRCS} ${CSRCS}
372 DEPS= ${SRCS:T:O:u:R:S/$/.d/g}
373
374 .for _s in ${SSRCS}
375 .if !target(${_s:T:R}.d)
376 ${_s:T:R}.d: ${_s} assym.h
377 ${_MKTARGET_CREATE}
378 ${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
379 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
380 .endif
381 .endfor
382 .for _s in ${CSRCS}
383 .if !target(${_s:T:R}.d)
384 ${_s:T:R}.d: ${_s}
385 ${_MKTARGET_CREATE}
386 ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
387 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
388 .endif
389 .endfor
390
391 assym.d: assym.h
392 ${_MKTARGET_CREATE}
393 cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
394 ${GENASSYM} -- ${MKDEP} -f assym.dep -- \
395 ${CFLAGS} ${CPPFLAGS}
396 ${TOOL_SED} -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >${.TARGET}
397 rm -f assym.dep
398
399 DEPS+= assym.d
400
401 .depend: ${DEPS}
402 ${_MKTARGET_CREATE}
403 echo "${.ALLSRC}" | ${MKDEP} -D
404 .endif
405
406 .if !target(lint)
407 ALLSFILES?= ${MD_SFILES} ${SFILES}
408 LINTSTUBS?= ${ALLSFILES:T:R:C/^.*$/LintStub_&.c/g}
409 KERNLINTFLAGS?= -bcehnxzFS
410 NORMAL_LN?= ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i $<
411
412 _lsrc=${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
413 LOBJS?= ${_lsrc:T:S/.c$/.ln/g} ${LIBKERNLN} ${SYSLIBCOMPATLN}
414
415 .for _sfile in ${ALLSFILES}
416 LintStub_${_sfile:T:R}.c: ${_sfile} assym.h
417 ${_MKTARGET_COMPILE}
418 ${CC} -E -C ${AFLAGS} ${CPPFLAGS} ${_sfile} | \
419 ${TOOL_AWK} -f $S/kern/genlintstub.awk >${.TARGET}
420 .endfor
421
422 .for _cfile in ${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
423 ${_cfile:T:R}.ln: ${_cfile}
424 ${_MKTARGET_COMPILE}
425 ${NORMAL_LN}
426 .endfor
427
428 lint: ${LOBJS}
429 ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${LOBJS}
430 .endif
431
432 # Attempt to do a syntax-only compile of the entire kernel as one entity.
433 # Alas, bugs in the GCC C frontend prevent this from completely effective
434 # but information can be gleaned from the output.
435 syntax-only: ${CFILES} ${MD_CFILES}
436 ${CC} -fsyntax-only -combine ${CFLAGS} ${CPPFLAGS} \
437 ${CFILES} ${MD_CFILES}
438
439 # List of kernel images that will be installed into the root file system.
440 # Some platforms may need to install more than one (e.g. a netbsd.aout file
441 # to be loaded directly by the firmware), so this can be overriden by them.
442 KERNIMAGES?= netbsd
443
444 .if !target(install)
445 # The install target can be redefined by putting a
446 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
447 MACHINE_NAME!= uname -n
448 install: install-kernel-${MACHINE_NAME}
449 .if !target(install-kernel-${MACHINE_NAME})
450 install-kernel-${MACHINE_NAME}:
451 .for _K in ${KERNIMAGES}
452 rm -f ${DESTDIR}/o${_K}
453 ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
454 cp ${_K} ${DESTDIR}/n${_K}
455 mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
456 .endfor
457 .endif
458 .endif
459
460 .if !target(tags)
461 tags:
462 @echo "see $S/kern/Makefile for tags"
463 .endif
464
465 EXTRA_CLEAN+= cscope.out cscope.tmp
466 .if !target(cscope.out)
467 cscope.out: Makefile depend
468 ${_MKTARGET_CREATE}
469 @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/kern/.depend \
470 | tr -s ' ' '\n' \
471 | ${TOOL_SED} ';s|^../../||;' \
472 > cscope.tmp
473 @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/compat/.depend \
474 | tr -s ' ' '\n' \
475 | ${TOOL_SED} 's|^../../||;' \
476 >> cscope.tmp
477 @echo ${SRCS} | cat - cscope.tmp | tr -s ' ' '\n' | sort -u | \
478 ${CSCOPE} -k -i - -b `echo ${INCLUDES} | ${TOOL_SED} s/-nostdinc//`
479 # cscope doesn't write cscope.out if it's uptodate, so ensure
480 # make doesn't keep calling cscope when not needed.
481 @rm -f cscope.tmp; touch cscope.out
482 .endif
483
484 .if !target(cscope)
485 cscope: cscope.out
486 @${CSCOPE} -d
487 .endif
488
489 EXTRA_CLEAN+= ID
490 .if !target(mkid)
491 .PHONY: mkid
492 mkid: ID
493
494 ID: Makefile depend
495 ${_MKTARGET_CREATE}
496 @${MKID} \
497 `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \
498 lib/kern/.depend lib/compat/.depend \
499 | tr ' ' '\n' \
500 | ${TOOL_SED} "s|^../../||" \
501 | sort -u` \
502 `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \
503 .depend \
504 | tr ' ' '\n' \
505 | sort -u`
506
507 .endif
508
509 .include "${S}/gdbscripts/Makefile.inc"
510
511 EXTRA_CLEAN+= .gdbinit
512 .gdbinit: Makefile ${S}/gdbscripts/Makefile.inc
513 ${_MKTARGET_CREATE}
514 rm -f .gdbinit
515 .for __gdbinit in ${SYS_GDBINIT}
516 echo "source ${S}/gdbscripts/${__gdbinit}" >> .gdbinit
517 .endfor
518 .if defined(GDBINIT) && !empty(GDBINIT)
519 .for __gdbinit in ${GDBINIT}
520 echo "source ${__gdbinit}" >> .gdbinit
521 .endfor
522 .endif
523
524 # The following files use alloca(3) or variable array allocations.
525 # Their full name is noted as documentation.
526 VARSTACK=kern/uipc_socket.c miscfs/genfs/genfs_vnops.c \
527 nfs/nfs_bio.c uvm/uvm_bio.c \
528 uvm/uvm_pager.c dev/ic/aic7xxx.c dev/ic/aic79xx.c arch/xen/i386/gdt.c \
529 dev/ofw/ofw_subr.c
530
531 .if defined(HAVE_GCC) || defined(HAVE_PCC)
532 .for __varstack in ${VARSTACK}
533 COPTS.${__varstack:T} += -Wno-stack-protector
534 .endfor
535 .endif
536
537 AFLAGS+= ${AOPTS.${.IMPSRC:T}}
538 CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
539 CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
540 CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}
541
542 .include <bsd.files.mk>
543 .include <bsd.clang-analyze.mk>
544
545 ##
546 ## the end
547 ##
548