1 # $DragonFly: src/sys/conf/kern.post.mk,v 1.10 2007/02/22 21:02:49 corecode Exp $
3 # This Makefile covers the bottom part of the MI build instructions
8 all: ${KERNEL}.stripped
10 _MACHINE_FWD
= ${.OBJDIR
}
11 .
include "$S/conf/kern.fwd.mk"
13 depend kernel-depend modules-depend
: ${FORWARD_HEADERS_COOKIE}
17 cleandepend
: kernel-cleandepend
19 install: kernel-install
20 reinstall
: kernel-reinstall
22 ${KERNEL}.stripped
: ${FULLKERNEL}
23 ${OBJCOPY} --strip-debug
${FULLKERNEL} ${KERNEL}.stripped
25 ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
27 @echo linking
${.TARGET
}
32 ${SYSTEM_OBJS}: ${BEFORE_DEPEND
:M
*.h
} ${MFILES
:T
:S
/.m
$/.h
/}
35 .for mfile in
${MFILES}
36 ${mfile
:T
:S
/.m
$/.h
/}: ${mfile}
37 awk
-f
$S/tools
/makeobjops.awk
-- -h
${mfile}
41 rm -f
*.o
*.so
*.So
*.ko
*.s eddep errs \
42 ${KERNEL} ${KERNEL}.debug
${KERNEL}.nodebug
${KERNEL}.stripped \
43 linterrs makelinks setdef
[01].c setdefs.h
tags \
44 vers.c vnode_if.c vnode_if.h \
45 ${MFILES
:T
:S
/.m
$/.c
/} ${MFILES
:T
:S
/.m
$/.h
/} \
49 # @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \
50 # $S/platform/$P/$M/Locore.c ${CFILES} ioconf.c | \
51 # grep -v 'struct/union .* never defined' | \
52 # grep -v 'possible pointer alignment problem'
54 locore.o
: $S/platform
/$P/$M/locore.s assym.s
57 # This is a hack. BFD "optimizes" away dynamic mode if there are no
58 # dynamic references. We could probably do a '-Bforcedynamic' mode like
59 # in the a.out ld. For now, this works.
62 ${CC} -shared
-nostdlib hack.c
-o hack.So
65 # this rule stops ./assym.s in .depend from causing problems
68 assym.s
: $S/kern
/genassym.sh genassym.o
69 sh
$S/kern
/genassym.sh genassym.o
> ${.TARGET
}
71 genassym.o
: $S/platform
/$P/$M/genassym.c
${FORWARD_HEADERS_COOKIE}
72 ${CC} -c
${CFLAGS
:N-fno-common
} $S/platform
/$P/$M/genassym.c
74 ${SYSTEM_OBJS} genassym.o vers.o
: opt_global.h
76 # The argument list can be very long, use make -V and xargs to
78 kernel-depend
: assym.s
${BEFORE_DEPEND} \
79 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
80 ${SYSTEM_SFILES} ${MFILES
:T
:S
/.m
$/.h
/}
82 ${MAKE} -V CFILES
-V SYSTEM_CFILES
-V GEN_CFILES | xargs \
83 mkdep
-a
-f .newdep
${CFLAGS}
84 ${MAKE} -V SFILES
-V SYSTEM_SFILES | xargs \
85 env MKDEP_CPP
="${CC} -E" mkdep
-a
-f .newdep
${ASM_CFLAGS}
93 egrep
'#if' ${CFILES} | sed
-f
$S/conf
/defines | \
94 sed
-e
's/:.*//' -e
's/\.c/.o/' |
sort -u
> dontlink
95 ${MAKE} -V CFILES | tr
-s
' ' '\12' | sed
's/\.c/.o/' | \
96 sort -u | comm
-23 - dontlink | \
97 sed
's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
98 sh makelinks
&& rm -f dontlink
101 @
[ -f .depend
] ||
{ echo
"you must make depend first"; exit
1; }
102 sh
$S/conf
/systags.sh
104 sed
-e
's, ../, ,' tags > tags1
106 # Note: when moving the existing kernel to .old, it is by default stripped
107 # so we do not have two full debug environments sitting in / eating up space.
110 @if
[ ! -f
${SELECTEDKERNEL} ] ; then \
111 echo
"You must build a kernel first." ; \
115 . if exists
(${DESTDIR}/${DESTKERNNAME})
116 .
ifdef NO_KERNEL_OLD_STRIP
117 cp
-p
${DESTDIR}/${DESTKERNNAME} ${DESTDIR}/${DESTKERNNAME}.old
119 ${OBJCOPY} --strip-debug
${DESTDIR}/${DESTKERNNAME} ${DESTDIR}/${DESTKERNNAME}.old
122 ${INSTALL} -m
555 -o root
-g wheel \
123 ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}
125 . if exists
(${DESTDIR}/${DESTKERNNAME})
126 -chflags noschg
${DESTDIR}/${DESTKERNNAME}
127 .
ifdef NO_KERNEL_OLD_STRIP
128 cp
-p
${DESTDIR}/${DESTKERNNAME} ${DESTDIR}/${DESTKERNNAME}.old
130 ${OBJCOPY} --strip-debug
${DESTDIR}/${DESTKERNNAME} ${DESTDIR}/${DESTKERNNAME}.old
133 ${INSTALL} -m
555 -o root
-g wheel
-fschg \
134 ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}
139 ${INSTALL} -m
555 -o root
-g wheel \
140 ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}
142 ${INSTALL} -m
555 -o root
-g wheel
-fschg \
143 ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}
146 .if
!defined
(MODULES_WITH_WORLD
) && !defined
(NO_MODULES
)
148 depend
: modules-depend
150 cleandepend
: modules-cleandepend
151 cleandir
: modules-cleandir
153 install: modules-install
154 reinstall
: modules-reinstall
159 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules obj
; \
160 env
${MKMODULESENV} ${MAKE} -f Makefile.modules
all
164 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules obj
; \
165 env
${MKMODULESENV} ${MAKE} -f Makefile.modules depend
168 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
clean
171 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules cleandepend
174 #modules-clobber: modules-clean
175 # rm -rf ${MKMODULESENV}
178 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules cleandir
181 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
tags
183 # Note: when moving the existing modules to .old, they are by default stripped
184 # so we do not have two full debug environments sitting in / eating up space.
187 .if
!defined
(NO_MODULES_OLD
)
188 .
ifdef NO_KERNEL_OLD_STRIP
189 set
-- ${DESTDIR}/modules
/*; \
190 if
[ -f
"$$1" ]; then \
191 mkdir
-p
${DESTDIR}/modules.old
; \
193 cp
-p
$$file ${DESTDIR}/modules.old
; \
197 set
-- ${DESTDIR}/modules
/*; \
198 if
[ -f
"$$1" ]; then \
199 mkdir
-p
${DESTDIR}/modules.old
; \
201 ${OBJCOPY} --strip-debug
$$file ${DESTDIR}/modules.old
/$${file
##*/}; \
206 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
install
209 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
install
217 vers.c
: $S/conf
/newvers.sh
$S/sys
/param.h
${SYSTEM_DEP}
218 sh
$S/conf
/newvers.sh
${KERN_IDENT} ${IDENT}
220 # XXX strictly, everything depends on Makefile because changes to ${PROF}
221 # only appear there, but we don't handle that.
225 #vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src
226 # awk -f $S/tools/vnode_if.awk -- -c $S/kern/vnode_if.src
228 #vnode_if.h: $S/tools/vnode_if.awk $S/kern/vnode_if.src
229 # awk -f $S/tools/vnode_if.awk -- -h $S/kern/vnode_if.src
234 .
include "$S/conf/bsd.kern.mk"