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