[BACK]Return to Makefile.kern.inc CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / conf

Annotation of src/sys/conf/Makefile.kern.inc, Revision 1.169.2.1

1.169.2.1! martin      1: #      $NetBSD: Makefile.kern.inc,v 1.169 2014/08/08 14:42:58 joerg 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.4       atatat     65: CPPFLAGS+=     ${INCLUDES} ${IDENT} ${PARAM} -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.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.151     christos   83: .  if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
                     84: CWARNFLAGS+=   -Wold-style-definition
                     85: .  endif
1.136     joerg      86: # Add -Wno-sign-compare.  -Wsign-compare is included in -Wall as of GCC 3.3,
                     87: # but our sources aren't up for it yet.
                     88: CWARNFLAGS+=   -Wno-sign-compare
1.7       atatat     89: .endif
1.42      jdolecek   90:
1.137     joerg      91: CWARNFLAGS.clang+=     -Wno-unknown-pragmas -Wno-conversion \
1.144     joerg      92:                        -Wno-self-assign
1.137     joerg      93:
1.150     joerg      94: CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \
                     95:     -Wno-shift-count-negative -Wno-shift-count-overflow:}
                     96:
1.162     joerg      97: CWARNFLAGS.ioconf.c= ${${ACTIVE_CC} == "clang":? -Wno-unused-const-variable :}
                     98:
1.82      mrg        99: CFLAGS+=       -ffreestanding -fno-zero-initialized-in-bss
1.115     tron      100: CFLAGS+=       ${DEBUG} ${COPTS}
1.134     joerg     101: AFLAGS+=       -D_LOCORE -Wa,--fatal-warnings
1.53      matt      102:
1.78      mrg       103: # XXX
1.158     joerg     104: .if defined(HAVE_GCC) || defined(HAVE_LLVM)
1.78      mrg       105: CFLAGS+=       -fno-strict-aliasing
1.157     matt      106: CFLAGS+=       -fno-common
1.78      mrg       107: .endif
                    108:
1.103     tls       109: .if ${USE_SSP:Uno} == "yes"
1.121     christos  110: COPTS.kern_ssp.c+=     -fno-stack-protector -D__SSP__
1.92      christos  111: .endif
                    112:
1.148     plunky    113: # for multi-cpu machines, cpu_hatch() straddles the init of
                    114: # __stack_chk_guard, so ensure stack protection is disabled
                    115: .if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
                    116: COPTS.cpu.c+=          -fno-stack-protector
                    117: .endif
                    118:
1.45      lukem     119: # Use the per-source COPTS variables to add -g to just those
1.1       atatat    120: # files that match the shell patterns given in ${DEBUGLIST}
                    121: #
                    122: .for i in ${DEBUGLIST}
1.87      christos  123: . for j in ${CFILES:T:M$i.c}
1.45      lukem     124: COPTS.${j}+=-g
1.87      christos  125: . endfor
1.1       atatat    126: .endfor
                    127:
1.131     plunky    128: # Always compile debugsyms.c with debug information.
1.107     joerg     129: # This allows gdb to use type informations.
                    130: #
                    131: COPTS.debugsyms.c+=    -g
                    132:
1.126     darran    133: # Add CTF sections for DTrace
                    134: .if defined(CTFCONVERT)
                    135: COMPILE_CTFCONVERT=    ${_MKSHECHO}\
1.127     njoly     136:                        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
1.126     darran    137:                        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    138: .else
1.156     martin    139: COMPILE_CTFCONVERT=    ${_MKSHNOECHO}
1.126     darran    140: .endif
                    141:
1.1       atatat    142: # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
                    143: # NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
1.127     njoly     144: NORMAL_C?=     @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
1.45      lukem     145:                ${_MKSHECHO}\
1.133     joerg     146:                ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< && \
                    147:                ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< && \
1.126     darran    148:                ${COMPILE_CTFCONVERT}
1.127     njoly     149: NOPROF_C?=     @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
1.45      lukem     150:                ${_MKSHECHO}\
1.133     joerg     151:                ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< && \
                    152:                ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< && \
