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