diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index 5ec5458353aa..16e870484b15 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -58,8 +58,7 @@ ${SUBDIR}:: .for __target in all all-man checkdpadd clean cleandepend cleandir depend lint \ - obj objlink realinstall regress tags \ - install.debug reinstall.debug + obj objlink realinstall regress tags ${__target}: _SUBDIR .endfor diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk index 5b460d3ea70c..7b2a175543a2 100644 --- a/sys/conf/kern.post.mk +++ b/sys/conf/kern.post.mk @@ -17,10 +17,7 @@ clean: kernel-clean cleandepend: kernel-cleandepend clobber: kernel-clobber depend: kernel-depend -# XXX "make install.debug" seems to install kernels twice. -install.debug: kernel-install.debug install: kernel-install -reinstall.debug: kernel-reinstall.debug reinstall: kernel-reinstall tags: kernel-tags @@ -30,6 +27,8 @@ FULLKERNEL= ${KERNEL_KO} FULLKERNEL= ${KERNEL_KO}.debug ${KERNEL_KO}: ${FULLKERNEL} ${OBJCOPY} --strip-debug ${FULLKERNEL} ${KERNEL_KO} +install.debug reinstall.debug: + cd ${.CURDIR}; ${MAKE} -DINSTALL_DEBUG ${.TARGET:R} .endif ${FULLKERNEL}: ${SYSTEM_DEP} vers.o @@ -125,7 +124,7 @@ kernel-tags: rm -f tags1 sed -e 's, ../, ,' tags > tags1 -kernel-install kernel-install.debug: +kernel-install: .if exists(${DESTDIR}/boot) @if [ ! -f ${DESTDIR}/boot/device.hints ] ; then \ echo "You must set up a ${DESTDIR}/boot/device.hints file first." ; \ @@ -136,7 +135,7 @@ kernel-install kernel-install.debug: exit 1 ; \ fi .endif - @if [ ! -f ${KERNEL_KO}${.TARGET:S/kernel-install//} ] ; then \ + @if [ ! -f ${FULLKERNEL} ] ; then \ echo "You must build a kernel first." ; \ exit 1 ; \ fi @@ -157,13 +156,19 @@ kernel-install kernel-install.debug: fi .endif mkdir -p ${DESTDIR}${KODIR} - install -c -m 555 -o root -g wheel \ - ${KERNEL_KO}${.TARGET:S/kernel-install//} ${DESTDIR}${KODIR} +.if defined(DEBUG) && defined(INSTALL_DEBUG) + install -c -m 555 -o root -g wheel ${FULLKERNEL} ${DESTDIR}${KODIR} +.else + install -c -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR} +.endif -kernel-reinstall kernel-reinstall.debug: +kernel-reinstall: @-chflags -R noschg ${DESTDIR}${KODIR} - install -c -m 555 -o root -g wheel \ - ${KERNEL_KO}${.TARGET:S/kernel-reinstall//} ${DESTDIR}${KODIR} +.if defined(DEBUG) && defined(INSTALL_DEBUG) + install -c -m 555 -o root -g wheel ${FULLKERNEL} ${DESTDIR}${KODIR} +.else + install -c -m 555 -o root -g wheel ${KERNEL_KO} ${DESTDIR}${KODIR} +.endif .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists($S/modules) all: modules @@ -172,9 +177,7 @@ cleandepend: modules-cleandepend cleandir: modules-cleandir clobber: modules-clobber depend: modules-depend -install.debug: modules-install.debug install: modules-install -reinstall.debug: modules-reinstall.debug reinstall: modules-reinstall tags: modules-tags .endif @@ -207,9 +210,6 @@ modules-tags: modules-install modules-reinstall: cd $S/modules ; ${MKMODULESENV} ${MAKE} install -modules-install.debug modules-reinstall.debug: - cd $S/modules ; ${MKMODULESENV} ${MAKE} install.debug - modules-tags: cd $S/modules ; env ${MKMODULESENV} ${MAKE} tags diff --git a/sys/conf/kmod.mk b/sys/conf/kmod.mk index 4a97f960b525..74381f2adf10 100644 --- a/sys/conf/kmod.mk +++ b/sys/conf/kmod.mk @@ -218,11 +218,16 @@ _INSTALLFLAGS:= ${INSTALLFLAGS} _INSTALLFLAGS:= ${_INSTALLFLAGS${ie}} .endfor +.if defined(DEBUG) install.debug: - ${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${FULLPROG} ${DESTDIR}${KMODDIR}/ + cd ${.CURDIR}; ${MAKE} -DINSTALL_DEBUG install +.endif realinstall: +.if defined(DEBUG) && defined(INSTALL_DEBUG) + ${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ + ${_INSTALLFLAGS} ${FULLPROG} ${DESTDIR}${KMODDIR}/ +.else ${INSTALL} ${COPY} -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/ .if defined(LINKS) && !empty(LINKS) @@ -250,6 +255,7 @@ realinstall: .if !defined(NO_XREF) -kldxref ${DESTDIR}${KMODDIR} .endif +.endif install: afterinstall afterinstall: realinstall