1.126     darran    153:                ${COMPILE_CTFCONVERT}
1.127     njoly     154: NORMAL_S?=     @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
1.45      lukem     155:                ${_MKSHECHO}\
1.133     joerg     156:                ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< && \
                    157:                ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $<
1.1       atatat    158:
                    159: ##
1.59      perry     160: ## (3) libkern and compat
1.1       atatat    161: ##
                    162: ## Set KERN_AS in the port Makefile to "obj" or "library".  The
                    163: ## default is "library", as documented in $S/lib/libkern/Makefile.inc.
                    164: ##
                    165:
                    166: ### find out what to use for libkern
                    167: .include "$S/lib/libkern/Makefile.inc"
                    168: .ifndef PROF
                    169: LIBKERN?=      ${KERNLIB}
                    170: .else
                    171: LIBKERN?=      ${KERNLIB_PROF}
                    172: .endif
                    173:
1.27      perry     174: LIBKERNLN?=    ${KERNLIBLN}
                    175:
1.1       atatat    176: ### find out what to use for libcompat
                    177: .include "$S/compat/common/Makefile.inc"
                    178: .ifndef PROF
1.56      lukem     179: SYSLIBCOMPAT?= ${COMPATLIB}
1.1       atatat    180: .else
1.56      lukem     181: SYSLIBCOMPAT?= ${COMPATLIB_PROF}
1.1       atatat    182: .endif
                    183:
1.56      lukem     184: SYSLIBCOMPATLN?=       ${COMPATLIBLN}
1.27      perry     185:
1.1       atatat    186: ##
                    187: ## (4) local objects, compile rules, and dependencies
                    188: ##
                    189: ## Each port should have a corresponding section with settings for
                    190: ## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
                    191: ##
1.22      gehenna   192: MI_CFILES=devsw.c ioconf.c param.c
1.1       atatat    193: # the need for a MI_SFILES variable is dubitable at best
                    194: MI_OBJS=${MI_CFILES:S/.c/.o/}
                    195:
                    196: param.c: $S/conf/param.c
1.45      lukem     197:        ${_MKTARGET_CREATE}
1.1       atatat    198:        rm -f param.c
                    199:        cp $S/conf/param.c .
                    200:
                    201: param.o: Makefile
                    202:
                    203: .for _cfile in ${MI_CFILES}
                    204: ${_cfile:T:R}.o: ${_cfile}
                    205:        ${NORMAL_C}
                    206: .endfor
                    207:
                    208: ##
                    209: ## (5) link settings
                    210: ##
                    211: ## TEXTADDR (or LOADADDRESS), LINKFORMAT, and any EXTRA_LINKFLAGS must
                    212: ## be set in the port's Makefile.  The port specific definitions for
                    213: ## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
                    214: ## depending on the value of DEBUG.
                    215: ##
                    216: # load lines for config "xxx" will be emitted as:
                    217: # xxx: ${SYSTEM_DEP} swapxxx.o
                    218: #      ${SYSTEM_LD_HEAD}
                    219: #      ${SYSTEM_LD} swapxxx.o
                    220: #      ${SYSTEM_LD_TAIL}
1.119     matt      221: SYSTEM_OBJ?=   ${MD_OBJS} ${MI_OBJS} ${OBJS:O} ${SYSLIBCOMPAT} ${LIBKERN}
1.160     matt      222: SYSTEM_DEP+=   Makefile ${SYSTEM_OBJ:O} .gdbinit
1.129     matt      223: .if defined(KERNLDSCRIPT)
                    224: SYSTEM_DEP+=   ${KERNLDSCRIPT}
                    225: .endif
1.126     darran    226: .if defined(CTFMERGE)
1.166     ozaki-r   227: SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
1.126     darran    228: .else
                    229: SYSTEM_CTFMERGE= ${_MKSHECHO}
                    230: .endif
