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"
12 .
include "$S/conf/kern.paths.mk"
14 depend kernel-depend modules-depend
: ${FORWARD_HEADERS_COOKIE}
18 cleandepend
: kernel-cleandepend
20 install: kernel-install
21 reinstall
: kernel-reinstall
23 ${KERNEL}.stripped
: ${FULLKERNEL}
24 ${OBJCOPY} --strip-debug
${FULLKERNEL} ${KERNEL}.stripped
26 ${FULLKERNEL}: ${SYSTEM_DEP} vers.o
28 @echo linking
${.TARGET
}
33 ${SYSTEM_OBJS}: ${BEFORE_DEPEND
:M
*.h
} ${MFILES
:T
:S
/.m
$/.h
/}
36 .for mfile in
${MFILES}
37 ${mfile
:T
:S
/.m
$/.h
/}: ${mfile}
38 awk
-f
$S/tools
/makeobjops.awk
-- -h
${mfile}
42 rm -f
*.o
*.so
*.So
*.ko
*.s eddep errs \
43 ${KERNEL} ${KERNEL}.debug
${KERNEL}.nodebug
${KERNEL}.stripped \
44 linterrs makelinks setdef
[01].c setdefs.h
tags \
45 vers.c vnode_if.c vnode_if.h \
46 ${MFILES
:T
:S
/.m
$/.c
/} ${MFILES
:T
:S
/.m
$/.h
/} \
50 # @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \
51 # $S/platform/$P/$M/Locore.c ${CFILES} ioconf.c | \
52 # grep -v 'struct/union .* never defined' | \
53 # grep -v 'possible pointer alignment problem'
55 locore.o
: $S/platform
/$P/$M/locore.s assym.s
58 # This is a hack. BFD "optimizes" away dynamic mode if there are no
59 # dynamic references. We could probably do a '-Bforcedynamic' mode like
60 # in the a.out ld. For now, this works.
63 ${CC} -shared
-nostdlib hack.c
-o hack.So
66 # this rule stops ./assym.s in .depend from causing problems
69 assym.s
: $S/kern
/genassym.sh genassym.o
70 sh
$S/kern
/genassym.sh genassym.o
> ${.TARGET
}
72 genassym.o
: $S/platform
/$P/$M/genassym.c
${FORWARD_HEADERS_COOKIE}
73 ${CC} -c
${CFLAGS
:N-fno-common
:N-mcmodel
=small
} \
74 $S/platform
/$P/$M/genassym.c
76 ${SYSTEM_OBJS} genassym.o vers.o
: opt_global.h
78 # The argument list can be very long, use make -V and xargs to
80 kernel-depend
: assym.s
${BEFORE_DEPEND} \
81 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
82 ${SYSTEM_SFILES} ${MFILES
:T
:S
/.m
$/.h
/}
84 ${MAKE} -V CFILES
-V SYSTEM_CFILES
-V GEN_CFILES | xargs \
85 mkdep
-a
-f .newdep
${CFLAGS}
86 ${MAKE} -V SFILES
-V SYSTEM_SFILES | xargs \
87 env MKDEP_CPP
="${CC} -E" mkdep
-a
-f .newdep
${ASM_CFLAGS}
95 egrep
'#if' ${CFILES} | sed
-f
$S/conf
/defines | \
96 sed
-e
's/:.*//' -e
's/\.c/.o/' |
sort -u
> dontlink
97 ${MAKE} -V CFILES | tr
-s
' ' '\12' | sed
's/\.c/.o/' | \
98 sort -u | comm
-23 - dontlink | \
99 sed
's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
100 sh makelinks
&& rm -f dontlink
103 @
[ -f .depend
] ||
{ echo
"you must make depend first"; exit
1; }
104 sh
$S/conf
/systags.sh
106 sed
-e
's, ../, ,' tags > tags1
108 # Note: when moving the existing kernel to .old, it is by default stripped
109 # so we do not have two full debug environments sitting in / eating up space.
111 kernel-install
: kernel-installable
112 @if
[ ! -f
${SELECTEDKERNEL} ] ; then \
113 echo
"You must build a kernel first." ; \
116 . if exists
(${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME})
118 -chflags noschg
${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
120 .
ifdef NO_KERNEL_OLD_STRIP
121 cp
-p
${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}.old
123 ${OBJCOPY} --strip-debug
${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}.old
126 mkdir
-p
${DESTDIR}${DESTKERNDIR}
128 ${INSTALL} -m
555 -o root
-g wheel \
129 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
131 ${INSTALL} -m
555 -o root
-g wheel
-fschg \
132 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
135 kernel-reinstall
: kernel-installable
136 mkdir
-p
${DESTDIR}${DESTKERNDIR}
138 ${INSTALL} -m
555 -o root
-g wheel \
139 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
141 ${INSTALL} -m
555 -o root
-g wheel
-fschg \
142 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
146 @if
[ -f
${DESTDIR}/${DESTKERNNAME} ]; then \
147 echo
"You need to make buildworld, installworld, and upgrade"; \
148 echo
"before you can install a new kernel, because the"; \
149 echo
"kernel and modules have moved to /boot"; \
154 .if
!defined
(MODULES_WITH_WORLD
) && !defined
(NO_MODULES
)
156 depend
: modules-depend
158 cleandepend
: modules-cleandepend
159 cleandir
: modules-cleandir
161 install: modules-install
162 reinstall
: modules-reinstall
167 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules obj
; \
168 env
${MKMODULESENV} ${MAKE} -f Makefile.modules
all
172 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules obj
; \
173 env
${MKMODULESENV} ${MAKE} -f Makefile.modules depend
176 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
clean
179 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules cleandepend
182 #modules-clobber: modules-clean
183 # rm -rf ${MKMODULESENV}
186 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules cleandir
189 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
tags
191 # Note: when moving the existing modules to .old, they are by default stripped
192 # so we do not have two full debug environments sitting in / eating up space.
195 .if
!defined
(NO_MODULES_OLD
)
196 .
ifdef NO_KERNEL_OLD_STRIP
197 set
-- ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}/*; \
198 if
[ -f
"$$1" ]; then \
199 mkdir
-p
${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old
; \
201 cp
-p
$$file ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old
; \
205 set
-- ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}/*; \
206 if
[ -f
"$$1" ]; then \
207 mkdir
-p
${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old
; \
209 ${OBJCOPY} --strip-debug
$$file ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old
/$${file
##*/}; \
214 mkdir
-p
${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME} # Ensure that the modules directory exists!
215 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
install
218 mkdir
-p
${DESTDIR}/${DESTKERNDIR}/${DESTMODULESNAME} # Ensure that the modules directory exists!
219 cd
$S ; env
${MKMODULESENV} ${MAKE} -f Makefile.modules
install
227 vers.c
: $S/conf
/newvers.sh
$S/sys
/param.h
${SYSTEM_DEP}
228 sh
$S/conf
/newvers.sh
$S/..
230 # XXX strictly, everything depends on Makefile because changes to ${PROF}
231 # only appear there, but we don't handle that.
235 #vnode_if.c: $S/tools/vnode_if.awk $S/kern/vnode_if.src
236 # awk -f $S/tools/vnode_if.awk -- -c $S/kern/vnode_if.src
238 #vnode_if.h: $S/tools/vnode_if.awk $S/kern/vnode_if.src
239 # awk -f $S/tools/vnode_if.awk -- -h $S/kern/vnode_if.src
244 .
include "$S/conf/bsd.kern.mk"