Annotation of src/sys/conf/Makefile.kern.inc, Revision 1.213
1.213 ! uebayasi 1: # $NetBSD: Makefile.kern.inc,v 1.206 2015/08/29 15:37:18 uebayasi Exp $
1.1 atatat 2: #
3: # This file contains common `MI' targets and definitions and it is included
1.31 atatat 4: # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
1.1 atatat 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: #
1.59 perry 13: # To specify debugging, add the config line: makeoptions DEBUG="-g"
1.1 atatat 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:
1.168 martin 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:
1.1 atatat 25: ##
1.3 atatat 26: ## (0) toolchain settings for things that aren't part of the standard
27: ## toolchain
28: ##
1.45 lukem 29: HOST_SH?= sh
1.15 tv 30: DBSYM?= dbsym
1.3 atatat 31: MKDEP?= mkdep
32: STRIP?= strip
33: OBJCOPY?= objcopy
34: OBJDUMP?= objdump
1.16 wrstuden 35: CSCOPE?= cscope
36: MKID?= mkid
1.55 atatat 37: UUDECODE?= ${TOOL_UUDECODE:Uuudecode}
1.63 christos 38: HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump}
39: GENASSYM?= ${TOOL_GENASSYM:Ugenassym}
1.12 tv 40: .MAKEOVERRIDES+=USETOOLS # make sure proper value is propagated
1.46 lukem 41:
42: _MKMSG?= @\#
1.49 pk 43: _MKSHMSG?= echo
44: _MKSHECHO?= echo
1.156 martin 45: _MKSHNOECHO= :
1.46 lukem 46: _MKMSG_CREATE?= :
47: _MKTARGET_COMPILE?= :
48: _MKTARGET_CREATE?= :
1.3 atatat 49:
50: ##
1.1 atatat 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: ##
1.77 thorpej 63: INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \
1.164 mbalmer 64: -I$S -nostdinc
1.203 uebayasi 65: CPPFLAGS+= ${INCLUDES} ${IDENT} -D_KERNEL -D_KERNEL_OPT
1.128 matt 66: CPPFLAGS+= -std=gnu99
1.4 atatat 67: DEFCOPTS?= -O2
1.25 fvdl 68: COPTS?= ${DEFCOPTS}
1.7 atatat 69: DBG= # might contain unwanted -Ofoo
70: DEFWARNINGS?= yes
71: .if (${DEFWARNINGS} == "yes")
1.37 matt 72: CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith
1.7 atatat 73: CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes
1.152 matt 74: CWARNFLAGS+= -Wold-style-definition
1.68 martin 75: CWARNFLAGS+= -Wswitch -Wshadow
1.62 christos 76: CWARNFLAGS+= -Wcast-qual -Wwrite-strings
1.113 gmcgarry 77: CWARNFLAGS+= -Wno-unreachable-code
1.173 matt 78: #CWARNFLAGS+= -Wc++-compat -Wno-error=c++-compat
1.81 christos 79: CWARNFLAGS+= -Wno-pointer-sign -Wno-attributes
1.116 tron 80: . if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
81: ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
1.89 martin 82: CWARNFLAGS+= -Wextra -Wno-unused-parameter
1.87 christos 83: . endif
1.151 christos 84: . if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
85: CWARNFLAGS+= -Wold-style-definition
86: . endif
1.136 joerg 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
1.7 atatat 90: .endif
1.42 jdolecek 91:
1.137 joerg 92: CWARNFLAGS.clang+= -Wno-unknown-pragmas -Wno-conversion \
1.144 joerg 93: -Wno-self-assign
1.137 joerg 94:
1.150 joerg 95: CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \
96: -Wno-shift-count-negative -Wno-shift-count-overflow:}
97:
1.162 joerg 98: CWARNFLAGS.ioconf.c= ${${ACTIVE_CC} == "clang":? -Wno-unused-const-variable :}
99:
1.82 mrg 100: CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss
1.115 tron 101: CFLAGS+= ${DEBUG} ${COPTS}
1.134 joerg 102: AFLAGS+= -D_LOCORE -Wa,--fatal-warnings
1.53 matt 103:
1.78 mrg 104: # XXX
1.158 joerg 105: .if defined(HAVE_GCC) || defined(HAVE_LLVM)
1.78 mrg 106: CFLAGS+= -fno-strict-aliasing
1.157 matt 107: CFLAGS+= -fno-common
1.78 mrg 108: .endif
109:
1.103 tls 110: .if ${USE_SSP:Uno} == "yes"
1.121 christos 111: COPTS.kern_ssp.c+= -fno-stack-protector -D__SSP__
1.92 christos 112: .endif
113:
1.148 plunky 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:
1.45 lukem 120: # Use the per-source COPTS variables to add -g to just those
1.1 atatat 121: # files that match the shell patterns given in ${DEBUGLIST}
122: #
123: .for i in ${DEBUGLIST}
1.87 christos 124: . for j in ${CFILES:T:M$i.c}
1.45 lukem 125: COPTS.${j}+=-g
1.87 christos 126: . endfor
1.1 atatat 127: .endfor
128:
1.131 plunky 129: # Always compile debugsyms.c with debug information.
1.107 joerg 130: # This allows gdb to use type informations.
131: #
132: COPTS.debugsyms.c+= -g
133:
1.126 darran 134: # Add CTF sections for DTrace
135: .if defined(CTFCONVERT)
136: COMPILE_CTFCONVERT= ${_MKSHECHO}\
1.127 njoly 137: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
1.126 darran 138: ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
139: .else
1.156 martin 140: COMPILE_CTFCONVERT= ${_MKSHNOECHO}
1.126 darran 141: .endif
142:
1.1 atatat 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).
1.127 njoly 145: NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
1.45 lukem 146: ${_MKSHECHO}\
1.197 uebayasi 147: ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< -o $@ && \
148: ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< -o $@ && \
1.126 darran 149: ${COMPILE_CTFCONVERT}
1.127 njoly 150: NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
1.45 lukem 151: ${_MKSHECHO}\
1.197 uebayasi 152: ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ && \
153: ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ && \
1.126 darran 154: ${COMPILE_CTFCONVERT}
1.127 njoly 155: NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}" && \
1.45 lukem 156: ${_MKSHECHO}\
1.197 uebayasi 157: ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@ && \
158: ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@
1.175 uebayasi 159:
160: # link rules:
1.176 uebayasi 161: LINK_O?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}" && \
1.175 uebayasi 162: ${_MKSHECHO}\
1.180 uebayasi 163: ${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC} && \
164: ${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC}
1.1 atatat 165:
1.212 uebayasi 166: .for _s in ${CFILES}
167: .if !target(${_s:T:R}.o)
168: ${_s:T:R}.o: ${_s}
169: ${NORMAL_C}
170: .endif
171: .endfor
172:
173: .for _s in ${SFILES}
174: .if !target(${_s:T:R}.o)
175: ${_s:T:R}.o: ${_s}
176: ${NORMAL_S}
177: .endif
178: .endfor
179:
1.209 uebayasi 180: .SUFFIXES: .c .o
181: .c.o:
182: ${NORMAL_C}
183:
184: .SUFFIXES: .S .o
185: .S.o:
186: ${NORMAL_S}
187:
1.1 atatat 188: ##
1.59 perry 189: ## (3) libkern and compat
1.1 atatat 190: ##
191: ## Set KERN_AS in the port Makefile to "obj" or "library". The
192: ## default is "library", as documented in $S/lib/libkern/Makefile.inc.
193: ##
194:
195: ### find out what to use for libkern
196: .include "$S/lib/libkern/Makefile.inc"
197: .ifndef PROF
198: LIBKERN?= ${KERNLIB}
199: .else
200: LIBKERN?= ${KERNLIB_PROF}
201: .endif
202:
1.27 perry 203: LIBKERNLN?= ${KERNLIBLN}
204:
1.1 atatat 205: ### find out what to use for libcompat
206: .include "$S/compat/common/Makefile.inc"
207: .ifndef PROF
1.56 lukem 208: SYSLIBCOMPAT?= ${COMPATLIB}
1.1 atatat 209: .else
1.56 lukem 210: SYSLIBCOMPAT?= ${COMPATLIB_PROF}
1.1 atatat 211: .endif
212:
1.56 lukem 213: SYSLIBCOMPATLN?= ${COMPATLIBLN}
1.27 perry 214:
1.1 atatat 215: ##
216: ## (4) local objects, compile rules, and dependencies
217: ##
218: ## Each port should have a corresponding section with settings for
219: ## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
220: ##
1.209 uebayasi 221:
1.22 gehenna 222: MI_CFILES=devsw.c ioconf.c param.c
1.1 atatat 223: # the need for a MI_SFILES variable is dubitable at best
224: MI_OBJS=${MI_CFILES:S/.c/.o/}
225:
226: param.c: $S/conf/param.c
1.45 lukem 227: ${_MKTARGET_CREATE}
1.1 atatat 228: rm -f param.c
229: cp $S/conf/param.c .
230:
231: ##
232: ## (5) link settings
233: ##
1.181 uebayasi 234: ## TEXTADDR (or LOADADDRESS), LINKFORMAT, LINKSCRIPT, and any EXTRA_LINKFLAGS
235: ## must be set in the port's Makefile. The port specific definitions for
1.1 atatat 236: ## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
237: ## depending on the value of DEBUG.
238: ##
239: # load lines for config "xxx" will be emitted as:
1.170 joerg 240: # xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel
241:
1.182 uebayasi 242: .if !empty(OBJS:Mnetbsd.ko)
243: SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS} ${SYSLIBCOMPAT} ${LIBKERN}
244: .else
1.119 matt 245: SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS:O} ${SYSLIBCOMPAT} ${LIBKERN}
1.182 uebayasi 246: .endif
1.183 uebayasi 247: SYSTEM_DEP+= Makefile ${SYSTEM_OBJ} .gdbinit
1.126 darran 248: .if defined(CTFMERGE)
1.166 ozaki-r 249: SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
1.126 darran 250: .else
251: SYSTEM_CTFMERGE= ${_MKSHECHO}
252: .endif
1.45 lukem 253: SYSTEM_LD_HEAD?=@rm -f $@
1.194 uebayasi 254: SYSTEM_LD?= @do_system_ld() { \
255: target=$$1; shift; \
256: ${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \
1.45 lukem 257: ${_MKSHECHO}\
1.195 uebayasi 258: ${LD} -Map $${target}.map --cref ${LINKFLAGS} -o $${target} '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o $$@; \
259: ${LD} -Map $${target}.map --cref ${LINKFLAGS} -o $${target} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o $$@; \
1.194 uebayasi 260: }; \
261: do_system_ld
1.153 bsh 262:
1.185 uebayasi 263: # Give MD generated ldscript dependency on ${SYSTEM_OBJ}
264: .if defined(KERNLDSCRIPT)
265: .if target(${KERNLDSCRIPT})
266: ${KERNLDSCRIPT}: ${SYSTEM_OBJ}
267: .endif
268: .endif
269:
1.188 uebayasi 270: .if defined(KERNLDSCRIPT)
271: .for k in ${KERNELS}
272: EXTRA_CLEAN+= ${k}.ldscript
1.190 uebayasi 273: ${k}: ${k}.ldscript
1.191 uebayasi 274: ${k}.ldscript: ${KERNLDSCRIPT} assym.h
1.190 uebayasi 275: ${_MKTARGET_CREATE}
1.191 uebayasi 276: ${CPP} -I. ${KERNLDSCRIPT} | grep -v '^#' | grep -v '^$$' >$@
1.188 uebayasi 277: .endfor
278: LINKSCRIPT= -T ${.TARGET}.ldscript
279: .endif
280:
1.1 atatat 281: TEXTADDR?= ${LOADADDRESS} # backwards compatibility
1.5 atatat 282: LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/}
283: LINKDATA?= ${DATAADDR:C/.+/-Tdata &/}
1.1 atatat 284: ENTRYPOINT?= start
1.6 atatat 285: LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/}
1.181 uebayasi 286: LINKFLAGS?= ${LINKFORMAT} ${LINKSCRIPT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
1.1 atatat 287: ${EXTRA_LINKFLAGS}
288:
1.4 atatat 289: LINKFLAGS_DEBUG?= -X
1.161 skrll 290:
1.179 nakayama 291: SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c; \
1.161 skrll 292: ${SIZE} $@; chmod 755 $@; \
293: ${SYSTEM_CTFMERGE}
1.1 atatat 294: SYSTEM_LD_TAIL_DEBUG?=; \
295: echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
296: echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
297: ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1.4 atatat 298: LINKFLAGS_NORMAL?= -S
1.1 atatat 299: STRIPFLAGS?= -g
300:
301: DEBUG?=
1.60 dbj 302: .if !empty(DEBUG:M-g*)
1.1 atatat 303: SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
304: LINKFLAGS+= ${LINKFLAGS_DEBUG}
1.7 atatat 305: EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
1.126 darran 306: CTFFLAGS+= -g
1.174 matt 307: TARGETSFX= .gdb
1.9 chs 308: .elifndef PROF
1.1 atatat 309: LINKFLAGS+= ${LINKFLAGS_NORMAL}
310: .endif
311:
1.57 chs 312: SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA}
1.170 joerg 313: SYSTEM_LD_TAIL_STAGE1= ${SYSTEM_LD_TAIL}
314: SYSTEM_LD_TAIL_STAGE2= ${SYSTEM_LD_TAIL}
1.171 joerg 315: .if defined(COPY_SYMTAB)
1.170 joerg 316: SYSTEM_LD_TAIL_STAGE2+= ; echo ${DBSYM} $@; ${DBSYM} $@
1.174 matt 317: .if !empty(DEBUG:M-g)
318: SYSTEM_LD_TAIL_STAGE2+= ; echo ${DBSYM} $@.gdb; ${DBSYM} $@.gdb
319: .endif
1.161 skrll 320: .endif
1.170 joerg 321: SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL_EXTRA}
1.5 atatat 322:
1.1 atatat 323: ##
1.8 atatat 324: ## (6) port independent targets and dependencies: assym.h, vers.o
1.1 atatat 325: ##
1.199 uebayasi 326:
327: .SUFFIXES: .genassym .assym.h
328: .genassym.assym.h:
329: ${_MKTARGET_CREATE}
330: cat $< | \
331: ${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
332: ${GENASSYM_CPPFLAGS} > $@.tmp && \
333: mv -f $@.tmp $@
334:
1.193 uebayasi 335: assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} $S/conf/genassym.cf
1.45 lukem 336: ${_MKTARGET_CREATE}
1.193 uebayasi 337: cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} $S/conf/genassym.cf | \
1.155 joerg 338: ${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
1.165 joerg 339: ${GENASSYM_CPPFLAGS} > assym.h.tmp && \
1.1 atatat 340: mv -f assym.h.tmp assym.h
1.11 mrg 341: ${MD_SFILES:C/\.[Ss]/.o/} ${SFILES:C/\.[Ss]/.o/}: assym.h
1.1 atatat 342:
1.123 perry 343: MKREPRO?=no
344:
345: .if ${MKREPRO} == "yes"
1.145 jmcneill 346: _NVFLAGS=${NVFLAGS} -r
1.123 perry 347: .else
1.145 jmcneill 348: _NVFLAGS=${NVFLAGS}
1.123 perry 349: .endif
350:
1.8 atatat 351: .if !target(vers.o)
352: newvers: vers.o
1.187 uebayasi 353: vers.o: ${SYSTEM_OBJ} Makefile $S/conf/newvers.sh \
1.159 apb 354: $S/conf/osrelease.sh ${_NETBSD_VERSION_DEPENDS}
1.45 lukem 355: ${_MKMSG_CREATE} vers.c
1.123 perry 356: ${HOST_SH} $S/conf/newvers.sh ${_NVFLAGS}
1.45 lukem 357: ${_MKTARGET_COMPILE}
1.1 atatat 358: ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1.167 ozaki-r 359: ${COMPILE_CTFCONVERT}
1.29 atatat 360: .endif
361:
1.184 nat 362: # Option for embedding a splashscreen image.
363: .if defined(SPLASHSCREEN_IMAGE)
364: .include "${S}/dev/splash/splash.mk"
365: init_main.o: splash_image.o
366: .endif
367:
1.1 atatat 368: ##
1.16 wrstuden 369: ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
370: ## cscope, mkid
1.1 atatat 371: ##
372: ## Any ports that have other stuff to be cleaned up should fill in
373: ## EXTRA_CLEAN. Some ports may want different settings for
374: ## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
375: ##
1.200 uebayasi 376:
377: ##
378: ## clean
379: ##
380:
1.1 atatat 381: .if !target(__CLEANKERNEL)
382: __CLEANKERNEL: .USE
1.45 lukem 383: ${_MKMSG} "${.TARGET}ing the kernel objects"
1.177 uebayasi 384: rm -f ${KERNELS} *.map eddep tags *.[io] *.ko *.ln [a-z]*.s vers.c \
1.1 atatat 385: [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
1.7 atatat 386: ${EXTRA_KERNELS} ${EXTRA_CLEAN}
387: .endif
388:
389: .if !target(kernelnames)
390: kernelnames:
391: @echo "${KERNELS} ${EXTRA_KERNELS}"
1.1 atatat 392: .endif
393:
394: .if !target(__CLEANDEPEND)
395: __CLEANDEPEND: .USE
1.73 dsl 396: echo .depend ${DEPS} | xargs rm -f --
1.1 atatat 397: .endif
398:
399: # do not !target these, the kern and compat Makefiles augment them
400: cleandir distclean: __CLEANKERNEL __CLEANDEPEND
401: clean: __CLEANKERNEL
402: depend: .depend
1.90 thorpej 403: dependall: depend .WAIT all
1.1 atatat 404:
1.200 uebayasi 405: ##
406: ## depend
407: ##
408:
1.1 atatat 409: .if !target(.depend)
410: MKDEP_AFLAGS?= ${AFLAGS}
411: MKDEP_CFLAGS?= ${CFLAGS}
1.71 yamt 412: SSRCS=${MD_SFILES} ${SFILES}
413: CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES}
414: SRCS=${SSRCS} ${CSRCS}
1.183 uebayasi 415: DEPS= ${SRCS:T:u:R:S/$/.d/g}
1.71 yamt 416:
1.199 uebayasi 417: .SUFFIXES: .S .d
418: .S.d:
419: ${_MKTARGET_CREATE}
420: ${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
421: ${CPPFLAGS} ${CPPFLAGS.${_s:T}} $<
422:
1.71 yamt 423: .for _s in ${SSRCS}
1.147 jmcneill 424: .if !target(${_s:T:R}.d)
1.106 lukem 425: ${_s:T:R}.d: ${_s} assym.h
1.73 dsl 426: ${_MKTARGET_CREATE}
427: ${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
428: ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
1.147 jmcneill 429: .endif
1.71 yamt 430: .endfor
1.199 uebayasi 431:
432: .SUFFIXES: .c .d
433: .c.d:
434: ${_MKTARGET_CREATE}
435: ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
436: ${CPPFLAGS} ${CPPFLAGS.${_s:T}} $<
437:
1.71 yamt 438: .for _s in ${CSRCS}
1.147 jmcneill 439: .if !target(${_s:T:R}.d)
1.106 lukem 440: ${_s:T:R}.d: ${_s}
1.73 dsl 441: ${_MKTARGET_CREATE}
442: ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
443: ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
1.147 jmcneill 444: .endif
1.71 yamt 445: .endfor
446:
1.106 lukem 447: assym.d: assym.h
1.45 lukem 448: ${_MKTARGET_CREATE}
1.63 christos 449: cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
450: ${GENASSYM} -- ${MKDEP} -f assym.dep -- \
1.165 joerg 451: ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${GENASSYM_CPPFLAGS}
1.118 apb 452: ${TOOL_SED} -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >${.TARGET}
1.73 dsl 453: rm -f assym.dep
454:
1.109 matt 455: DEPS+= assym.d
456:
457: .depend: ${DEPS}
1.73 dsl 458: ${_MKTARGET_CREATE}
459: echo "${.ALLSRC}" | ${MKDEP} -D
1.1 atatat 460: .endif
461:
1.200 uebayasi 462: ##
1.210 uebayasi 463: ## install
1.200 uebayasi 464: ##
465:
1.100 jmmv 466: # List of kernel images that will be installed into the root file system.
467: # Some platforms may need to install more than one (e.g. a netbsd.aout file
468: # to be loaded directly by the firmware), so this can be overriden by them.
469: KERNIMAGES?= netbsd
470:
1.1 atatat 471: .if !target(install)
472: # The install target can be redefined by putting a
473: # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
474: MACHINE_NAME!= uname -n
475: install: install-kernel-${MACHINE_NAME}
1.28 chris 476: .if !target(install-kernel-${MACHINE_NAME})
1.1 atatat 477: install-kernel-${MACHINE_NAME}:
1.100 jmmv 478: .for _K in ${KERNIMAGES}
479: rm -f ${DESTDIR}/o${_K}
480: ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
481: cp ${_K} ${DESTDIR}/n${_K}
482: mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
483: .endfor
1.1 atatat 484: .endif
485: .endif
486:
1.213 ! uebayasi 487: .include "${S}/conf/mdroot.mk"
1.210 uebayasi 488: .include "${S}/conf/lint.mk"
489: .include "${S}/conf/cscope.mk"
490: .include "${S}/conf/gdbinit.mk"
1.1 atatat 491:
1.200 uebayasi 492: ##
493: ## the kernel
494: ##
495:
1.99 christos 496: # The following files use alloca(3) or variable array allocations.
1.92 christos 497: # Their full name is noted as documentation.
1.125 tron 498: VARSTACK=kern/uipc_socket.c miscfs/genfs/genfs_vnops.c \
1.102 pooka 499: nfs/nfs_bio.c uvm/uvm_bio.c \
1.104 jnemeth 500: uvm/uvm_pager.c dev/ic/aic7xxx.c dev/ic/aic79xx.c arch/xen/i386/gdt.c \
501: dev/ofw/ofw_subr.c
1.92 christos 502:
503: .for __varstack in ${VARSTACK}
504: COPTS.${__varstack:T} += -Wno-stack-protector
505: .endfor
506:
1.86 matt 507: AFLAGS+= ${AOPTS.${.IMPSRC:T}}
1.64 yamt 508: CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
509: CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
1.65 uwe 510: CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}
1.64 yamt 511:
1.170 joerg 512: .if !defined(COPY_SYMTAB)
513: build_kernel: .USE
514: ${SYSTEM_LD_HEAD}
1.194 uebayasi 515: ${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o
1.170 joerg 516: ${SYSTEM_LD_TAIL_STAGE2}
517: .else
1.196 uebayasi 518: .for k in ${KERNELS}
519: ${k}: $S/kern/kern_ksyms_buf.c
520: .endfor
1.170 joerg 521: build_kernel: .USE
522: ${CC} ${CFLAGS} ${CPPFLAGS} -DCOPY_SYMTAB \
523: -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o
524: ${SYSTEM_LD_HEAD}
1.194 uebayasi 525: ${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o kern_ksyms_buf.o
1.170 joerg 526: ${SYSTEM_LD_TAIL_STAGE1}
527: ${CC} ${CFLAGS} ${CPPFLAGS} -DCOPY_SYMTAB \
1.174 matt 528: -DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \
1.170 joerg 529: -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o
530: ${SYSTEM_LD_HEAD}
1.194 uebayasi 531: ${SYSTEM_LD} ${.TARGET} swap${.TARGET}.o kern_ksyms_buf_real.o
1.170 joerg 532: ${SYSTEM_LD_TAIL_STAGE2}
533: .endif
534:
1.105 lukem 535: .include <bsd.files.mk>
1.149 joerg 536: .include <bsd.clang-analyze.mk>
1.105 lukem 537:
1.1 atatat 538: ##
539: ## the end
540: ##
CVSweb <webmaster@jp.NetBSD.org>