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

Cache object: 83b16bc88c95386d078d6f9e7f9d6367


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