1.45      lukem     231: SYSTEM_LD_HEAD?=@rm -f $@
1.50      lukem     232: SYSTEM_LD?=    @${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}"; \
1.45      lukem     233:                ${_MKSHECHO}\
1.83      dsl       234:                ${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \
                    235:                ${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
1.153     bsh       236:
                    237: AUTO_SYMTAB_SPACE?=   yes
                    238:
                    239: .if empty(AUTO_SYMTAB_SPACE:M[Yy][Ee][Ss]) || defined(_SYMTAB_SPACE_ADJUSTED)
                    240: SYSTEM_LD_TAIL_DBSYM?= true
                    241: .else
                    242: SYSTEM_LD_TAIL_DBSYM?= \
                    243:        if grep '^\#define.*SYMTAB_SPACE' opt_ksyms.h > /dev/null; then \
                    244:                _modify_opt_ksyms_h () {                                \
                    245:                        ${TOOL_SED}                                     \
                    246:        -e 's/^\(\#define.*SYMTAB_SPACE[        ]*\)[0-9]*/\1'$$1/      \
                    247:        -e 's/\(.equiv[         ]*_KERNEL_OPT_SYMTAB_SPACE,0x\)[0-9a-f]*/\1'$$(printf %x $$1)/ \
                    248:                        opt_ksyms.h > opt_ksyms.h.ADJ &&                \
                    249:                        mv opt_ksyms.h.ADJ opt_ksyms.h &&               \
                    250:                        ${MAKE} ${MFLAGS} _SYMTAB_SPACE_ADJUSTED=1 $@;  \
                    251:                };                                                      \
                    252:                _adj_symtab_space () {                          \
                    253:                        set -- $$(${DBSYM} -p $@);              \
                    254:                        echo Symtab size: $$1, space: $$2;      \
                    255:                        if [ "$$1" -gt "$$2" ]; then            \
                    256:                                echo Adjusting symtab space;    \
                    257:                                rm -f $@;                       \
                    258:                                _modify_opt_ksyms_h $$1;        \
                    259:                        fi;                                     \
                    260:                };                                              \
                    261:                _adj_symtab_space;                              \
                    262:        fi
                    263: .endif
                    264:
1.1       atatat    265: TEXTADDR?=     ${LOADADDRESS}                  # backwards compatibility
1.5       atatat    266: LINKTEXT?=     ${TEXTADDR:C/.+/-Ttext &/}
                    267: LINKDATA?=     ${DATAADDR:C/.+/-Tdata &/}
