[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.264.2.2

1.264.2.2! pgoyette    1: #      $NetBSD: Makefile.kern.inc,v 1.265 2018/08/27 05:35:22 riastradh 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
1.250     riastrad   55: S!=    cd ../../../.. && pwd
1.1       atatat     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.262     christos   66: .if !defined(COVERITY_TOP_CONFIG)
1.128     matt       67: CPPFLAGS+=     -std=gnu99
1.262     christos   68: .endif
1.4       atatat     69: DEFCOPTS?=     -O2
1.25      fvdl       70: COPTS?=                ${DEFCOPTS}
1.7       atatat     71: DBG=           # might contain unwanted -Ofoo
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.42      jdolecek   90:
1.137     joerg      91: CWARNFLAGS.clang+=     -Wno-unknown-pragmas -Wno-conversion \
1.256     joerg      92:                        -Wno-self-assign -Wno-error=address-of-packed-member \
                     93:                        -Wno-error=constant-conversion
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.264     joerg     101: CFLAGS+=       ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :}
1.115     tron      102: CFLAGS+=       ${DEBUG} ${COPTS}
1.134     joerg     103: AFLAGS+=       -D_LOCORE -Wa,--fatal-warnings
1.53      matt      104:
1.78      mrg       105: # XXX
1.158     joerg     106: .if defined(HAVE_GCC) || defined(HAVE_LLVM)
1.78      mrg       107: CFLAGS+=       -fno-strict-aliasing
1.157     matt      108: CFLAGS+=       -fno-common
1.78      mrg       109: .endif
                    110:
1.45      lukem     111: # Use the per-source COPTS variables to add -g to just those
1.1       atatat    112: # files that match the shell patterns given in ${DEBUGLIST}
                    113: #
                    114: .for i in ${DEBUGLIST}
1.237     uebayasi  115: . for j in ${ALLFILES:M*.c:T:M$i.c}
1.45      lukem     116: COPTS.${j}+=-g
1.87      christos  117: . endfor
1.1       atatat    118: .endfor
                    119:
1.131     plunky    120: # Always compile debugsyms.c with debug information.
1.107     joerg     121: # This allows gdb to use type informations.
                    122: #
                    123: COPTS.debugsyms.c+=    -g
                    124:
1.126     darran    125: # Add CTF sections for DTrace
                    126: .if defined(CTFCONVERT)
                    127: COMPILE_CTFCONVERT=    ${_MKSHECHO}\
1.127     njoly     128:                        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
1.126     darran    129:                        ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
                    130: .else
1.156     martin    131: COMPILE_CTFCONVERT=    ${_MKSHNOECHO}
1.126     darran    132: .endif
                    133:
1.230     uebayasi  134: KCOMPILE.c=    ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
                    135: KCOMPILE.s=    ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@
                    136: KLINK.o=       ${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC}
1.229     uebayasi  137:
1.1       atatat    138: # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
                    139: # NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
1.127     njoly     140: NORMAL_C?=     @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
1.230     uebayasi  141:                ${_MKSHECHO} ${KCOMPILE.c} ${PROF} && \
                    142:                ${KCOMPILE.c} ${PROF} && \
1.126     darran    143:                ${COMPILE_CTFCONVERT}
1.127     njoly     144: NOPROF_C?=     @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
1.230     uebayasi  145:                ${_MKSHECHO} ${KCOMPILE.c} && \
                    146:                ${KCOMPILE.c} && \
1.126     darran    147:                ${COMPILE_CTFCONVERT}
1.127     njoly     148: NORMAL_S?=     @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
1.230     uebayasi  149:                ${_MKSHECHO} ${KCOMPILE.s} && \
                    150:                ${KCOMPILE.s}
1.175     uebayasi  151:
                    152: # link rules:
1.176     uebayasi  153: LINK_O?=       @${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}" && \
1.230     uebayasi  154:                ${_MKSHECHO} ${KLINK.o} && \
                    155:                ${KLINK.o}
1.1       atatat    156:
                    157: ##
