1 # $DragonFly: src/sys/conf/kern.post.mk,v 1.15 2008/09/15 20:09:03 thomas 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.
109 kernel-install
: kernel-installable
110 @if
[ ! -f
${SELECTEDKERNEL} ] ; then \
111 echo
"You must build a kernel first." ; \
114 . if exists
(${DESTDIR}/boot
/${DESTKERNNAME})
116 -chflags noschg
${DESTDIR}/boot
/${DESTKERNNAME}
118 .
ifdef NO_KERNEL_OLD_STRIP
119 cp
-p
${DESTDIR}/boot
/${DESTKERNNAME} ${DESTDIR}/boot
/${DESTKERNNAME}.old
121 ${OBJCOPY} --strip-debug
${DESTDIR}/boot
/${DESTKERNNAME} ${DESTDIR}/boot
/${DESTKERNNAME}.old
125 ${INSTALL} -m
555 -o root
-g wheel \
126 ${SELECTEDKERNEL} ${DESTDIR}/boot
/${DESTKERNNAME}
128 ${INSTALL} -m
555 -o root
-g wheel
-fschg \
129 ${SELECTEDKERNEL} ${DESTDIR}/boot
/${DESTKERNNAME}
132 kernel-reinstall
: kernel-installable
134 ${INSTALL} -m
555 -o root
-g wheel \
135 ${SELECTEDKERNEL} ${DESTDIR}/boot
/${DESTKERNNAME}
137 ${INSTALL} -m
555 -o root
-g wheel
-fschg \
138 ${SELECTEDKERNEL} ${DESTDIR}/boot
/${DESTKERNNAME}
141 # Require DESTDIR to be manually specified when installing a
146 .if
!defined
(DESTDIR
)
147 @echo
"When installing a virtual kernel, DESTDIR must be manually specified"
151 @if
[ -f
${DESTDIR}/${DESTKERNNAME} ]; then \
152 echo
"You need to make buildworld, installworld, and upgrade"; \
153 echo
"before you can install a new kernel, because the"; \
154 echo
"kernel and modules have moved to /boot"; \
159 .if
!defined
(MODULES_WITH_WORLD
) && !defined
(NO_MODULES
)
161 depend
: modules-depend
163 cleandepend
: modules-cleandepend
164 cleandir
: modules-cleandir
166 install: modules-install
167 reinstall
: modules-reinstall
172 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules obj
; \
173 env
${MKMODULESENV} ${MAKE} -f Makefile.modules
all
177 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules obj
; \
178 env
${MKMODULESENV} ${MAKE} -f Makefile.modules depend
181 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
clean
184 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules cleandepend
187 #modules-clobber: modules-clean
188 # rm -rf ${MKMODULESENV}
191 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules cleandir
194 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
tags
196 # Note: when moving the existing modules to .old, they are by default stripped
197 # so we do not have two full debug environments sitting in / eating up space.
200 .if
!defined
(NO_MODULES_OLD
)
201 .
ifdef NO_KERNEL_OLD_STRIP
202 set
-- ${DESTDIR}/boot
/modules
/*; \
203 if
[ -f
"$$1" ]; then \
204 mkdir
-p
${DESTDIR}/boot
/modules.old
; \
206 cp
-p
$$file ${DESTDIR}/boot
/modules.old
; \
210 set
-- ${DESTDIR}/boot
/modules
/*; \
211 if
[ -f
"$$1" ]; then \
212 mkdir
-p
${DESTDIR}/boot
/modules.old
; \
214 ${OBJCOPY} --strip-debug
$$file ${DESTDIR}/boot
/modules.old
/$${file
##*/}; \
219 mkdir
-p
${DESTDIR}/boot
/modules
# Ensure that the modules directory exists!
220 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
install
223 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
install
231 vers.c
: $S/conf
/newvers.sh
$S/sys
/param.h
${SYSTEM_DEP}
232 sh
$S/conf
/newvers.sh
${KERN_IDENT} ${IDENT}
234 # XXX strictly, everything depends on Makefile because changes to ${PROF}
235 # only appear there, but we don't handle that.
239 #vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src
240 # awk -f $S/tools/vnode_if.awk -- -c $S/kern/vnode_if.src
242 #vnode_if.h: $S/tools/vnode_if.awk $S/kern/vnode_if.src
243 # awk -f $S/tools/vnode_if.awk -- -h $S/kern/vnode_if.src
248 .
include "$S/conf/bsd.kern.mk"