1.1       atatat    268: ENTRYPOINT?=   start
1.6       atatat    269: LINKENTRY?=    ${ENTRYPOINT:C/.+/-e &/}
1.1       atatat    270: LINKFLAGS?=    ${LINKFORMAT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
                    271:                ${EXTRA_LINKFLAGS}
                    272:
1.4       atatat    273: LINKFLAGS_DEBUG?=      -X
1.161     skrll     274:
                    275: #
                    276: # If we're relinking due to _SYMTAB_SPACE_ADJUSTED then don't perform
                    277: # SYSTEM_LD_TAIL{,_DEBUG}. They'll be done in the parent invocation.
                    278: #
                    279: .if defined(_SYMTAB_SPACE_ADJUSTED)
                    280: SYSTEM_LD_TAIL?=true
                    281: SYSTEM_LD_TAIL_DEBUG?=true
                    282: .else
                    283: SYSTEM_LD_TAIL?=@${SYSTEM_LD_TAIL_DBSYM} ; \
1.169.2.1! martin    284:                ${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c; \
1.161     skrll     285:                ${SIZE} $@; chmod 755 $@; \
                    286:                ${SYSTEM_CTFMERGE}
1.1       atatat    287: SYSTEM_LD_TAIL_DEBUG?=; \
                    288:                echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
                    289:                echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
                    290:                ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1.161     skrll     291: .endif
1.4       atatat    292: LINKFLAGS_NORMAL?=     -S
1.1       atatat    293: STRIPFLAGS?=   -g
                    294:
                    295: DEBUG?=
1.60      dbj       296: .if !empty(DEBUG:M-g*)
1.1       atatat    297: SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
                    298: LINKFLAGS+=    ${LINKFLAGS_DEBUG}
1.7       atatat    299: EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
1.126     darran    300: CTFFLAGS+=     -g
1.153     bsh       301: .if !defined(_SYMTAB_SPACE_ADJUSTED)
1.130     matt      302: SYSTEM_LD_TAIL+=; \
1.143     uebayasi  303:        if grep '^\#define.*SYMTAB_SPACE' opt_ksyms.h > /dev/null; then \
1.130     matt      304:                echo "${DBSYM} $@.gdb"; \
1.139     matt      305:                ${DBSYM} $@.gdb || (rm -f $@ ; exit 1) || exit 1; \
1.130     matt      306:        fi
1.153     bsh       307: .endif
1.9       chs       308: .elifndef PROF
1.1       atatat    309: LINKFLAGS+=    ${LINKFLAGS_NORMAL}
                    310: .endif
                    311:
1.161     skrll     312: #
                    313: # More steps to skip if we're relinking due to _SYMTAB_SPACE_ADJUSTED (see
                    314: # above)
                    315: #
1.153     bsh       316: .if !defined(_SYMTAB_SPACE_ADJUSTED)
1.70      dbj       317: SYSTEM_LD_TAIL+=; \
1.143     uebayasi  318:        if grep '^\#define.*SYMTAB_SPACE' opt_ksyms.h > /dev/null; then \
1.70      dbj       319:                echo "${DBSYM} $@"; \
1.139     matt      320:                ${DBSYM} $@ || (rm -f $@ ; exit 1) || exit 1; \
1.70      dbj       321:        fi
                    322:
1.57      chs       323: SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA}
1.5       atatat    324: SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_EXTRA}
1.161     skrll     325: .endif
1.5       atatat    326:
1.1       atatat    327: ##
1.8       atatat    328: ## (6) port independent targets and dependencies: assym.h, vers.o
1.1       atatat    329: ##
                    330: .if !target(assym.h)
1.63      christos  331: assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
1.45      lukem     332:        ${_MKTARGET_CREATE}
1.63      christos  333:        cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
1.155     joerg     334:            ${GENASSYM} -- ${CC} ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${PROF} \
1.165     joerg     335:            ${GENASSYM_CPPFLAGS} > assym.h.tmp && \
1.1       atatat    336:        mv -f assym.h.tmp assym.h
1.11      mrg       337: ${MD_SFILES:C/\.[Ss]/.o/} ${SFILES:C/\.[Ss]/.o/}: assym.h
1.1       atatat    338: .endif
                    339:
1.123     perry     340: MKREPRO?=no
                    341:
                    342: .if ${MKREPRO} == "yes"
1.145     jmcneill  343: _NVFLAGS=${NVFLAGS} -r
1.123     perry     344: .else
1.145     jmcneill  345: _NVFLAGS=${NVFLAGS}
1.123     perry     346: .endif
                    347:
1.8       atatat    348: .if !target(vers.o)
                    349: newvers: vers.o
1.159     apb       350: vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} $S/conf/newvers.sh \
                    351:                $S/conf/osrelease.sh ${_NETBSD_VERSION_DEPENDS}
1.45      lukem     352:        ${_MKMSG_CREATE} vers.c
1.123     perry     353:        ${HOST_SH} $S/conf/newvers.sh ${_NVFLAGS}
1.45      lukem     354:        ${_MKTARGET_COMPILE}
1.1       atatat    355:        ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1.167     ozaki-r   356:        ${COMPILE_CTFCONVERT}
1.29      atatat    357: .endif
                    358:
1.33      thorpej   359: .if defined(MEMORY_DISK_IMAGE)
                    360: md_root_image.h: ${MEMORY_DISK_IMAGE}
