mk/crunchgen: Do not hard code the path to the source directories
authorAaron LI <aly@aaronly.me>
Sat, 9 Jun 2018 05:39:18 +0000 (13:39 +0800)
committerAaron LI <aly@aaronly.me>
Sun, 1 Jul 2018 09:21:59 +0000 (17:21 +0800)
Introduce the variable CRUNCH_PATH_${D} to specify the path to the
base source directory ${D}.

Update the description and initrd makefiles accordingly.

initrd/bin/Makefile
initrd/sbin.libcrypto/Makefile
initrd/sbin/Makefile
share/mk/bsd.crunchgen.mk

index 5982137..5aca8d6 100644 (file)
@@ -11,6 +11,7 @@ SCRIPTS=dowpa
 # /usr/include/paths.h as well!  You were warned!
 #
 CRUNCH_SRCDIRS+= bin
+CRUNCH_PATH_bin= ${.CURDIR}/../..
 CRUNCH_PROGS_bin=      \
        cat             \
        chmod           \
@@ -50,6 +51,7 @@ CRUNCH_ALIAS_rm= unlink
 
 
 CRUNCH_SRCDIRS+= usr.bin
+CRUNCH_PATH_usr.bin= ${.CURDIR}/../..
 CRUNCH_PROGS_usr.bin= du less undo ssh fetch
 CRUNCH_ALIAS_less= more
 CRUNCH_ALIAS_ssh= scp
index bc97af9..35f97d7 100644 (file)
@@ -4,6 +4,7 @@
 PROG=  rescue.libcrypto
 
 CRUNCH_SRCDIRS+= sbin
+CRUNCH_PATH_sbin= ${.CURDIR}/../..
 CRUNCH_PROGS_sbin= tcplay      \
                    md5         \
                    hammer      \
@@ -12,12 +13,14 @@ CRUNCH_PROGS_sbin= tcplay   \
                    ping6
 
 CRUNCH_SRCDIRS+= gnu/sbin
+CRUNCH_PATH_gnu/sbin= ${.CURDIR}/../..
 CRUNCH_PROGS_gnu/sbin= cryptsetup
 
 CRUNCH_LIBS+= -ldm -lprop -ldmsg -lutil -lhammer -lpthread -lm
 CRUNCH_ALIAS_md5= rmd160
 
 CRUNCH_SRCDIRS+= usr.sbin/802_11
+CRUNCH_PATH_usr.sbin/802_11= ${.CURDIR}/../..
 CRUNCH_PROGS_usr.sbin/802_11= wpa_supplicant
 CRUNCH_LIBS+= -lpcap -lprivate_ssl -lmd -lprivate_crypto
 CRUNCH_LIBS+= ${PRIVATELIB_LDFLAGS}
index d0adfa3..e7065e5 100644 (file)
@@ -6,6 +6,7 @@ PROG=   rescue.sbin
 SCRIPTS= ${.CURDIR}/../../sbin/dhclient/dhclient-script
 
 CRUNCH_SRCDIRS+= sbin
+CRUNCH_PATH_sbin= ${.CURDIR}/../..
 CRUNCH_PROGS_sbin=     \
        camcontrol      \
        ccdconfig       \
@@ -65,6 +66,7 @@ CRUNCH_LIBS+= -lbsdxml
 CRUNCH_LIBS+= ${PRIVATELIB_LDFLAGS}
 
 CRUNCH_SRCDIRS+= usr.sbin
+CRUNCH_PATH_usr.sbin= ${.CURDIR}/../..
 CRUNCH_PROGS_usr.sbin= boot0cfg chroot
 
 .include <bsd.crunchgen.mk>
index a31d143..3249163 100644 (file)
@@ -4,7 +4,8 @@
 # Make variables used to generate the crunchgen(1) config file:
 #
 # CRUNCH_SRCDIRS       Directories to search for included programs
-# CRUNCH_PROGS         Programs to be included
+# CRUNCH_PATH_${D}     Path to the source directory ${D}
+# CRUNCH_PROGS_${D}    Programs to be included inside directory ${D}
 # CRUNCH_LIBS          Libraries to be statically linked with
 # CRUNCH_SHLIBS                Libraries to be dynamically linked with
 # CRUNCH_BUILDOPTS     Build options to be added for every program
@@ -40,7 +41,7 @@ CLEANFILES+= ${CONF} *.o *.lo *.c *.mk *.cache *.a *.h
 # Set a default SRCDIR for each for simpler handling below.
 .for D in ${CRUNCH_SRCDIRS}
 .for P in ${CRUNCH_PROGS_${D}}
-CRUNCH_SRCDIR_${P}?=   ${.CURDIR}/../../${D}/${P}
+CRUNCH_SRCDIR_${P}?=   ${CRUNCH_PATH_${D}}/${D}/${P}
 .endfor
 .endfor