1.264.2.1  pgoyette  158: ## (3) libkern
1.1       atatat    159: ##
                    160: ## Set KERN_AS in the port Makefile to "obj" or "library".  The
                    161: ## default is "library", as documented in $S/lib/libkern/Makefile.inc.
                    162: ##
                    163:
                    164: ### find out what to use for libkern
                    165: .include "$S/lib/libkern/Makefile.inc"
                    166: .ifndef PROF
                    167: LIBKERN?=      ${KERNLIB}
                    168: .else
                    169: LIBKERN?=      ${KERNLIB_PROF}
                    170: .endif
                    171:
1.27      perry     172: LIBKERNLN?=    ${KERNLIBLN}
                    173:
1.1       atatat    174: ##
                    175: ## (4) local objects, compile rules, and dependencies
                    176: ##
                    177: ## Each port should have a corresponding section with settings for
                    178: ## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
                    179: ##
1.209     uebayasi  180:
1.224     uebayasi  181: .if !defined(___USE_SUFFIX_RULES___)
1.235     uebayasi  182: _MD_OBJS=      ${MD_OBJS:T}
                    183: .else
                    184: _MD_OBJS=      ${MD_OBJS}
1.217     uebayasi  185: .endif
                    186:
1.1       atatat    187: ##
                    188: ## (5) link settings
                    189: ##
1.181     uebayasi  190: ## TEXTADDR (or LOADADDRESS), LINKFORMAT, LINKSCRIPT, and any EXTRA_LINKFLAGS
                    191: ## must be set in the port's Makefile.  The port specific definitions for
1.1       atatat    192: ## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
                    193: ## depending on the value of DEBUG.
                    194: ##
                    195: # load lines for config "xxx" will be emitted as:
1.170     joerg     196: # xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel
                    197:
1.264.2.1  pgoyette  198: SYSTEM_LIB=    ${MD_LIBS} ${LIBKERN}
1.238     uebayasi  199: SYSTEM_OBJ?=   ${_MD_OBJS} ${OBJS} ${SYSTEM_LIB}
1.243     uebayasi  200: SYSTEM_DEP+=   Makefile ${SYSTEM_OBJ:O}
1.126     darran    201: .if defined(CTFMERGE)
1.166     ozaki-r   202: SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
1.126     darran    203: .else
                    204: SYSTEM_CTFMERGE= ${_MKSHECHO}
                    205: .endif
1.253     christos  206:
                    207: REMOVE_SWAP=   [@]
                    208: .for k in ${KERNELS}
                    209: REMOVE_SWAP:=  ${REMOVE_SWAP}:Nswap${k}.o
                    210: .endfor
                    211:
1.45      lukem     212: SYSTEM_LD_HEAD?=@rm -f $@
1.223     uebayasi  213: SYSTEM_LD?=    ${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}"; \
1.45      lukem     214:                ${_MKSHECHO}\
1.228     uebayasi  215:                ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
1.253     christos  216:                '$${SYSTEM_OBJ:${REMOVE_SWAP}}' '$${EXTRA_OBJ}' vers.o \
1.228     uebayasi  217:                ${OBJS:M*swap${.TARGET}.o}; \
                    218:                ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
1.253     christos  219:                ${SYSTEM_OBJ:${REMOVE_SWAP}} ${EXTRA_OBJ} vers.o \
1.228     uebayasi  220:                ${OBJS:M*swap${.TARGET}.o}
1.153     bsh       221:
1.1       atatat    222: TEXTADDR?=     ${LOADADDRESS}                  # backwards compatibility
1.5       atatat    223: LINKTEXT?=     ${TEXTADDR:C/.+/-Ttext &/}
                    224: LINKDATA?=     ${DATAADDR:C/.+/-Tdata &/}
