The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/conf/Makefile.kern.inc

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #       $NetBSD: Makefile.kern.inc,v 1.295 2022/08/27 20:37:49 rillig Exp $
    2 #
    3 # This file contains common `MI' targets and definitions and it is included
    4 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
    5 #
    6 # Each target in this file should be protected with `if !target(target)'
    7 # or `if !commands(target)' and each variable should only be conditionally
    8 # assigned `VAR ?= VALUE', so that everything can be overridden.
    9 #
   10 # DEBUG is set to -g if debugging.
   11 # PROF is set to -pg if profiling.
   12 #
   13 # To specify debugging, add the config line: makeoptions DEBUG="-g"
   14 # A better way is to specify -g only for a few files.
   15 #
   16 #       makeoptions DEBUGLIST="uvm* trap if_*"
   17 #
   18 # all ports are expected to include bsd.own.mk for toolchain settings
   19 
   20 # Default DEBUG to -g if kernel debug info is requested by MKDEBUGKERNEL=yes
   21 .if ${MKDEBUGKERNEL:Uno} == "yes" || ${MKDEBUG:Uno} == "yes"
   22 DEBUG?=-g
   23 .else
   24 DEBUG?=
   25 .endif
   26 
   27 ##
   28 ## (0) toolchain settings for things that aren't part of the standard
   29 ## toolchain
   30 ##
   31 HOST_SH?=       sh
   32 DBSYM?=         dbsym
   33 MKDEP?=         mkdep
   34 STRIP?=         strip
   35 OBJCOPY?=       objcopy
   36 OBJDUMP?=       objdump
   37 CSCOPE?=        cscope
   38 MKID?=          mkid
   39 UUDECODE?=      ${TOOL_UUDECODE:Uuudecode}
   40 HEXDUMP?=       ${TOOL_HEXDUMP:Uhexdump}
   41 GENASSYM?=      ${TOOL_GENASSYM:Ugenassym}
   42 .MAKEOVERRIDES+=USETOOLS        # make sure proper value is propagated
   43 
   44 _MKMSG?=                @\#
   45 _MKSHMSG?=              echo
   46 _MKSHECHO?=             echo
   47 _MKSHNOECHO=            :
   48 _MKMSG_CREATE?=         :
   49 _MKTARGET_COMPILE?=     :
   50 _MKTARGET_CREATE?=      :
   51 
   52 ##
   53 ## (1) port independent source tree identification
   54 ##
   55 # source tree is located via $S relative to the compilation directory
   56 .ifndef S
   57 S!=     cd ../../../.. && pwd
   58 .endif
   59 
   60 ##
   61 ## (2) compile settings
   62 ##
   63 ## CPPFLAGS, CFLAGS, and AFLAGS must be set in the port's Makefile
   64 ##
   65 INCLUDES?=      -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \
   66                 -I$S -nostdinc
   67 CPPFLAGS+=      ${INCLUDES} ${IDENT} -D_KERNEL -D_KERNEL_OPT
   68 .if !defined(COVERITY_TOP_CONFIG)
   69 CPPFLAGS+=      -std=gnu99
   70 .endif
   71 .if ${KERNEL_DIR:Uno} == "yes"
   72 CPPFLAGS+=      -DKERNEL_DIR
   73 .endif
   74 DEFCOPTS?=      -O2
   75 COPTS?=         ${DEFCOPTS}
   76 DBG=            # might contain unwanted -Ofoo
   77 CWARNFLAGS+=    -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith
   78 CWARNFLAGS+=    -Wmissing-prototypes -Wstrict-prototypes
   79 CWARNFLAGS+=    -Wold-style-definition
   80 CWARNFLAGS+=    -Wswitch -Wshadow
   81 CWARNFLAGS+=    -Wcast-qual -Wwrite-strings
   82 CWARNFLAGS+=    -Wno-unreachable-code
   83 #CWARNFLAGS+=   -Wc++-compat -Wno-error=c++-compat
   84 CWARNFLAGS+=    -Wno-pointer-sign -Wno-attributes
   85 CWARNFLAGS+=    -Wno-type-limits
   86 .  if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
   87         ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
   88 CWARNFLAGS+=    -Wextra -Wno-unused-parameter
   89 .  endif
   90 .  if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64"
   91 CWARNFLAGS+=    -Wold-style-definition
   92 .  endif
   93 # Add -Wno-sign-compare.  -Wsign-compare is included in -Wall as of GCC 3.3,
   94 # but our sources aren't up for it yet.
   95 CWARNFLAGS+=    -Wno-sign-compare
   96 
   97 CWARNFLAGS.clang+=      -Wno-unknown-pragmas -Wno-conversion \
   98                         -Wno-self-assign -Wno-error=address-of-packed-member \
   99                         -Wno-error=constant-conversion
  100 CWARNFLAGS.gcc+=        ${GCC_NO_ADDR_OF_PACKED_MEMBER}
  101 
  102 CWARNFLAGS.ah_regdomain.c= ${${ACTIVE_CC} == "clang":? \
  103     -Wno-shift-count-negative -Wno-shift-count-overflow:}
  104 
  105 CWARNFLAGS.ioconf.c= ${${ACTIVE_CC} == "clang":? -Wno-unused-const-variable :}
  106 
  107 CFLAGS+=        -ffreestanding -fno-zero-initialized-in-bss
  108 CFLAGS+=        ${${ACTIVE_CC} == "gcc":? -fno-delete-null-pointer-checks :}
  109 CFLAGS+=        ${DEBUG} ${COPTS}
  110 AFLAGS+=        -D_LOCORE -Wa,--fatal-warnings
  111 
  112 # example usage to find largest stack users in kernel compile directory:
  113 #    find . -name \*.su | xargs awk '{ printf "%6d %s\n", $2, $1 }' | sort -n
  114 .if ${MACHINE} != "vax"
  115 # GCC/vax 8.4 does not support -fstack-usage.
  116 CFLAGS+=        ${${ACTIVE_CC} == "gcc":? -fstack-usage -Wstack-usage=3584 :}
  117 .endif
  118 CWARNFLAGS+=    -Walloca
  119 
  120 # XXX
  121 .if defined(HAVE_GCC) || defined(HAVE_LLVM)
  122 CFLAGS+=        -fno-strict-aliasing
  123 CFLAGS+=        -fno-common
  124 .endif
  125 
  126 # Use the per-source COPTS variables to add -g to just those
  127 # files that match the shell patterns given in ${DEBUGLIST}
  128 #
  129 .for i in ${DEBUGLIST}
  130 . for j in ${ALLFILES:M*.c:T:M$i.c}
  131 COPTS.${j}+=-g
  132 . endfor
  133 .endfor
  134 
  135 # Always compile debugsyms.c with debug information.
  136 # This allows gdb to use type informations.
  137 #
  138 COPTS.debugsyms.c+=     -g
  139 
  140 # Add CTF sections for DTrace
  141 .if defined(CTFCONVERT)
  142 COMPILE_CTFCONVERT=     ${_MKSHECHO}\
  143                         ${CTFCONVERT} ${CTFFLAGS} ${.TARGET} && \
  144                         ${CTFCONVERT} ${CTFFLAGS} ${.TARGET}
  145 .else
  146 COMPILE_CTFCONVERT=     ${_MKSHNOECHO}
  147 .endif
  148 
  149 KCOMPILE.c=     ${CC} ${COPTS.${<:T}} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
  150 KCOMPILE.s=     ${CC} ${AFLAGS} ${AFLAGS.${<:T}} ${CPPFLAGS} -c $< -o $@
  151 KLINK.o=        ${LD} -r ${LINKFORMAT} -Map=${.TARGET}.map -o ${.TARGET} ${.ALLSRC}
  152 
  153 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
  154 # NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
  155 NORMAL_C?=      @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
  156                 ${_MKSHECHO} ${KCOMPILE.c} ${PROF} && \
  157                 ${KCOMPILE.c} ${PROF} && \
  158                 ${COMPILE_CTFCONVERT}
  159 NOPROF_C?=      @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
  160                 ${_MKSHECHO} ${KCOMPILE.c} && \
  161                 ${KCOMPILE.c} && \
  162                 ${COMPILE_CTFCONVERT}
  163 NORMAL_S?=      @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}" && \
  164                 ${_MKSHECHO} ${KCOMPILE.s} && \
  165                 ${KCOMPILE.s}
  166  
  167 # link rules: 
  168 LINK_O?=        @${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}" && \
  169                 ${_MKSHECHO} ${KLINK.o} && \
  170                 ${KLINK.o}
  171 
  172 ##
  173 ## (3) libkern
  174 ##
  175 ## Set OPT_MODULAR in the port Makefile if module(7) is enabled,
  176 ## as documented in $S/lib/libkern/Makefile.inc.
  177 ##
  178 
  179 ### find out what to use for libkern
  180 .include "$S/lib/libkern/Makefile.inc"
  181 .ifndef PROF
  182 LIBKERN?=       ${KERNLIB}
  183 .else
  184 LIBKERN?=       ${KERNLIB_PROF}
  185 .endif
  186 
  187 LIBKERNLN?=     ${KERNLIBLN}
  188 
  189 ##
  190 ## (4) local objects, compile rules, and dependencies
  191 ##
  192 ## Each port should have a corresponding section with settings for
  193 ## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
  194 ##
  195 
  196 .if !defined(___USE_SUFFIX_RULES___)
  197 _MD_OBJS=       ${MD_OBJS:T}
  198 .else
  199 _MD_OBJS=       ${MD_OBJS}
  200 .endif
  201 
  202 ##
  203 ## (5) link settings
  204 ##
  205 ## TEXTADDR (or LOADADDRESS), LINKFORMAT, LINKSCRIPT, and any EXTRA_LINKFLAGS
  206 ## must be set in the port's Makefile.  The port specific definitions for
  207 ## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
  208 ## depending on the value of DEBUG.
  209 ##
  210 # load lines for config "xxx" will be emitted as:
  211 # xxx: ${SYSTEM_DEP} swapxxxx.o vers.o build_kernel
  212 
  213 SYSTEM_LIB=     ${MD_LIBS} ${LIBKERN}
  214 SYSTEM_OBJ?=    ${_MD_OBJS} ${OBJS} ${SYSTEM_LIB}
  215 SYSTEM_DEP+=    Makefile ${SYSTEM_OBJ:O}
  216 .if defined(CTFMERGE)
  217 SYSTEM_CTFMERGE= ${CTFMERGE} ${CTFMFLAGS} -o ${.TARGET} ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
  218 .else
  219 SYSTEM_CTFMERGE= ${_MKSHECHO}
  220 .endif
  221 
  222 REMOVE_SWAP=   [@]
  223 .for k in ${KERNELS}
  224 REMOVE_SWAP:=  ${REMOVE_SWAP}:Nswap${k}.o
  225 .endfor
  226 
  227 SYSTEM_LD_HEAD?=@rm -f $@
  228 SYSTEM_LD?=     ${_MKSHMSG} "   link  ${.CURDIR:T}/${.TARGET}"; \
  229                 ${_MKSHECHO}\
  230                 ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
  231                 '$${SYSTEM_OBJ:${REMOVE_SWAP}}' '$${EXTRA_OBJ}' vers.o \
  232                 ${OBJS:M*swap${.TARGET}.o}; \
  233                 ${LD} -Map ${.TARGET}.map --cref ${LINKFLAGS} -o ${.TARGET} \
  234                 ${SYSTEM_OBJ:${REMOVE_SWAP}} ${EXTRA_OBJ} vers.o \
  235                 ${OBJS:M*swap${.TARGET}.o}
  236 
  237 TEXTADDR?=      ${LOADADDRESS}                  # backwards compatibility
  238 LINKTEXT?=      ${TEXTADDR:C/.+/-Ttext &/}
  239 LINKDATA?=      ${DATAADDR:C/.+/-Tdata &/}
  240 ENTRYPOINT?=    start
  241 LINKENTRY?=     ${ENTRYPOINT:C/.+/-e &/}
  242 LINKFLAGS?=     ${LINKFORMAT} ${LINKSCRIPT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
  243                 ${EXTRA_LINKFLAGS}
  244 
  245 LINKFLAGS_DEBUG?=       -X
  246 KERNEL_CONFIG?= ${KERNEL_BUILD:T}
  247 
  248 SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/" "//;s/\\.*//' vers.c && \
  249                 ${SIZE} $@ && ${SYSTEM_CTFMERGE} && chmod 755 $@
  250 SYSTEM_LD_TAIL+= && runit() { echo $$@; $$@; }
  251 
  252 SYSTEM_LD_TAIL_DEBUG?=&& \
  253         runit mv -f $@ $@.gdb && \
  254         runit ${OBJCOPY} --only-keep-debug $@.gdb $@-${KERNEL_CONFIG}.debug && \
  255         runit ${OBJCOPY} --strip-debug -p -R .gnu_debuglink \
  256             --add-gnu-debuglink=$@-${KERNEL_CONFIG}.debug $@.gdb $@ && \
  257         runit chmod 755 $@ $@.gdb $@-${KERNEL_CONFIG}.debug
  258 
  259 LINKFLAGS_NORMAL?=      -S
  260 STRIPFLAGS?=    -g
  261 
  262 .if !empty(DEBUG:M-g*)
  263 SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
  264 LINKFLAGS+=     ${LINKFLAGS_DEBUG}
  265 EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
  266 CTFFLAGS+=      -g
  267 TARGETSFX=      .gdb
  268 .elifndef PROF
  269 LINKFLAGS+=     ${LINKFLAGS_NORMAL}
  270 .endif
  271 
  272 .if ${MKDEBUG:Uno} == "yes"
  273 # XXX: KERNEL_DIR?
  274 debuginstall: install-kernel-debug
  275 .for k in ${KERNELS}
  276 install-kernel-debug: ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug
  277 
  278 ${DESTDIR}${DEBUGDIR}/${k}-${KERNEL_CONFIG}.debug: ${k}-${KERNEL_CONFIG}.debug
  279         ${_MKTARGET_INSTALL}
  280         ${INSTALL_FILE} -o root -g bin -m 444 ${.ALLSRC} ${.TARGET}
  281 .endfor
  282 .else
  283 debuginstall:
  284 .endif
  285 
  286 SYSTEM_LD_HEAD+=        ${SYSTEM_LD_HEAD_EXTRA}
  287 SYSTEM_LD_TAIL_STAGE1=  ${SYSTEM_LD_TAIL}
  288 SYSTEM_LD_TAIL_STAGE2=  ${SYSTEM_LD_TAIL}
  289 .if defined(COPY_SYMTAB)
  290 SYSTEM_LD_TAIL_STAGE2+= && runit ${DBSYM} $@
  291 .if !empty(DEBUG:M-g)
  292 SYSTEM_LD_TAIL_STAGE2+= && runit ${DBSYM} $@.gdb
  293 .endif
  294 .endif
  295 SYSTEM_LD_TAIL_STAGE2+= ${SYSTEM_LD_TAIL_EXTRA}
  296 
  297 ##
  298 ## (6) port independent targets and dependencies: assym.h, vers.o
  299 ##
  300 
  301 .if !defined(___USE_SUFFIX_RULES___)
  302 
  303 # Generate list of *.o files to pass to ${LD}, preserving order.
  304 #       x/y/z/a.[csS] -> a.[csS]
  305 #       a.[csS] -> a.o
  306 OBJS=   ${ALLFILES:C|^.*/([^/]*\.[csS])$|\1|:C|^(.*)\.[csS]$|\1.o|}
  307 
  308 CFILES= ${ALLFILES:M*.c}
  309 SFILES= ${ALLFILES:M*.[sS]}
  310 OFILES= ${ALLFILES:M*.o}
  311 # absolute, generated (build directory), relative (under $S)
  312 _CFILES=${CFILES:M/*} ${CFILES:N/*:N*/*} ${CFILES:N/*:M*/*:C|^|$S/|}
  313 _SFILES=${SFILES:M/*} ${SFILES:N/*:N*/*} ${SFILES:N/*:M*/*:C|^|$S/|}
  314 _MD_CFILES=${MD_CFILES}
  315 _MD_SFILES=${MD_SFILES}
  316 CSRCS=  ${_MD_CFILES} ${_CFILES}
  317 SSRCS=  ${_MD_SFILES} ${_SFILES}
  318 SRCS=   ${CSRCS} ${SSRCS}
  319 
  320 .else # ___USE_SUFFIX_RULES___
  321 OBJS=   ${ALLFILES:C|\.[csS]$|.o|}
  322 SRCS=   ${ALLFILES:M*.[csS]}
  323 .endif # ___USE_SUFFIX_RULES___
  324 
  325 .if !defined(___USE_SUFFIX_RULES___)
  326 .for _s in ${_CFILES}
  327 .if !commands(${_s:T:R}.o)
  328 ${_s:T:R}.o: ${_s}
  329         ${NORMAL_C}
  330 .endif
  331 .endfor
  332 
  333 .for _s in ${_SFILES}
  334 .if !commands(${_s:T:R}.o)
  335 ${_s:T:R}.o: ${_s}
  336         ${NORMAL_S}
  337 .endif
  338 .endfor
  339 .endif # !___USE_SUFFIX_RULES___
  340 
  341 .include "${S}/conf/ldscript.mk"
  342 .include "${S}/conf/assym.mk"
  343 .include "${S}/conf/newvers.mk"
  344 .include "${S}/dev/splash/splash.mk"
  345 .include "${S}/conf/mdroot.mk"
  346 .include "${S}/conf/lint.mk"
  347 .include "${S}/conf/cscope.mk"
  348 .include "${S}/conf/gdbinit.mk"
  349 .include "${S}/conf/ssp.mk"
  350 .if "${_SKIP_DTS}" != "yes"
  351 .include "${S}/conf/dts.mk"
  352 .endif
  353 .include "${S}/conf/copts.mk"
  354 
  355 ##
  356 ## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
  357 ##                   cscope, mkid
  358 ##
  359 ## Any ports that have other stuff to be cleaned up should fill in
  360 ## EXTRA_CLEAN.  Some ports may want different settings for
  361 ## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
  362 ##
  363 
  364 ##
  365 ## clean
  366 ##
  367 
  368 .if !target(__CLEANKERNEL)
  369 __CLEANKERNEL: .USE
  370         ${_MKMSG} "${.TARGET}ing the kernel objects"
  371         rm -f ${KERNELS} *.map *.[io] *.ko *.ln [a-z]*.s *.su vers.c \
  372             eddep tags [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
  373             ${EXTRA_KERNELS} ${EXTRA_CLEAN}
  374 .endif
  375 
  376 .if !target(kernelnames)
  377 kernelnames:
  378         @echo "${KERNELS} ${EXTRA_KERNELS}"
  379 .endif
  380 
  381 .if !target(__CLEANDEPEND)
  382 __CLEANDEPEND: .USE
  383         echo .depend ${DEPS} | xargs rm -f --
  384 .endif
  385 
  386 # do not !target these, the kern and compat Makefiles augment them
  387 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
  388 clean: __CLEANKERNEL
  389 depend: .depend
  390 dependall: depend .WAIT all
  391 
  392 ##
  393 ## depend
  394 ##
  395 
  396 .if !target(.depend)
  397 MKDEP_AFLAGS?=  ${AFLAGS}
  398 MKDEP_CFLAGS?=  ${CFLAGS}
  399 .if !defined(___USE_SUFFIX_RULES___)
  400 DEPS+=  ${SRCS:T:R:S/$/.d/g}
  401 .else
  402 DEPS+=  ${SRCS:R:S/$/.d/g}
  403 .endif
  404 
  405 .if !defined(___USE_SUFFIX_RULES___)
  406 .for _s in ${SSRCS}
  407 .if !commands(${_s:T:R}.d)
  408 ${_s:T:R}.d: ${_s}
  409         ${_MKTARGET_CREATE}
  410         ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_AFLAGS} \
  411             ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
  412         mv -f ${.TARGET}.tmp ${.TARGET}
  413 .endif
  414 .endfor
  415 
  416 .for _s in ${CSRCS}
  417 .if !commands(${_s:T:R}.d)
  418 ${_s:T:R}.d: ${_s}
  419         ${_MKTARGET_CREATE}
  420         ${MKDEP} -f ${.TARGET}.tmp -- ${MKDEP_CFLAGS} \
  421             ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
  422         mv -f ${.TARGET}.tmp ${.TARGET}
  423 .endif
  424 .endfor
  425 .endif # !___USE_SUFFIX_RULES___
  426 
  427 .depend: ${DEPS:O}
  428         ${_MKTARGET_CREATE}
  429         echo "${.ALLSRC}" | ${MKDEP} -D
  430 .endif
  431 
  432 ##
  433 ## install
  434 ##
  435 
  436 # List of kernel images that will be installed into the root file system.
  437 # Some platforms may need to install more than one (e.g. a netbsd.aout file
  438 # to be loaded directly by the firmware), so this can be overridden by them.
  439 KERNIMAGES?=    netbsd
  440 
  441 .if !target(install)
  442 # The install target can be redefined by putting a
  443 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
  444 MACHINE_NAME!=  uname -n
  445 install: install-kernel-${MACHINE_NAME}
  446 .if !target(install-kernel-${MACHINE_NAME})
  447 install-kernel-${MACHINE_NAME}:
  448 .for _K in ${KERNIMAGES}
  449 .if ${KERNEL_DIR:Uno} == "yes"
  450         rm -fr ${DESTDIR}/o${_K}
  451         mv ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
  452         mkdir -p ${DESTDIR}/${_K}
  453         cp ${_K} ${DESTDIR}/${_K}/kernel
  454 .else
  455         rm -f ${DESTDIR}/o${_K}
  456         ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
  457         cp ${_K} ${DESTDIR}/n${_K}
  458         mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
  459 .endif
  460 .endfor
  461 .endif
  462 .endif
  463 
  464 ##
  465 ## the kernel
  466 ##
  467 
  468 AFLAGS+=        ${AOPTS.${.IMPSRC:T}}
  469 CFLAGS+=        ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
  470 CPPFLAGS+=      ${CPPFLAGS.${.IMPSRC:T}}
  471 CWARNFLAGS+=    ${CWARNFLAGS.${.IMPSRC:T}}
  472 
  473 .for _v in COPTS CPPFLAGS CWARNFLAGS
  474 .for _c in ${CSRCS}
  475 ${_v}.${_c:T}+=${OPT.${_c:T}:@.o.@${${_v}.${.o.}}@}
  476 .endfor
  477 .endfor
  478 
  479 .MAIN: all
  480 all: .gdbinit
  481 .for k in ${KERNELS}
  482 all: .WAIT ${k}
  483 ${k}: ${SYSTEM_DEP:O} swap${k}.o vers.o build_kernel #${MKLINT:Myes:%=lint}
  484 .endfor
  485 
  486 .if !defined(COPY_SYMTAB)
  487 build_kernel: .USE
  488         ${SYSTEM_LD_HEAD}
  489         ${SYSTEM_LD}
  490         ${SYSTEM_LD_TAIL_STAGE2}
  491 .else
  492 .for k in ${KERNELS}
  493 ${k}: $S/kern/kern_ksyms_buf.c
  494 .endfor
  495 build_kernel: .USE
  496         ${CC} ${CFLAGS} ${CPPFLAGS} \
  497             -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf.o
  498         ${SYSTEM_LD_HEAD}
  499         ${SYSTEM_LD} kern_ksyms_buf.o
  500         ${SYSTEM_LD_TAIL_STAGE1}
  501         ${CC} ${CFLAGS} ${CPPFLAGS} \
  502             -DSYMTAB_SPACE=$$(${DBSYM} -P ${.TARGET}${TARGETSFX}) \
  503             -c $S/kern/kern_ksyms_buf.c -o kern_ksyms_buf_real.o
  504         ${SYSTEM_LD_HEAD}
  505         ${SYSTEM_LD} kern_ksyms_buf_real.o
  506         ${SYSTEM_LD_TAIL_STAGE2}
  507 .endif
  508 
  509 .include <bsd.files.mk>
  510 .include <bsd.clang-analyze.mk>
  511 
  512 ##
  513 ## suffix rules
  514 ##
  515 
  516 .if defined(___USE_SUFFIX_RULES___)
  517 .SUFFIXES: .s .d
  518 .s.d:
  519         ${_MKTARGET_CREATE}
  520         ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
  521         mv -f $@.tmp $@
  522 
  523 .SUFFIXES: .S .d
  524 .S.d:
  525         ${_MKTARGET_CREATE}
  526         ${MKDEP} -f $@.tmp -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
  527         mv -f $@.tmp $@
  528 
  529 .SUFFIXES: .c .d
  530 .c.d:
  531         ${_MKTARGET_CREATE}
  532         ${MKDEP} -f $@.tmp -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${CPPFLAGS.${<:T}} $<
  533         mv -f $@.tmp $@
  534 
  535 .SUFFIXES: .c .o .go .po
  536 .c.o:
  537         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  538         @${_MKSHECHO} ${KCOMPILE.c}
  539         @${KCOMPILE.c}
  540         @${COMPILE_CTFCONVERT}
  541 .c.go:
  542         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  543         @${_MKSHECHO} ${KCOMPILE.c} -g
  544         @${KCOMPILE.c} -g
  545         @${COMPILE_CTFCONVERT}
  546 .c.po:
  547         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  548         @${_MKSHECHO} ${KCOMPILE.c} -pg
  549         @${KCOMPILE.c} -pg
  550         @${COMPILE_CTFCONVERT}
  551 
  552 .SUFFIXES: .s .o .go .po
  553 .s.o:
  554         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  555         @${_MKSHECHO} ${KCOMPILE.s}
  556         @${KCOMPILE.s}
  557 .s.go:
  558         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  559         @${_MKSHECHO} ${KCOMPILE.s} -g
  560         @${KCOMPILE.s} -g
  561 .s.po:
  562         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  563         @${_MKSHECHO} ${KCOMPILE.s} -pg
  564         @${KCOMPILE.s} -pg
  565 
  566 .S.o:
  567         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  568         @${_MKSHECHO} ${KCOMPILE.s}
  569         @${KCOMPILE.s}
  570 .S.go:
  571         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  572         @${_MKSHECHO} ${KCOMPILE.s} -g
  573         @${KCOMPILE.s} -g
  574 .S.po:
  575         @${_MKSHMSG} "compile  ${.CURDIR:T}/${.TARGET}"
  576         @${_MKSHECHO} ${KCOMPILE.s} -pg
  577         @${KCOMPILE.s} -pg
  578 .endif # ___USE_SUFFIX_RULES___
  579 
  580 ##
  581 ## the end
  582 ##

Cache object: 42dd3a13ad1a7b6413b67fcee6695f0c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.