mxge: properly remove the sysctls
[dragonfly.git] / sys / conf / kern.post.mk
blob82626045a269af11f3bdf8e36528097824d5e7b0
1 # $DragonFly: src/sys/conf/kern.post.mk,v 1.15 2008/09/15 20:09:03 thomas 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"
12 .include "$S/conf/kern.paths.mk"
14 depend kernel-depend modules-depend: ${FORWARD_HEADERS_COOKIE}
16 depend: kernel-depend
17 clean: kernel-clean
18 cleandepend: kernel-cleandepend
19 tags: kernel-tags
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
27 @rm -f ${.TARGET}
28 @echo linking ${.TARGET}
29 ${SYSTEM_LD}
30 ${SYSTEM_LD_TAIL}
32 .if !exists(.depend)
33 ${SYSTEM_OBJS}: ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/}
34 .endif
36 .for mfile in ${MFILES}
37 ${mfile:T:S/.m$/.h/}: ${mfile}
38 awk -f $S/tools/makeobjops.awk -- -h ${mfile}
39 .endfor
41 kernel-clean:
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/} \
47 ${CLEAN}
49 #lint: /tmp
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
56 ${NORMAL_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.
61 hack.So: Makefile
62 touch hack.c
63 ${CC} -shared -nostdlib hack.c -o hack.So
64 rm -f hack.c
66 # this rule stops ./assym.s in .depend from causing problems
67 ./assym.s: assym.s
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
79 # pass it to mkdep.
80 kernel-depend: assym.s ${BEFORE_DEPEND} \
81 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} \
82 ${SYSTEM_SFILES} ${MFILES:T:S/.m$/.h/}
83 rm -f .newdep
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}
88 rm -f .depend
89 mv -f .newdep .depend
91 kernel-cleandepend:
92 rm -f .depend
94 links:
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
102 kernel-tags:
103 @[ -f .depend ] || { echo "you must make depend first"; exit 1; }
104 sh $S/conf/systags.sh
105 rm -f tags1
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." ; \
114 exit 1 ; \
116 . if exists(${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME})
117 .ifndef NOFSCHG
118 -chflags noschg ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
119 .endif
120 . ifdef NO_KERNEL_OLD_STRIP
121 cp -p ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}.old
122 . else
123 ${OBJCOPY} --strip-debug ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}.old
124 . endif
125 . endif
126 mkdir -p ${DESTDIR}${DESTKERNDIR}
127 .ifdef NOFSCHG
128 ${INSTALL} -m 555 -o root -g wheel \
129 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
130 .else
131 ${INSTALL} -m 555 -o root -g wheel -fschg \
132 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
133 .endif
135 kernel-reinstall: kernel-installable
136 mkdir -p ${DESTDIR}${DESTKERNDIR}
137 .ifdef NOFSCHG
138 ${INSTALL} -m 555 -o root -g wheel \
139 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
140 .else
141 ${INSTALL} -m 555 -o root -g wheel -fschg \
142 ${SELECTEDKERNEL} ${DESTDIR}${DESTKERNDIR}/${DESTKERNNAME}
143 .endif
145 kernel-installable:
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"; \
150 exit 1; \
152 @exit 0
154 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES)
155 all: modules
156 depend: modules-depend
157 clean: modules-clean
158 cleandepend: modules-cleandepend
159 cleandir: modules-cleandir
160 tags: modules-tags
161 install: modules-install
162 reinstall: modules-reinstall
163 .endif
165 modules:
166 @mkdir -p ${.OBJDIR}
167 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \
168 env ${MKMODULESENV} ${MAKE} -f Makefile.modules all
170 modules-depend:
171 @mkdir -p ${.OBJDIR}
172 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules obj ; \
173 env ${MKMODULESENV} ${MAKE} -f Makefile.modules depend
175 modules-clean:
176 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules clean
178 modules-cleandepend:
179 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandepend
181 # XXX huh?
182 #modules-clobber: modules-clean
183 # rm -rf ${MKMODULESENV}
185 modules-cleandir:
186 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules cleandir
188 modules-tags:
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.
194 modules-install:
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; \
200 for file; do \
201 cp -p $$file ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old; \
202 done; \
204 . else
205 set -- ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}/*; \
206 if [ -f "$$1" ]; then \
207 mkdir -p ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old; \
208 for file; do \
209 ${OBJCOPY} --strip-debug $$file ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME}.old/$${file##*/}; \
210 done; \
212 . endif
213 .endif
214 mkdir -p ${DESTDIR}${DESTKERNDIR}/${DESTMODULESNAME} # Ensure that the modules directory exists!
215 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
217 modules-reinstall:
218 mkdir -p ${DESTDIR}/${DESTKERNDIR}/${DESTMODULESNAME} # Ensure that the modules directory exists!
219 cd $S ; env ${MKMODULESENV} ${MAKE} -f Makefile.modules install
221 config.o:
222 ${NORMAL_C}
224 ioconf.o:
225 ${NORMAL_C}
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.
232 vers.o:
233 ${NORMAL_C}
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
241 #vnode_if.o:
242 # ${NORMAL_C}
244 .include "$S/conf/bsd.kern.mk"