1.1       atatat    225: ENTRYPOINT?=   start
1.6       atatat    226: LINKENTRY?=    ${ENTRYPOINT:C/.+/-e &/}
1.181     uebayasi  227: LINKFLAGS?=    ${LINKFORMAT} ${LINKSCRIPT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
1.1       atatat    228:                ${EXTRA_LINKFLAGS}
                    229:
1.4       atatat    230: LINKFLAGS_DEBUG?=      -X
1.161     skrll     231:
1.250     riastrad  232: SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \
                    233:                ${SIZE} $@ && chmod 755 $@ && \
1.161     skrll     234:                ${SYSTEM_CTFMERGE}
1.250     riastrad  235: SYSTEM_LD_TAIL_DEBUG?=&& \
                    236:                echo mv -f $@ $@.gdb && mv -f $@ $@.gdb && \
                    237:                echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb && \
1.1       atatat    238:                ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1.4       atatat    239: LINKFLAGS_NORMAL?=     -S
1.1       atatat    240: STRIPFLAGS?=   -g
                    241:
                    242: DEBUG?=
1.60      dbj       243: .if !empty(DEBUG:M-g*)
1.1       atatat    244: SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
                    245: LINKFLAGS+=    ${LINKFLAGS_DEBUG}
1.7       atatat    246: EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
1.126     darran    247: CTFFLAGS+=     -g
1.174     matt      248: TARGETSFX=     .gdb
1.9       chs       249: .elifndef PROF
1.1       atatat    250: LINKFLAGS+=    ${LINKFLAGS_NORMAL}
                    251: .endif
                    252:
1.246     uebayasi  253: SYSTEM_LD_HEAD+=       ${SYSTEM_LD_HEAD_EXTRA}
1.170     joerg     254: SYSTEM_LD_TAIL_STAGE1= ${SYSTEM_LD_TAIL}
                    255: SYSTEM_LD_TAIL_STAGE2= ${SYSTEM_LD_TAIL}
1.171     joerg     256: .if defined(COPY_SYMTAB)
1.250     riastrad  257: SYSTEM_LD_TAIL_STAGE2+=        && echo ${DBSYM} $@ && ${DBSYM} $@
1.174     matt      258: .if !empty(DEBUG:M-g)
1.250     riastrad  259: SYSTEM_LD_TAIL_STAGE2+=        && echo ${DBSYM} $@.gdb && ${DBSYM} $@.gdb
1.174     matt      260: .endif
1.161     skrll     261: .endif
1.170     joerg     262: SYSTEM_LD_TAIL_STAGE2+=        ${SYSTEM_LD_TAIL_EXTRA}
1.5       atatat    263:
1.1       atatat    264: ##
1.8       atatat    265: ## (6) port independent targets and dependencies: assym.h, vers.o
1.1       atatat    266: ##
1.199     uebayasi  267:
1.244     uebayasi  268: .if !defined(___USE_SUFFIX_RULES___)
                    269:
                    270: # Generate list of *.o files to pass to ${LD}, preserving order.
                    271: #      x/y/z/a.[csS] -> a.[csS]
                    272: #      a.[csS] -> a.o
                    273: OBJS=  ${ALLFILES:C|^.*/([^/]*\.[csS])$$|\1|:C|^(.*)\.[csS]$$|\1.o|}
                    274:
1.237     uebayasi  275: CFILES=        ${ALLFILES:M*.c}
                    276: SFILES=        ${ALLFILES:M*.[sS]}
                    277: OFILES=        ${ALLFILES:M*.o}
1.223     uebayasi  278: # absolute, generated (build directory), relative (under $S)
                    279: _CFILES=${CFILES:M/*} ${CFILES:N/*:N*/*} ${CFILES:N/*:M*/*:C|^|$S/|}
                    280: _SFILES=${SFILES:M/*} ${SFILES:N/*:N*/*} ${SFILES:N/*:M*/*:C|^|$S/|}
1.235     uebayasi  281: _MD_CFILES=${MD_CFILES}
                    282: _MD_SFILES=${MD_SFILES}
1.240     uebayasi  283: CSRCS= ${_MD_CFILES} ${_CFILES}
                    284: SSRCS= ${_MD_SFILES} ${_SFILES}
                    285: SRCS=  ${CSRCS} ${SSRCS}
1.221     uebayasi  286:
1.244     uebayasi  287: .else # ___USE_SUFFIX_RULES___
                    288: OBJS=  ${ALLFILES:C|\.[csS]$$|.o|}
                    289: SRCS=  ${ALLFILES:M*.[csS]}
                    290: .endif # ___USE_SUFFIX_RULES___
                    291:
1.222     uebayasi  292: .if !defined(___USE_SUFFIX_RULES___)
1.221     uebayasi  293: .for _s in ${_CFILES}
                    294: .if !commands(${_s:T:R}.o)
                    295: ${_s:T:R}.o: ${_s}
                    296:        ${NORMAL_C}
                    297: .endif
                    298: .endfor
                    299:
                    300: .for _s in ${_SFILES}
                    301: .if !commands(${_s:T:R}.o)
                    302: ${_s:T:R}.o: ${_s}
                    303:        ${NORMAL_S}
                    304: .endif
                    305: .endfor
1.222     uebayasi  306: .endif # !___USE_SUFFIX_RULES___
1.221     uebayasi  307:
1.248     christos  308: .include "${S}/conf/ldscript.mk"
                    309: .include "${S}/conf/assym.mk"
                    310: .include "${S}/conf/newvers.mk"
                    311: .include "${S}/dev/splash/splash.mk"
                    312: .include "${S}/conf/mdroot.mk"
                    313: .include "${S}/conf/lint.mk"
                    314: .include "${S}/conf/cscope.mk"
                    315: .include "${S}/conf/gdbinit.mk"
                    316: .include "${S}/conf/ssp.mk"
1.261     martin    317: .if "${_SKIP_DTS}" != "yes"
1.260     christos  318: .include "${S}/conf/dts.mk"
1.261     martin    319: .endif
1.248     christos  320:
1.1       atatat    321: ##
1.16      wrstuden  322: ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
                    323: ##                   cscope, mkid
1.1       atatat    324: ##
                    325: ## Any ports that have other stuff to be cleaned up should fill in
                    326: ## EXTRA_CLEAN.  Some ports may want different settings for
                    327: ## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
                    328: ##
1.200     uebayasi  329:
                    330: ##
                    331: ## clean
                    332: ##
                    333:
1.1       atatat    334: .if !target(__CLEANKERNEL)
                    335: __CLEANKERNEL: .USE
1.45      lukem     336:        ${_MKMSG} "${.TARGET}ing the kernel objects"
1.177     uebayasi  337:        rm -f ${KERNELS} *.map eddep tags *.[io] *.ko *.ln [a-z]*.s vers.c \
1.1       atatat    338:            [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
1.7       atatat    339:            ${EXTRA_KERNELS} ${EXTRA_CLEAN}
                    340: .endif
                    341:
                    342: .if !target(kernelnames)
                    343: kernelnames:
                    344:        @echo "${KERNELS} ${EXTRA_KERNELS}"
1.1       atatat    345: .endif
                    346:
                    347: .if !target(__CLEANDEPEND)
                    348: __CLEANDEPEND: .USE
1.73      dsl       349:        echo .depend ${DEPS} | xargs rm -f --
1.1       atatat    350: .endif
                    351:
                    352: # do not !target these, the kern and compat Makefiles augment them
                    353: cleandir distclean: __CLEANKERNEL __CLEANDEPEND
                    354: clean: __CLEANKERNEL
                    355: depend: .depend
1.90      thorpej   356: dependall: depend .WAIT all
1.1       atatat    357:
1.200     uebayasi  358: ##
                    359: ## depend
                    360: ##
                    361:
1.1       atatat    362: .if !target(.depend)
                    363: MKDEP_AFLAGS?= ${AFLAGS}
                    364: MKDEP_CFLAGS?= ${CFLAGS}
1.222     uebayasi  365: .if !defined(___USE_SUFFIX_RULES___)
1.248     christos  366: DEPS+= ${SRCS:T:R:S/$/.d/g}
1.222     uebayasi  367: .else
1.248     christos  368: DEPS+= ${SRCS:R:S/$/.d/g}
1.222     uebayasi  369: .endif
1.71      yamt      370:
1.222     uebayasi  371: .if !defined(___USE_SUFFIX_RULES___)
1.71      yamt      372: .for _s in ${SSRCS}
1.249     christos  373: .if !commands(${_s:T:R}.d)
1.245     uebayasi  374: ${_s:T:R}.d: ${_s}
1.73      dsl       375:        ${_MKTARGET_CREATE}
1.219     uebayasi  376:        ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_AFLAGS} \
1.73      dsl       377:            ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
1.219     uebayasi  378:        mv -f ${.TARGET}.tmp ${.TARGET}
1.147     jmcneill  379: .endif
1.71      yamt      380: .endfor
1.199     uebayasi  381:
1.71      yamt      382: .for _s in ${CSRCS}
1.249     christos  383: .if !commands(${_s:T:R}.d)
1.106     lukem     384: ${_s:T:R}.d: ${_s}
1.73      dsl       385:        ${_MKTARGET_CREATE}
1.219     uebayasi  386:        ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_CFLAGS} \
1.73      dsl       387:            ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
1.219     uebayasi  388:        mv -f ${.TARGET}.tmp ${.TARGET}
1.147     jmcneill  389: .endif
1.71      yamt      390: .endfor
1.222     uebayasi  391: .endif # !___USE_SUFFIX_RULES___
1.71      yamt      392:
1.243     uebayasi  393: .depend: ${DEPS:O}
1.73      dsl       394:        ${_MKTARGET_CREATE}
                    395:        echo "${.ALLSRC}" | ${MKDEP} -D
