initrd: Fix parallel build
authorAaron LI <aly@aaronly.me>
Mon, 2 Jul 2018 01:30:20 +0000 (09:30 +0800)
committerAaron LI <aly@aaronly.me>
Mon, 2 Jul 2018 02:04:01 +0000 (10:04 +0800)
Add explicit target orders to oinit/Makefile, because such orders are
set in <bsd.subdir.mk> but not in <bsd.prog.mk>.

Since the make targets (e.g., depend, all, install, clean) are now
ordered, so remove 'clean cleandepend' from the same command as
'depend all install'.

Also allow defining the 'NO_CLEAN" variable to not clean previous builds.

initrd/Makefile
initrd/oinit/Makefile

index cc2da93..6aa2406 100644 (file)
@@ -13,12 +13,14 @@ INITRD_STAGEDIR!=   mktemp -d -t initrd-stage
 rescue:
        @${ECHO} ">>> Building and installing rescue tools ..."
 .for _dir in bin oinit sbin sbin.libcrypto
+.if !defined(NO_CLEAN)
+       (cd ${.CURDIR}/${_dir}; \
+           ${INITRD_MAKE} BINDIR=${RESCUE_DIR} clean cleandepend)
+.endif
        (cd ${.CURDIR}/${_dir}; \
            ${ECHO} "=> ${_dir}"; \
-           ${INITRD_MAKE} BINDIR=${RESCUE_DIR} clean cleandepend; \
            ${INITRD_MAKE} BINDIR=${RESCUE_DIR} obj; \
-           ${INITRD_MAKE} BINDIR=${RESCUE_DIR} \
-               depend all install clean cleandepend)
+           ${INITRD_MAKE} BINDIR=${RESCUE_DIR} depend all install)
 .endfor
 
 initrd: rescue
@@ -32,7 +34,6 @@ initrd: rescue
            -b ${DESTDIR}/boot \
            -r ${DESTDIR}${RESCUE_DIR} \
            -c ${INITRD_STAGEDIR}
-       (cd ${.CURDIR}/etc; ${INITRD_MAKE} clean cleandepend)
 
 clean:
        @${ECHO} ">>> Cleaning ..."
index 7f0db38..bb9b6b9 100644 (file)
@@ -6,3 +6,5 @@ DPADD=  ${LIBUTIL}
 LDADD= -lutil
 
 .include <bsd.prog.mk>
+
+.ORDER: clean cleandepend cleandir obj depend all install