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