1.45      lukem     361:        ${_MKTARGET_CREATE}
1.35      lukem     362:        ${TOOL_HEXDUMP} -v -e '"\t" 8/1 "0x%02x, " "\n"' ${.ALLSRC} > ${.TARGET}
1.33      thorpej   363:
                    364: # XXX This is only needed when building md_root.o
                    365: CPPFLAGS+=     -DMEMORY_DISK_IMAGE
                    366: md_root.o: md_root_image.h
                    367: .endif
                    368:
                    369: # depend on MEMORY_DISK_IMAGE configuration
                    370: md_root.o: Makefile
1.1       atatat    371:
                    372: # depend on root or device configuration
                    373: autoconf.o conf.o: Makefile
                    374:
                    375: # depend on network or filesystem configuration
                    376: uipc_proto.o vfs_conf.o: Makefile
                    377:
                    378: # depend on maxusers and CPU configuration
                    379: assym.h machdep.o: Makefile
                    380:
                    381: ##
1.16      wrstuden  382: ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
                    383: ##                   cscope, mkid
1.1       atatat    384: ##
                    385: ## Any ports that have other stuff to be cleaned up should fill in
                    386: ## EXTRA_CLEAN.  Some ports may want different settings for
                    387: ## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
                    388: ##
                    389: .if !target(__CLEANKERNEL)
                    390: __CLEANKERNEL: .USE
1.45      lukem     391:        ${_MKMSG} "${.TARGET}ing the kernel objects"
1.27      perry     392:        rm -f ${KERNELS} eddep tags *.[io] *.ln [a-z]*.s vers.c \
1.1       atatat    393:            [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
1.7       atatat    394:            ${EXTRA_KERNELS} ${EXTRA_CLEAN}
                    395: .endif
                    396:
                    397: .if !target(kernelnames)
                    398: kernelnames:
                    399:        @echo "${KERNELS} ${EXTRA_KERNELS}"
1.1       atatat    400: .endif
                    401:
                    402: .if !target(__CLEANDEPEND)
                    403: __CLEANDEPEND: .USE
1.73      dsl       404:        echo .depend ${DEPS} | xargs rm -f --
1.1       atatat    405: .endif
                    406:
                    407: # do not !target these, the kern and compat Makefiles augment them
                    408: cleandir distclean: __CLEANKERNEL __CLEANDEPEND
                    409: clean: __CLEANKERNEL
                    410: depend: .depend
1.90      thorpej   411: dependall: depend .WAIT all
1.1       atatat    412:
                    413: .if !target(.depend)
                    414: MKDEP_AFLAGS?= ${AFLAGS}
                    415: MKDEP_CFLAGS?= ${CFLAGS}
1.71      yamt      416: SSRCS=${MD_SFILES} ${SFILES}
                    417: CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES}
                    418: SRCS=${SSRCS} ${CSRCS}
1.76      lukem     419: DEPS=  ${SRCS:T:O:u:R:S/$/.d/g}
1.71      yamt      420:
                    421: .for _s in ${SSRCS}
