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

Cache object: 13552de48e57c50d1f87c0b66ccbfd8a


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