Merge from vendor branch OPENSSL:
[dragonfly/vkernel-mp.git] / sys / conf / kern.post.mk
blobd40d1f83dddc4c7f4906b80725e6319c0780bad8
1 # $DragonFly: src/sys/conf/kern.post.mk,v 1.10 2007/02/22 21:02:49 corecode Exp $
2 #
3 # This Makefile covers the bottom part of the MI build instructions
6 .PHONY: all modules
8 all: ${KERNEL}.stripped
10 _MACHINE_FWD= ${.OBJDIR}
11 .include "$S/conf/kern.fwd.mk"
13 depend kernel-depend modules-depend: ${FORWARD_HEADERS_COOKIE}
15 depend: kernel-depend
16 clean: kernel-clean
17 cleandepend: kernel-cleandepend
18 tags: kernel-tags
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
26 @rm -f ${.TARGET}
27 @echo linking ${.TARGET}
28 ${SYSTEM_LD}
29 ${SYSTEM_LD_TAIL}
31 .if !exists(.depend)
32 ${SYSTEM_OBJS}: ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/}
33 .endif
35 .for mfile in ${MFILES}
36 ${mfile:T:S/.m$/.h/}: ${mfile}
37 awk -f $S/tools/makeobjops.awk -- -h ${mfile}
38 .endfor
40 kernel-clean:
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/} \
46 ${CLEAN}
48 #lint: /tmp
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
55 ${NORMAL_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.
60 hack.So: Makefile
61 touch hack.c
62 ${CC} -shared -nostdlib hack.c -o hack.So
63 rm -f hack.c
65 # this rule stops ./assym.s in .depend from causing problems
66 ./assym.s: assym.s
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
77 # pass it to mkdep.
78 kernel-depend: assym.s ${BEFORE_DEPEND} \
79 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
80 ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/}
81 rm -f .newdep
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}
86 rm -f .depend
87 mv -f .newdep .depend
89 kernel-cleandepend:
90 rm -f .depend
92 links:
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
100 kernel-tags:
101 @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
102 sh $S/conf/systags.sh
103 rm -f tags1
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:
110 @if [ ! -f ${SELECTEDKERNEL} ] ; then \
111 echo "You must build a kernel first." ; \
112 exit 1 ; \
114 .ifdef NOFSCHG
115 . if exists(${DESTDIR}/${DESTKERNNAME})
116 . ifdef NO_KERNEL_OLD_STRIP
117 cp -p ${DESTDIR}/${DESTKERNNAME} ${DESTDIR}/${DESTKERNNAME}.old
118 . else
119 ${OBJCOPY} --strip-debug ${DESTDIR}/${DESTKERNNAME} ${DESTDIR}/${DESTKERNNAME}.old
120 . endif
121 . endif
122 ${INSTALL} -m 555 -o root -g wheel \
123 ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}
124 .else
125 . if exists(${DESTDIR}/${DESTKERNNAME})
126 -chflags noschg ${DESTDIR}/${DESTKERNNAME}
127 . ifdef NO_KERNEL_OLD_STRIP
128 cp -p ${DESTDIR}/${DESTKERNNAME} ${DESTDIR}/${DESTKERNNAME}.old
129 . else
130 ${OBJCOPY} --strip-debug ${DESTDIR}/${DESTKERNNAME} ${DESTDIR}/${DESTKERNNAME}.old
131 . endif
132 . endif
133 ${INSTALL} -m 555 -o root -g wheel -fschg \
134 ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}
135 .endif
137 kernel-reinstall:
138 .ifdef NOFSCHG
139 ${INSTALL} -m 555 -o root -g wheel \
140 ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}
141 .else
142 ${INSTALL} -m 555 -o root -g wheel -fschg \
143 ${SELECTEDKERNEL} ${DESTDIR}/${DESTKERNNAME}
144 .endif
146 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES)
147 all: modules
148 depend: modules-depend
149 clean: modules-clean
150 cleandepend: modules-cleandepend
151 cleandir: modules-cleandir
152 tags: modules-tags
153 install: modules-install
154 reinstall: modules-reinstall
155 .endif
157 modules:
158 @mkdir -p ${.OBJDIR}
159 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \
160 env ${MKMODULESENV} ${MAKE} -f Makefile.modules all
162 modules-depend:
163 @mkdir -p ${.OBJDIR}
164 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \
165 env ${MKMODULESENV} ${MAKE} -f Makefile.modules depend
167 modules-clean:
168 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules clean
170 modules-cleandepend:
171 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandepend
173 # XXX huh?
174 #modules-clobber: modules-clean
175 # rm -rf ${MKMODULESENV}
177 modules-cleandir:
178 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandir
180 modules-tags:
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.
186 modules-install:
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; \
192 for file; do \
193 cp -p $$file ${DESTDIR}/modules.old; \
194 done; \
196 . else
197 set -- ${DESTDIR}/modules/*; \
198 if [ -f "$$1" ]; then \
199 mkdir -p ${DESTDIR}/modules.old; \
200 for file; do \
201 ${OBJCOPY} --strip-debug $$file ${DESTDIR}/modules.old/$${file##*/}; \
202 done; \
204 . endif
205 .endif
206 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
208 modules-reinstall:
209 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
211 config.o:
212 ${NORMAL_C}
214 ioconf.o:
215 ${NORMAL_C}
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.
222 vers.o:
223 ${NORMAL_C}
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
231 #vnode_if.o:
232 # ${NORMAL_C}
234 .include "$S/conf/bsd.kern.mk"