summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2020-04-04 10:40:52 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2020-04-04 14:34:43 +0200
commit4c5bee070c00d578ca7168431c51d985a91cef3a (patch)
tree080500c9b0931a657bf3d8a03918598972c47929 /scripts
parentd0bc370b236f8b7e2e2a0ed9277eca7d6acd411b (diff)
downloadptxdist-4c5bee070c00d578ca7168431c51d985a91cef3a.tar.gz
ptxdist-4c5bee070c00d578ca7168431c51d985a91cef3a.tar.xz
rules: support older make versions that don't support $(file ..)
For example make 3.82 from CentOS 7 does not support $(file ..). Provide a (slower) fallback for those cases. For some things use ptx/file as fallback. However, this is very slow, so it cannot be called for every PTXCONF variable. So fallback to the old, less optimal handling in that case. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_lib_dgen.awk23
-rw-r--r--scripts/lib/ptxd_lib_dgen.sh4
2 files changed, 22 insertions, 5 deletions
diff --git a/scripts/lib/ptxd_lib_dgen.awk b/scripts/lib/ptxd_lib_dgen.awk
index 1562a1a41..e00a96e1e 100644
--- a/scripts/lib/ptxd_lib_dgen.awk
+++ b/scripts/lib/ptxd_lib_dgen.awk
@@ -20,6 +20,7 @@ BEGIN {
PTXDIST_TEMPDIR = ENVIRON["PTXDIST_TEMPDIR"];
PARALLEL = ENVIRON["PTXDIST_PARALLELMFLAGS_EXTERN"]
DIRTY = ENVIRON["PTXDIST_DIRTY"];
+ PTXDIST_OLD_MAKE = ENVIRON["PTXDIST_OLD_MAKE"];
DEP = DIRTY == "true" ? "|" : ""
PTXDIST_HASHLIST = PTXDIST_TEMPDIR "/pkghash.list"
CHECK_LICENSES = 0
@@ -214,10 +215,20 @@ $1 ~ /^PTXCONF_/ {
do {
if (this_PKG in PKG_to_pkg || this_PKG in virtual_pkg) {
PKG_HASHFILE = PTXDIST_TEMPDIR "/pkghash-" this_PKG;
+ if (PTXDIST_OLD_MAKE) {
+ if (PKG_HASHFILE != last_PKG_HASHFILE) {
+ close(last_PKG_HASHFILE);
+ last_PKG_HASHFILE = PKG_HASHFILE;
+ }
+ }
if (!($0 in allsym)) {
- print "ifdef PTXDIST_SETUP_ONCE" > DGEN_DEPS_POST;
- print "$(file >>" PKG_HASHFILE "," $1 "=$(" $1 "))" > DGEN_DEPS_POST;
- print "endif" > DGEN_DEPS_POST;
+ if (PTXDIST_OLD_MAKE)
+ print $0 >> PKG_HASHFILE;
+ else {
+ print "ifdef PTXDIST_SETUP_ONCE" > DGEN_DEPS_POST;
+ print "$(file >>" PKG_HASHFILE "," $1 "=$(" $1 "))" > DGEN_DEPS_POST;
+ print "endif" > DGEN_DEPS_POST;
+ }
}
break;
}
@@ -392,7 +403,7 @@ function write_deps_pkg_active_cfghash(this_PKG, this_pkg) {
print "undefine " this_PKG "_PATCH_DIR" > DGEN_DEPS_POST;
print "else" > DGEN_DEPS_POST;
print "ifdef PTXDIST_SETUP_ONCE" > DGEN_DEPS_POST;
- print "$(file >>" PTXDIST_HASHLIST ",PATCHES: " this_PKG " $(" this_PKG "_PATCH_DIR))" > DGEN_DEPS_POST;
+ print "PTXDIST_HASHLIST_DATA += PATCHES: " this_PKG " $(" this_PKG "_PATCH_DIR)\\n" > DGEN_DEPS_POST;
print "endif" > DGEN_DEPS_POST;
print "endif" > DGEN_DEPS_POST;
print "endif" > DGEN_DEPS_POST;
@@ -403,7 +414,7 @@ function write_deps_pkg_active_cfghash(this_PKG, this_pkg) {
print "endif" > DGEN_DEPS_POST;
print "ifneq ($(filter /%,$(" this_PKG "_CONFIG)),)" > DGEN_DEPS_POST;
print "ifneq ($(wildcard $(" this_PKG "_CONFIG)),)" > DGEN_DEPS_POST;
- print "$(file >>" PTXDIST_HASHLIST ",CONFIG: " this_PKG " $(" this_PKG "_CONFIG))" > DGEN_DEPS_POST;
+ print "PTXDIST_HASHLIST_DATA += CONFIG: " this_PKG " $(" this_PKG "_CONFIG)\\n" > DGEN_DEPS_POST;
print "else" > DGEN_DEPS_POST;
if (this_pkg_prefix != "image-")
print "$(STATEDIR)/" this_pkg ".prepare: " "$(" this_PKG "_CONFIG)" > DGEN_DEPS_POST;
@@ -587,6 +598,7 @@ END {
write_deps_pkg_active_cfghash(this_PKG, this_pkg)
print "ifdef PTXDIST_SETUP_ONCE" > DGEN_DEPS_POST;
+ print "$(call ptx/force-shell, echo -e '$(PTXDIST_HASHLIST_DATA)' >> " PTXDIST_HASHLIST ")" > DGEN_DEPS_POST;
print "$(call ptx/force-sh, $(PTXDIST_LIB_DIR)/ptxd_make_pkghash.awk " PTXDIST_HASHLIST ")" > DGEN_DEPS_POST;
print "endif" > DGEN_DEPS_POST;
@@ -625,6 +637,7 @@ END {
write_deps_pkg_active_image(this_PKG, this_pkg, this_pkg_prefix)
}
+ close(PKG_HASHFILE);
close(MAP_ALL);
close(MAP_ALL_MAKE);
close(MAP_DEPS);
diff --git a/scripts/lib/ptxd_lib_dgen.sh b/scripts/lib/ptxd_lib_dgen.sh
index 7da78adfc..38bb67809 100644
--- a/scripts/lib/ptxd_lib_dgen.sh
+++ b/scripts/lib/ptxd_lib_dgen.sh
@@ -102,6 +102,10 @@ ptxd_dgen() {
"${STATEDIR}" \
"${PTXDIST_DGEN_DIR}" || return
+ if "${PTXCONF_SETUP_HOST_MAKE}" --version | grep -q "GNU Make 3"; then
+ export PTXDIST_OLD_MAKE=1
+ fi
+
ptxd_dgen_configdeps &&
ptxd_dgen_rulesfiles &&
ptxd_dgen_map_all