1 # $DragonFly: src/sys/conf/kern.post.mk,v 1.3 2006/11/07 06:43:22 dillon Exp $
3 # This Makefile covers the bottom part of the MI build instructions
8 all: ${KERNEL}.stripped
12 cleandepend: kernel-cleandepend
14 install: kernel-install
15 reinstall: kernel-reinstall
17 ${KERNEL}.stripped: ${FULLKERNEL}
18 ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL}.stripped
20 ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
22 @echo linking ${.TARGET}
27 ${SYSTEM_OBJS}: ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/}
30 .for mfile in ${MFILES}
31 ${mfile:T:S/.m$/.h/}: ${mfile}
32 awk -f $S/tools/makeobjops.awk -- -h ${mfile}
36 rm -f *.o *.so *.So *.ko *.s eddep errs \
37 ${KERNEL} ${KERNEL}.debug ${KERNEL}.nodebug ${KERNEL}.stripped \
38 linterrs makelinks setdef[01].c setdefs.h tags \
39 vers.c vnode_if.c vnode_if.h \
40 ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
44 # @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \
45 # $S/machine/$P/$M/Locore.c ${CFILES} ioconf.c | \
46 # grep -v 'struct/union .* never defined' | \
47 # grep -v 'possible pointer alignment problem'
49 locore.o: $S/machine/$P/$M/locore.s assym.s
52 # This is a hack. BFD "optimizes" away dynamic mode if there are no
53 # dynamic references. We could probably do a '-Bforcedynamic' mode like
54 # in the a.out ld. For now, this works.
57 ${CC} -shared -nostdlib hack.c -o hack.So
60 # this rule stops ./assym.s in .depend from causing problems
63 assym.s: $S/kern/genassym.sh genassym.o
64 sh $S/kern/genassym.sh genassym.o > ${.TARGET}
66 genassym.o: $S/machine/$P/$M/genassym.c
67 ${CC} -c ${CFLAGS:N-fno-common} $S/machine/$P/$M/genassym.c
69 ${SYSTEM_OBJS} genassym.o vers.o: opt_global.h
71 # The argument list can be very long, use make -V and xargs to
73 kernel-depend: assym.s ${BEFORE_DEPEND} \
74 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
75 ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/}
77 ${MAKE} -V CFILES -V SYSTEM_CFILES -V GEN_CFILES | xargs \
78 mkdep -a -f .newdep ${CFLAGS}
79 ${MAKE} -V SFILES -V SYSTEM_SFILES | xargs \
80 env MKDEP_CPP="${CC} -E" mkdep -a -f .newdep ${ASM_CFLAGS}
88 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
89 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
90 ${MAKE} -V CFILES | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
91 sort -u | comm -23 - dontlink | \
92 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
93 sh makelinks && rm -f dontlink
96 @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
99 sed -e 's, ../, ,' tags > tags1
101 # Note: when moving the existing kernel to .old, make sure it is stripped
102 # so we do not have two full debug environments sitting in / eating up space.
105 @if [ ! -f ${SELECTEDKERNEL} ] ; then \
106 echo "You must build a kernel first." ; \
110 .if exists(${DESTDIR}/${KERNEL})
111 ${OBJCOPY} --strip-debug ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old
113 ${INSTALL} -m 555 -o root -g wheel \
114 ${SELECTEDKERNEL} ${DESTDIR}/${KERNEL}
116 .if exists(${DESTDIR}/${KERNEL})
117 -chflags noschg ${DESTDIR}/${KERNEL}
118 ${OBJCOPY} --strip-debug ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old
120 ${INSTALL} -m 555 -o root -g wheel -fschg \
121 ${SELECTEDKERNEL} ${DESTDIR}/${KERNEL}
126 ${INSTALL} -m 555 -o root -g wheel \
127 ${SELECTEDKERNEL} ${DESTDIR}/${KERNEL}
129 ${INSTALL} -m 555 -o root -g wheel -fschg \
130 ${SELECTEDKERNEL} ${DESTDIR}/${KERNEL}
133 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES)
135 depend: modules-depend
137 cleandepend: modules-cleandepend
138 cleandir: modules-cleandir
140 install: modules-install
141 reinstall: modules-reinstall
146 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \
147 env ${MKMODULESENV} ${MAKE} -f Makefile.modules all
151 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \
152 env ${MKMODULESENV} ${MAKE} -f Makefile.modules depend
155 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules clean
158 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandepend
161 #modules-clobber: modules-clean
162 # rm -rf ${MKMODULESENV}
165 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandir
168 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules tags
170 # Note: when moving the existing modules to .old, make sure they are stripped
171 # so we do not have two full debug environments sitting in / eating up space.
174 .if !defined(NO_MODULES_OLD)
175 set -- ${DESTDIR}/modules/*; \
176 if [ -f "$$1" ]; then \
177 mkdir -p ${DESTDIR}/modules.old; \
179 ${OBJCOPY} --strip-debug $$file ${DESTDIR}/modules.old/$${file##*/}; \
183 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
186 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
194 vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP}
195 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
197 # XXX strictly, everything depends on Makefile because changes to ${PROF}
198 # only appear there, but we don't handle that.
202 #vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src
203 # awk -f $S/tools/vnode_if.awk -- -c $S/kern/vnode_if.src
205 #vnode_if.h: $S/tools/vnode_if.awk $S/kern/vnode_if.src
206 # awk -f $S/tools/vnode_if.awk -- -h $S/kern/vnode_if.src
211 .include "$S/conf/bsd.kern.mk"