1.1       atatat    396: .endif
                    397:
1.200     uebayasi  398: ##
1.210     uebayasi  399: ## install
1.200     uebayasi  400: ##
                    401:
1.100     jmmv      402: # List of kernel images that will be installed into the root file system.
                    403: # Some platforms may need to install more than one (e.g. a netbsd.aout file
                    404: # to be loaded directly by the firmware), so this can be overriden by them.
                    405: KERNIMAGES?=   netbsd
                    406:
1.1       atatat    407: .if !target(install)
                    408: # The install target can be redefined by putting a
                    409: # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
                    410: MACHINE_NAME!=  uname -n
                    411: install: install-kernel-${MACHINE_NAME}
1.28      chris     412: .if !target(install-kernel-${MACHINE_NAME})
1.1       atatat    413: install-kernel-${MACHINE_NAME}:
1.100     jmmv      414: .for _K in ${KERNIMAGES}
                    415:        rm -f ${DESTDIR}/o${_K}
                    416:        ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
                    417:        cp ${_K} ${DESTDIR}/n${_K}
                    418:        mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
                    419: .endfor
1.1       atatat    420: .endif
                    421: .endif
                    422:
1.200     uebayasi  423: ##
                    424: ## the kernel
                    425: ##
                    426:
1.86      matt      427: AFLAGS+=       ${AOPTS.${.IMPSRC:T}}
1.64      yamt      428: CFLAGS+=       ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
                    429: CPPFLAGS+=     ${CPPFLAGS.${.IMPSRC:T}}
