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/kern.post.mk

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 # $FreeBSD: releng/6.0/sys/conf/kern.post.mk 147155 2005-06-09 05:38:18Z imp $
    2 
    3 # Part of a unified Makefile for building kernels.  This part includes all
    4 # the definitions that need to be after all the % directives except %RULES
    5 # and ones that act like they are part of %RULES.
    6 #
    7 # Most make variables should not be defined in this file.  Instead, they
    8 # should be defined in the kern.pre.mk so that port makefiles can
    9 # override or augment them.
   10 
   11 # In case the config had a makeoptions DESTDIR...
   12 .if defined(DESTDIR)
   13 MKMODULESENV+=  DESTDIR="${DESTDIR}"
   14 .endif
   15 MKMODULESENV+=  KERNBUILDDIR="${.CURDIR}"
   16 
   17 .MAIN: all
   18 
   19 .for target in all clean cleandepend cleandir clobber depend install \
   20     obj reinstall tags
   21 ${target}: kernel-${target}
   22 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
   23 ${target}: modules-${target}
   24 modules-${target}:
   25         cd $S/modules; ${MKMODULESENV} ${MAKE} \
   26             ${target:S/^reinstall$/install/:S/^clobber$/cleandir/}
   27 .endif
   28 .endfor
   29 
   30 # Handle out of tree ports 
   31 .if !defined(NO_MODULES) && defined(PORTS_MODULES)
   32 .for _dir in ${.CURDIR}/../../..
   33 .if !defined(SYSDIR) && exists(${_dir}/kern/)
   34 SYSDIR= ${_dir}
   35 .endif
   36 .endfor
   37 PORTSMODULESENV=SYSDIR=${SYSDIR}
   38 .for __target in all install reinstall clean
   39 ${__target}: ports-${__target}
   40 ports-${__target}:
   41 .for __i in ${PORTS_MODULES}
   42         cd $${PORTSDIR:-/usr/ports}/${__i}; ${PORTSMODULESENV} ${MAKE} -B ${__target:C/install/deinstall reinstall/:C/reinstall/deinstall reinstall/}
   43 .endfor
   44 .endfor
   45 .endif
   46 
   47 .ORDER: kernel-install modules-install
   48 
   49 kernel-all: ${KERNEL_KO}
   50 
   51 kernel-cleandir: kernel-clean
   52 
   53 kernel-clobber:
   54         find . -maxdepth 1 ! -type d ! -name version -delete
   55 
   56 kernel-obj:
   57 
   58 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules)
   59 modules: modules-all
   60 
   61 .if !defined(NO_MODULES_OBJ)
   62 modules-all modules-depend: modules-obj
   63 .endif
   64 .endif
   65 
   66 .if !defined(DEBUG)
   67 FULLKERNEL=     ${KERNEL_KO}
   68 .else
   69 FULLKERNEL=     ${KERNEL_KO}.debug
   70 ${KERNEL_KO}: ${FULLKERNEL}
   71         ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO}
   72 install.debug reinstall.debug: gdbinit
   73         cd ${.CURDIR}; ${MAKE} -DINSTALL_DEBUG ${.TARGET:R}
   74 
   75 # Install gdbinit files for kernel debugging.
   76 gdbinit:
   77         grep -v '# XXX' ${S}/../tools/debugscripts/dot.gdbinit | \
   78             sed "s:MODPATH:${.OBJDIR}/modules:" > .gdbinit
   79         cp ${S}/../tools/debugscripts/gdbinit.kernel ${.CURDIR}
   80 .if exists(${S}/../tools/debugscripts/gdbinit.${MACHINE_ARCH})
   81         cp ${S}/../tools/debugscripts/gdbinit.${MACHINE_ARCH} \
   82             ${.CURDIR}/gdbinit.machine
   83 .endif
   84 .endif
   85 
   86 ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
   87         @rm -f ${.TARGET}
   88         @echo linking ${.TARGET}
   89         ${SYSTEM_LD}
   90 .if !defined(DEBUG)
   91         ${OBJCOPY} --strip-debug ${.TARGET}
   92 .endif
   93         ${SYSTEM_LD_TAIL}
   94 
   95 .if !exists(${.OBJDIR}/.depend)
   96 ${SYSTEM_OBJS}: assym.s vnode_if.h ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/}
   97 .endif
   98 
   99 LNFILES=        ${CFILES:T:S/.c$/.ln/}
  100 
  101 .for mfile in ${MFILES}
  102 # XXX the low quality .m.o rules gnerated by config are normally used
  103 # instead of the .m.c rules here.
  104 ${mfile:T:S/.m$/.c/}: ${mfile}
  105         ${AWK} -f $S/tools/makeobjops.awk ${mfile} -c
  106 ${mfile:T:S/.m$/.h/}: ${mfile}
  107         ${AWK} -f $S/tools/makeobjops.awk ${mfile} -h
  108 .endfor
  109 
  110 kernel-clean:
  111         rm -f *.o *.so *.So *.ko *.s eddep errs \
  112             ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks tags vers.c \
  113             vnode_if.c vnode_if.h vnode_if_newproto.h vnode_if_typedef.h \
  114             ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
  115             ${CLEAN}
  116 
  117 lint: ${LNFILES}
  118         ${LINT} ${LINTKERNFLAGS} ${CFLAGS:M-[DILU]*} ${.ALLSRC} 2>&1 | \
  119             tee -a linterrs
  120 
  121 # This is a hack.  BFD "optimizes" away dynamic mode if there are no
  122 # dynamic references.  We could probably do a '-Bforcedynamic' mode like
  123 # in the a.out ld.  For now, this works.
  124 HACK_EXTRA_FLAGS?= -shared
  125 hack.So: Makefile
  126         touch hack.c
  127         ${CC} ${HACK_EXTRA_FLAGS} -nostdlib hack.c -o hack.So
  128         rm -f hack.c
  129 
  130 # This rule stops ./assym.s in .depend from causing problems.
  131 ./assym.s: assym.s
  132 
  133 assym.s: $S/kern/genassym.sh genassym.o
  134         NM='${NM}' sh $S/kern/genassym.sh genassym.o > ${.TARGET}
  135 
  136 genassym.o: $S/$M/$M/genassym.c
  137         ${CC} -c ${CFLAGS:N-fno-common} $S/$M/$M/genassym.c
  138 
  139 ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
  140 
  141 kernel-depend: .depend
  142 # The argument list can be very long, so use make -V and xargs to
  143 # pass it to mkdep.
  144 .depend: assym.s vnode_if.h ${BEFORE_DEPEND} ${CFILES} \
  145             ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
  146             ${MFILES:T:S/.m$/.h/}
  147         rm -f .newdep
  148         ${MAKE} -V CFILES -V SYSTEM_CFILES -V GEN_CFILES | \
  149             MKDEP_CPP="${CC} -E" CC="${CC}" xargs mkdep -a -f .newdep ${CFLAGS}
  150         ${MAKE} -V SFILES | \
  151             MKDEP_CPP="${CC} -E" xargs mkdep -a -f .newdep ${ASM_CFLAGS}
  152         rm -f .depend
  153         mv .newdep .depend
  154 
  155 kernel-cleandepend:
  156         rm -f .depend
  157 
  158 links:
  159         egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
  160             sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
  161         ${MAKE} -V CFILES | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
  162             sort -u | comm -23 - dontlink | \
  163             sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
  164         sh makelinks; rm -f dontlink
  165 
  166 kernel-tags:
  167         @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
  168         sh $S/conf/systags.sh
  169         rm -f tags1
  170         sed -e 's,      ../,    ,' tags > tags1
  171 
  172 .if ${MACHINE_ARCH} != "ia64"
  173 .if exists(${DESTDIR}/boot)
  174 kernel-install-check:
  175         @if [ ! -f ${DESTDIR}/boot/device.hints ] ; then \
  176                 echo "You must set up a ${DESTDIR}/boot/device.hints file first." ; \
  177                 exit 1 ; \
  178         fi
  179         @if [ x"`grep device.hints ${DESTDIR}/boot/defaults/loader.conf ${DESTDIR}/boot/loader.conf`" = "x" ]; then \
  180                 echo "You must activate /boot/device.hints in loader.conf." ; \
  181                 exit 1 ; \
  182         fi
  183 
  184 kernel-install: kernel-install-check
  185 .endif
  186 .endif
  187 
  188 kernel-install:
  189         @if [ ! -f ${FULLKERNEL} ] ; then \
  190                 echo "You must build a kernel first." ; \
  191                 exit 1 ; \
  192         fi
  193 .if exists(${DESTDIR}${KODIR})
  194         -thiskernel=`sysctl -n kern.bootfile` ; \
  195         if [ ! "`dirname "$$thiskernel"`" -ef ${DESTDIR}${KODIR} ] ; then \
  196                 chflags -R noschg ${DESTDIR}${KODIR} ; \
  197                 rm -rf ${DESTDIR}${KODIR} ; \
  198         else \
  199                 if [ -d ${DESTDIR}${KODIR}.old ] ; then \
  200                         chflags -R noschg ${DESTDIR}${KODIR}.old ; \
  201                         rm -rf ${DESTDIR}${KODIR}.old ; \
  202                 fi ; \
  203                 mv ${DESTDIR}${KODIR} ${DESTDIR}${KODIR}.old ; \
  204                 sysctl kern.bootfile=${DESTDIR}${KODIR}.old/"`basename "$$thiskernel"`" ; \
  205         fi
  206 .endif
  207         mkdir -p ${DESTDIR}${KODIR}
  208 .if defined(DEBUG) && defined(INSTALL_DEBUG)
  209         ${INSTALL} -p -m 555 -o root -g wheel ${FULLKERNEL} ${DESTDIR}${KODIR}
  210 .else
  211         ${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR}
  212 .endif
  213 
  214 kernel-reinstall:
  215         @-chflags -R noschg ${DESTDIR}${KODIR}
  216 .if defined(DEBUG) && defined(INSTALL_DEBUG)
  217         ${INSTALL} -p -m 555 -o root -g wheel ${FULLKERNEL} ${DESTDIR}${KODIR}
  218 .else
  219         ${INSTALL} -p -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR}
  220 .endif
  221 
  222 config.o env.o hints.o vers.o vnode_if.o:
  223         ${NORMAL_C}
  224 
  225 config.ln env.ln hints.ln vers.ln vnode_if.ln:
  226         ${NORMAL_LINT}
  227 
  228 vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
  229         MAKE=${MAKE} sh $S/conf/newvers.sh ${KERN_IDENT}
  230 
  231 vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src
  232         ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -c
  233 
  234 vnode_if.h: $S/tools/vnode_if.awk $S/kern/vnode_if.src
  235         ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -h
  236         ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -p
  237         ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -q
  238 
  239 # XXX strictly, everything depends on Makefile because changes to ${PROF}
  240 # only appear there, but we don't handle that.
  241 
  242 .include "kern.mk"

Cache object: abb3630e2dc4848b41179f69a2a529b1


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