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 # 
    2 # This Makefile covers the bottom part of the MI build instructions
    3 #
    4 
    5 .PHONY: all modules
    6 
    7 all: ${KERNEL}.stripped
    8 
    9 _MACHINE_FWD=   ${.OBJDIR}
   10 .include "$S/conf/kern.fwd.mk"
   11 .include "$S/conf/kern.paths.mk"
   12 
   13 depend kernel-depend modules-depend: ${FORWARD_HEADERS_COOKIE}
   14 
   15 depend: kernel-depend
   16 clean:  kernel-clean
   17 cleandepend:  kernel-cleandepend
   18 tags:  kernel-tags
   19 install: kernel-install
   20 reinstall: kernel-reinstall
   21 
   22 # Often developers just want the kernel, don't let
   23 # -j builds leak into the modules until the kernel is done.
   24 #
   25 .ORDER: ${KERNEL}.stripped modules
   26 
   27 ${KERNEL}.stripped: ${FULLKERNEL}
   28         ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL}.stripped
   29 
   30 ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
   31         @rm -f ${.TARGET}
   32         @echo linking ${.TARGET}
   33         ${SYSTEM_LD}
   34         ${SYSTEM_LD_TAIL}
   35 
   36 .if !exists(.depend)
   37 ${SYSTEM_OBJS}: ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/}
   38 .endif
   39 
   40 .for mfile in ${MFILES}
   41 ${mfile:T:S/.m$/.h/}: ${mfile}
   42         awk -f $S/tools/makeobjops.awk -- -h ${mfile}
   43 .endfor
   44 
   45 kernel-clean:
   46         rm -f *.o *.so *.So *.ko *.s eddep errs \
   47               ${KERNEL} ${KERNEL}.debug ${KERNEL}.nodebug ${KERNEL}.stripped \
   48               linterrs makelinks setdef[01].c setdefs.h tags \
   49               vers.c vnode_if.c vnode_if.h \
   50               ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
   51               ${CLEAN}
   52 
   53 #lint: /tmp
   54 #       @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \
   55 #         $S/platform/$P/$M/Locore.c ${CFILES} ioconf.c | \
   56 #           grep -v 'struct/union .* never defined' | \
   57 #           grep -v 'possible pointer alignment problem'
   58 
   59 locore.o: $S/platform/$P/$M/locore.s assym.s
   60         ${NORMAL_S}
   61 
   62 # This is a hack.  BFD "optimizes" away dynamic mode if there are no
   63 # dynamic references.  We could probably do a '-Bforcedynamic' mode like
   64 # in the a.out ld.  For now, this works.
   65 hack.So: Makefile
   66         touch hack.c
   67         ${CC} -shared -nostdlib hack.c -o hack.So
   68         rm -f hack.c
   69 
   70 # this rule stops ./assym.s in .depend from causing problems
   71 ./assym.s: assym.s
   72 
   73 assym.s: $S/kern/genassym.sh genassym.o
   74         sh $S/kern/genassym.sh genassym.o > ${.TARGET}
   75 
   76 genassym.o: $S/platform/$P/$M/genassym.c ${FORWARD_HEADERS_COOKIE} \
   77             ${MFILES:T:S/.m$/.h/}
   78         ${CC} -c ${CFLAGS:N-fno-common:N-mcmodel=small} ${WERROR} \
   79         $S/platform/$P/$M/genassym.c
   80 
   81 ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
   82 
   83 # The argument list can be very long, use make -V and xargs to
   84 # pass it to mkdep.
   85 kernel-depend: assym.s ${BEFORE_DEPEND} \
   86             ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
   87             ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/}
   88         rm -f .newdep
   89         ${MAKE} -V CFILES -V SYSTEM_CFILES -V GEN_CFILES | xargs \
   90                 mkdep -a -f .newdep ${CFLAGS}
   91         ${MAKE} -V SFILES -V SYSTEM_SFILES | xargs \
   92             env MKDEP_CPP="${CC} -E" mkdep -a -f .newdep ${ASM_CFLAGS}
   93         rm -f .depend
   94         mv -f .newdep .depend
   95 
   96 kernel-cleandepend:
   97         rm -f .depend
   98 
   99 links:
  100         egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
  101           sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
  102         ${MAKE} -V CFILES | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
  103           sort -u | comm -23 - dontlink | \
  104           sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
  105         sh makelinks && rm -f dontlink
  106 
  107 kernel-tags:
  108         @[ -f .depend ] || { echo "you must make depend first"; /usr/bin/false; }
  109         sh $S/conf/systags.sh
  110         rm -f tags1
  111         sed -e 's,      ../,    ,' tags > tags1
  112 
  113 # Note: when moving the existing kernel to .old, it is by default stripped
  114 # so we do not have two full debug environments sitting in / eating up space.
  115 #
  116 # Also note the .old might be a file and not a directory, so we have to
  117 # remove it first.
  118 #
  119 kernel-install: kernel-installable
  120         @if [ ! -f ${SELECTEDKERNEL} ]; then                    \
  121                 echo "You must build a kernel first.";          \
  122                 /usr/bin/false;                                 \
  123         fi
  124         @if [ -f ${DESTDIR}${DESTKERNDIR}.old ]; then           \
  125                 rm -f ${DESTDIR}${DESTKERNDIR}.old;             \
  126         fi
  127         mkdir -p ${DESTDIR}${DESTKERNDIR}.old
  128 .if exists(${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME})
  129 .ifndef NOFSCHG
  130         -chflags noschg ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
  131 .endif
  132 .    ifdef NO_KERNEL_OLD_STRIP
  133         cp -p ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}.old/${DESTKERNNAME}
  134 .    else
  135         ${OBJCOPY} --strip-debug ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}.old/${DESTKERNNAME}
  136 .    endif
  137 .endif
  138         @if [ -f ${DESTDIR}${DESTKERNDIR} ]; then               \
  139                 chflags noschg ${DESTDIR}${DESTKERNDIR};        \
  140                 rm -f ${DESTDIR}${DESTKERNDIR};                 \
  141         fi
  142         mkdir -p ${DESTDIR}${DESTKERNDIR}
  143 .ifdef NOFSCHG
  144         ${INSTALL} -m 555 -o root -g wheel \
  145                 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
  146 .else
  147         ${INSTALL} -m 555 -o root -g wheel -fschg \
  148                 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
  149 .endif
  150 
  151 kernel-reinstall: kernel-installable
  152         mkdir -p ${DESTDIR}${DESTKERNDIR}
  153 .ifdef NOFSCHG
  154         ${INSTALL} -m 555 -o root -g wheel \
  155                 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
  156 .else
  157         ${INSTALL} -m 555 -o root -g wheel -fschg \
  158                 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
  159 .endif
  160 
  161 kernel-installable:
  162         @if [ -f ${DESTDIR}/${DESTKERNNAME} ]; then \
  163                 echo "You need to make buildworld, installworld, and upgrade"; \
  164                 echo "before you can install a new kernel, because the"; \
  165                 echo "kernel and modules have moved to /boot"; \
  166                 /usr/bin/false; \
  167         fi
  168 # Skip this step for vkernels
  169 .if ${MACHINE_PLATFORM} != vkernel && ${MACHINE_PLATFORM} != vkernel64
  170         @if [ ! -f ${DESTDIR}/boot/dloader.rc ]; then \
  171                 echo "You need to install a new ${DESTDIR}/boot before you"; \
  172                 echo "can install a new kernel, kernels are now installed"; \
  173                 echo "into a subdirectory along with their modules."; \
  174                 echo "You can do this with a buildworld / installworld"; \
  175                 echo "sequence."; \
  176                 /usr/bin/false; \
  177         fi
  178 .endif
  179 
  180 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES)
  181 all:    modules
  182 depend: modules-depend
  183 clean:  modules-clean
  184 cleandepend:  modules-cleandepend
  185 cleandir:  modules-cleandir
  186 tags:  modules-tags
  187 install: modules-install
  188 reinstall: modules-reinstall
  189 .endif
  190 
  191 modules:
  192         @mkdir -p ${.OBJDIR}
  193         cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \
  194             env ${MKMODULESENV} ${MAKE} -f Makefile.modules all
  195 
  196 modules-depend:
  197         @mkdir -p ${.OBJDIR}
  198         cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \
  199             env ${MKMODULESENV} ${MAKE} -f Makefile.modules depend
  200 
  201 modules-clean:
  202         cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules clean
  203 
  204 modules-cleandepend:
  205         cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandepend
  206 
  207 # XXX huh?
  208 #modules-clobber:       modules-clean
  209 #       rm -rf ${MKMODULESENV}
  210 
  211 modules-cleandir:
  212         cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandir
  213 
  214 modules-tags:
  215         cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules tags
  216 
  217 # Note: when moving the existing modules to .old, they are by default stripped
  218 # so we do not have two full debug environments sitting in / eating up space.
  219 #
  220 # We may have to remove deprecated kernel.old files before we can create
  221 # the kernel.old directory.
  222 #
  223 modules-install: kernel-installable
  224 .if !defined(NO_MODULES_OLD)
  225 .  ifdef NO_KERNEL_OLD_STRIP
  226         set -- ${DESTDIR}${DESTKERNDIR}/*.ko;                   \
  227         if [ -f "$$1" ]; then                                   \
  228                 if [ -f ${DESTDIR}${DESTKERNDIR}.old ]; then    \
  229                     rm -f ${DESTDIR}${DESTKERNDIR}.old;         \
  230                 fi;                                             \
  231                 mkdir -p ${DESTDIR}${DESTKERNDIR}.old;          \
  232                 for file; do                                    \
  233                 cp -p $$file ${DESTDIR}${DESTKERNDIR}.old;      \
  234                 done;                                           \
  235         fi
  236 .  else
  237         set -- ${DESTDIR}${DESTKERNDIR}/*.ko;                   \
  238         if [ -f "$$1" ]; then                                   \
  239                 if [ -f ${DESTDIR}${DESTKERNDIR}.old ]; then    \
  240                     rm -f ${DESTDIR}${DESTKERNDIR}.old;         \
  241                 fi;                                             \
  242                 mkdir -p ${DESTDIR}${DESTKERNDIR}.old;          \
  243                 for file; do                                    \
  244                 ${OBJCOPY} --strip-debug $$file ${DESTDIR}${DESTKERNDIR}.old/$${file##*/}; \
  245                 done;                                           \
  246         fi
  247 .  endif
  248         if [ -f ${DESTDIR}${DESTKERNDIR}/initrd.img ]; then     \
  249                 cp -p ${DESTDIR}${DESTKERNDIR}/initrd.img ${DESTDIR}${DESTKERNDIR}.old; \
  250         fi
  251 .endif
  252 .if exists(${DESTDIR}/${OLDMODULESDIR})
  253         rm -rf ${DESTDIR}/${OLDMODULESDIR} # remove deprecated
  254 .endif
  255         mkdir -p ${DESTDIR}${DESTKERNDIR} # Ensure that the modules directory exists!
  256         cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
  257 
  258 modules-reinstall:
  259         mkdir -p ${DESTDIR}/${DESTKERNDIR} # Ensure that the modules directory exists!
  260         cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
  261 
  262 config.o:
  263         ${NORMAL_C} ${WERROR}
  264 
  265 ioconf.o:
  266         ${NORMAL_C} ${WERROR}
  267 
  268 vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
  269         sh $S/conf/newvers.sh $S/..
  270 
  271 # XXX strictly, everything depends on Makefile because changes to ${PROF}
  272 # only appear there, but we don't handle that.
  273 vers.o:
  274         ${NORMAL_C} ${WERROR}
  275 
  276 .include "$S/conf/bsd.kern.mk"

Cache object: e12924931869136e7323cdb1f7116185


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