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