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

Cache object: 2ffbd5078c2a150bf7510dee5481601f


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