1.147     jmcneill  422: .if !target(${_s:T:R}.d)
1.106     lukem     423: ${_s:T:R}.d: ${_s} assym.h
1.73      dsl       424:        ${_MKTARGET_CREATE}
                    425:        ${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
                    426:            ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
1.147     jmcneill  427: .endif
1.71      yamt      428: .endfor
                    429: .for _s in ${CSRCS}
1.147     jmcneill  430: .if !target(${_s:T:R}.d)
1.106     lukem     431: ${_s:T:R}.d: ${_s}
1.73      dsl       432:        ${_MKTARGET_CREATE}
                    433:        ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
                    434:            ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
1.147     jmcneill  435: .endif
1.71      yamt      436: .endfor
                    437:
1.106     lukem     438: assym.d: assym.h
1.45      lukem     439:        ${_MKTARGET_CREATE}
1.63      christos  440:        cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
                    441:            ${GENASSYM} -- ${MKDEP} -f assym.dep -- \
1.165     joerg     442:            ${CFLAGS:N-Wa,*} ${CPPFLAGS} ${GENASSYM_CPPFLAGS}
1.118     apb       443:        ${TOOL_SED} -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >${.TARGET}
1.73      dsl       444:        rm -f assym.dep
                    445:
1.109     matt      446: DEPS+= assym.d
                    447:
                    448: .depend: ${DEPS}
1.73      dsl       449:        ${_MKTARGET_CREATE}
                    450:        echo "${.ALLSRC}" | ${MKDEP} -D
1.1       atatat    451: .endif
                    452:
                    453: .if !target(lint)
                    454: ALLSFILES?=    ${MD_SFILES} ${SFILES}
                    455: LINTSTUBS?=    ${ALLSFILES:T:R:C/^.*$/LintStub_&.c/g}
1.27      perry     456: KERNLINTFLAGS?=        -bcehnxzFS
                    457: NORMAL_LN?=    ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i $<
                    458:
                    459: _lsrc=${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
1.56      lukem     460: LOBJS?= ${_lsrc:T:S/.c$/.ln/g} ${LIBKERNLN} ${SYSLIBCOMPATLN}
1.27      perry     461:
1.1       atatat    462: .for _sfile in ${ALLSFILES}
                    463: LintStub_${_sfile:T:R}.c: ${_sfile} assym.h
1.45      lukem     464:        ${_MKTARGET_COMPILE}
1.1       atatat    465:        ${CC} -E -C ${AFLAGS} ${CPPFLAGS} ${_sfile} | \
1.117     apb       466:              ${TOOL_AWK} -f $S/kern/genlintstub.awk >${.TARGET}
1.1       atatat    467: .endfor
1.27      perry     468:
                    469: .for _cfile in ${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
                    470: ${_cfile:T:R}.ln: ${_cfile}
1.45      lukem     471:        ${_MKTARGET_COMPILE}
1.27      perry     472:        ${NORMAL_LN}
                    473: .endfor
                    474:
                    475: lint: ${LOBJS}
                    476:        ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${LOBJS}
1.1       atatat    477: .endif
                    478:
1.108     matt      479: # Attempt to do a syntax-only compile of the entire kernel as one entity.
                    480: # Alas, bugs in the GCC C frontend prevent this from completely effective
                    481: # but information can be gleaned from the output.
                    482: syntax-only: ${CFILES} ${MD_CFILES}
                    483:        ${CC} -fsyntax-only -combine ${CFLAGS} ${CPPFLAGS} \
                    484:                ${CFILES} ${MD_CFILES}
                    485:
1.100     jmmv      486: # List of kernel images that will be installed into the root file system.
                    487: # Some platforms may need to install more than one (e.g. a netbsd.aout file
                    488: # to be loaded directly by the firmware), so this can be overriden by them.
                    489: KERNIMAGES?=   netbsd
                    490:
1.1       atatat    491: .if !target(install)
                    492: # The install target can be redefined by putting a
                    493: # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
                    494: MACHINE_NAME!=  uname -n
                    495: install: install-kernel-${MACHINE_NAME}
1.28      chris     496: .if !target(install-kernel-${MACHINE_NAME})
1.1       atatat    497: install-kernel-${MACHINE_NAME}:
1.100     jmmv      498: .for _K in ${KERNIMAGES}
                    499:        rm -f ${DESTDIR}/o${_K}
                    500:        ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
                    501:        cp ${_K} ${DESTDIR}/n${_K}
                    502:        mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
                    503: .endfor
1.1       atatat    504: .endif
                    505: .endif
                    506:
                    507: .if !target(tags)
                    508: tags:
                    509:        @echo "see $S/kern/Makefile for tags"
1.16      wrstuden  510: .endif
                    511:
1.58      heas      512: EXTRA_CLEAN+= cscope.out cscope.tmp
1.16      wrstuden  513: .if !target(cscope.out)
1.19      wrstuden  514: cscope.out: Makefile depend
1.45      lukem     515:        ${_MKTARGET_CREATE}
1.118     apb       516:        @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/kern/.depend \
                    517:            | tr -s ' ' '\n' \
1.122     pooka     518:            | ${TOOL_SED} ';s|^../../||;' \
1.118     apb       519:            > cscope.tmp
                    520:        @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/compat/.depend \
                    521:            | tr -s ' ' '\n' \
1.122     pooka     522:            | ${TOOL_SED} 's|^../../||;' \
1.118     apb       523:            >> cscope.tmp
1.58      heas      524:        @echo ${SRCS} | cat - cscope.tmp | tr -s ' ' '\n' | sort -u | \
1.118     apb       525:            ${CSCOPE} -k -i - -b `echo ${INCLUDES} | ${TOOL_SED} s/-nostdinc//`
1.16      wrstuden  526: #      cscope doesn't write cscope.out if it's uptodate, so ensure
                    527: #      make doesn't keep calling cscope when not needed.
1.58      heas      528:        @rm -f cscope.tmp; touch cscope.out
1.16      wrstuden  529: .endif
                    530:
                    531: .if !target(cscope)
                    532: cscope: cscope.out
                    533:        @${CSCOPE} -d
                    534: .endif
                    535:
                    536: EXTRA_CLEAN+= ID
                    537: .if !target(mkid)
                    538: .PHONY: mkid
                    539: mkid: ID
                    540:
1.17      wrstuden  541: ID: Makefile depend
1.45      lukem     542:        ${_MKTARGET_CREATE}
1.118     apb       543:        @${MKID} \
                    544:            `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \
                    545:                        lib/kern/.depend lib/compat/.depend \
                    546:                    | tr ' ' '\n' \
                    547:                    | ${TOOL_SED} "s|^../../||" \
                    548:                    | sort -u` \
                    549:            `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \
                    550:                        .depend \
                    551:                    | tr ' ' '\n' \
                    552:                    | sort -u`
1.18      wrstuden  553:
1.21      thorpej   554: .endif
                    555:
                    556: .include "${S}/gdbscripts/Makefile.inc"
                    557:
                    558: EXTRA_CLEAN+= .gdbinit
                    559: .gdbinit: Makefile ${S}/gdbscripts/Makefile.inc
1.45      lukem     560:        ${_MKTARGET_CREATE}
1.21      thorpej   561:        rm -f .gdbinit
                    562: .for __gdbinit in ${SYS_GDBINIT}
                    563:        echo "source ${S}/gdbscripts/${__gdbinit}" >> .gdbinit
                    564: .endfor
                    565: .if defined(GDBINIT) && !empty(GDBINIT)
                    566: .for __gdbinit in ${GDBINIT}
                    567:        echo "source ${__gdbinit}" >> .gdbinit
                    568: .endfor
1.1       atatat    569: .endif
                    570:
1.99      christos  571: # The following files use alloca(3) or variable array allocations.
1.92      christos  572: # Their full name is noted as documentation.
1.125     tron      573: VARSTACK=kern/uipc_socket.c miscfs/genfs/genfs_vnops.c \
1.102     pooka     574:     nfs/nfs_bio.c uvm/uvm_bio.c \
1.104     jnemeth   575:     uvm/uvm_pager.c dev/ic/aic7xxx.c dev/ic/aic79xx.c arch/xen/i386/gdt.c \
                    576:     dev/ofw/ofw_subr.c
1.92      christos  577:
                    578: .for __varstack in ${VARSTACK}
                    579: COPTS.${__varstack:T} += -Wno-stack-protector
                    580: .endfor
                    581:
1.86      matt      582: AFLAGS+=       ${AOPTS.${.IMPSRC:T}}
1.64      yamt      583: CFLAGS+=       ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
                    584: CPPFLAGS+=     ${CPPFLAGS.${.IMPSRC:T}}
1.65      uwe       585: CWARNFLAGS+=   ${CWARNFLAGS.${.IMPSRC:T}}
1.64      yamt      586:
1.105     lukem     587: .include <bsd.files.mk>
1.149     joerg     588: .include <bsd.clang-analyze.mk>
1.105     lukem     589:
1.1       atatat    590: ##
                    591: ## the end
                    592: ##

CVSweb <webmaster@jp.NetBSD.org>