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

Cache object: 8f4bb65c6c1438aed34ac5a2afafac94


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