1.65      uwe       430: CWARNFLAGS+=   ${CWARNFLAGS.${.IMPSRC:T}}
1.64      yamt      431:
1.264.2.2! pgoyette  432: .for _v in CFLAGS CPPFLAGS CWARNFLAGS
        !           433: .for _c in ${CSRCS}
        !           434: ${_v}.${_c:T}+=${OPT.${_c:T}:@.o.@${${_v}.${.o.}}@}
        !           435: .endfor
        !           436: .endfor
        !           437:
1.234     uebayasi  438: .MAIN: all
                    439: all: .gdbinit
1.231     uebayasi  440: .for k in ${KERNELS}
1.234     uebayasi  441: all: .WAIT ${k}
1.233     uebayasi  442: ${k}: ${SYSTEM_DEP:O} swap${k}.o vers.o build_kernel
1.231     uebayasi  443: .endfor
                    444:
1.170     joerg     445: .if !defined(COPY_SYMTAB)
                    446: build_kernel: .USE
                    447:        ${SYSTEM_LD_HEAD}
1.223     uebayasi  448:        ${SYSTEM_LD}
1.170     joerg     449:        ${SYSTEM_LD_TAIL_STAGE2}
                    450: .else
1.196     uebayasi  451: .for k in ${KERNELS}
                    452: ${k}: $S/kern/kern_ksyms_buf.c
                    453: .endfor
