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