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

Cache object: 2900d75528f62267946a4db8e6598362


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