1.170     joerg     454: build_kernel: .USE
1.242     uebayasi  455:        ${CC} ${CFLAGS} ${CPPFLAGS} \
1.170     joerg     456:            -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o
                    457:        ${SYSTEM_LD_HEAD}
1.223     uebayasi  458:        ${SYSTEM_LD} kern_ksyms_buf.o
1.170     joerg     459:        ${SYSTEM_LD_TAIL_STAGE1}
1.242     uebayasi  460:        ${CC} ${CFLAGS} ${CPPFLAGS} \
1.174     matt      461:            -DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \
1.170     joerg     462:            -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o
                    463:        ${SYSTEM_LD_HEAD}
1.223     uebayasi  464:        ${SYSTEM_LD} kern_ksyms_buf_real.o
1.170     joerg     465:        ${SYSTEM_LD_TAIL_STAGE2}
                    466: .endif
                    467:
1.105     lukem     468: .include <bsd.files.mk>
1.149     joerg     469: .include <bsd.clang-analyze.mk>
1.105     lukem     470:
1.1       atatat    471: ##
1.218     uebayasi  472: ## suffix rules
                    473: ##
                    474:
                    475: .if defined(___USE_SUFFIX_RULES___)
                    476: .SUFFIXES: .s .d
                    477: .s.d:
                    478:        ${_MKTARGET_CREATE}
1.219     uebayasi  479:        ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
                    480:        mv -f $@.tmp $@
1.218     uebayasi  481:
                    482: .SUFFIXES: .S .d
                    483: .S.d:
                    484:        ${_MKTARGET_CREATE}
1.219     uebayasi  485:        ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
                    486:        mv -f $@.tmp $@
1.218     uebayasi  487:
                    488: .SUFFIXES: .c .d
                    489: .c.d:
                    490:        ${_MKTARGET_CREATE}
1.219     uebayasi  491:        ${MKDEP} -f $@.tmp -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
                    492:        mv -f $@.tmp $@
1.218     uebayasi  493:
1.230     uebayasi  494: .SUFFIXES: .c .o .go .po
1.218     uebayasi  495: .c.o:
1.230     uebayasi  496:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    497:        @${_MKSHECHO} ${KCOMPILE.c}
                    498:        @${KCOMPILE.c}
                    499:        @${COMPILE_CTFCONVERT}
                    500: .c.go:
                    501:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    502:        @${_MKSHECHO} ${KCOMPILE.c} -g
                    503:        @${KCOMPILE.c} -g
                    504:        @${COMPILE_CTFCONVERT}
                    505: .c.po:
                    506:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    507:        @${_MKSHECHO} ${KCOMPILE.c} -pg
                    508:        @${KCOMPILE.c} -pg
                    509:        @${COMPILE_CTFCONVERT}
1.218     uebayasi  510:
1.230     uebayasi  511: .SUFFIXES: .s .o .go .po
1.218     uebayasi  512: .s.o:
1.230     uebayasi  513:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    514:        @${_MKSHECHO} ${KCOMPILE.s}
                    515:        @${KCOMPILE.s}
                    516: .s.go:
                    517:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    518:        @${_MKSHECHO} ${KCOMPILE.s} -g
                    519:        @${KCOMPILE.s} -g
                    520: .s.po:
                    521:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    522:        @${_MKSHECHO} ${KCOMPILE.s} -pg
                    523:        @${KCOMPILE.s} -pg
1.218     uebayasi  524:
                    525: .S.o:
1.230     uebayasi  526:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    527:        @${_MKSHECHO} ${KCOMPILE.s}
                    528:        @${KCOMPILE.s}
                    529: .S.go:
                    530:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    531:        @${_MKSHECHO} ${KCOMPILE.s} -g
                    532:        @${KCOMPILE.s} -g
                    533: .S.po:
                    534:        @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
                    535:        @${_MKSHECHO} ${KCOMPILE.s} -pg
                    536:        @${KCOMPILE.s} -pg
1.218     uebayasi  537: .endif # ___USE_SUFFIX_RULES___
                    538:
                    539: ##
1.1       atatat    540: ## the end
                    541: ##

CVSweb <webmaster@jp.NetBSD.org>