From d2ee53ffe096df689b131d4d7069fa888f39c7cf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Tue, 2 Jan 2024 20:11:32 +0100 Subject: [PATCH] */Makefile.am, configure.ac: constrain makefile exports to implementations where NUT_AM_MAKE_CAN_EXPORT Signed-off-by: Jim Klimov --- Makefile.am | 10 +++++----- clients/Makefile.am | 10 +++++----- common/Makefile.am | 10 +++++----- configure.ac | 17 +++++++++++++++++ drivers/Makefile.am | 10 +++++----- include/Makefile.am | 10 +++++----- lib/Makefile.am | 10 +++++----- server/Makefile.am | 10 +++++----- tests/Makefile.am | 10 +++++----- tests/NIT/Makefile.am | 10 +++++----- tools/Makefile.am | 10 +++++----- tools/nut-scanner/Makefile.am | 10 +++++----- 12 files changed, 72 insertions(+), 55 deletions(-) diff --git a/Makefile.am b/Makefile.am index c4e5c9b8df..3aef1e9166 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,11 +6,11 @@ ACLOCAL_AMFLAGS = -I m4 # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ # subdirectories to build and distribute. The order matters, as # several subdirectories depend on stuff in "common" or tools being built first diff --git a/clients/Makefile.am b/clients/Makefile.am index 7dff531dd7..9e294d40e1 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -4,11 +4,11 @@ EXTRA_DIST = # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ # nutclient.cpp for some legacy reason (maybe initial detached development?) # optionally includes "common.h" with the NUT build setup - and this option diff --git a/common/Makefile.am b/common/Makefile.am index a8e2ac809b..8ef2d39ed4 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -10,11 +10,11 @@ libparseconf_la_SOURCES = parseconf.c # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ # do not hard depend on '../include/nut_version.h', since it blocks # 'dist', and is only required for actual build, in which case diff --git a/configure.ac b/configure.ac index 3384963ab0..07acf6258b 100644 --- a/configure.ac +++ b/configure.ac @@ -115,6 +115,19 @@ dnl Use "./configure --enable-maintainer-mode" to keep Makefile.in and Makefile dnl in sync after Git updates. AM_MAINTAINER_MODE +dnl GNU and BSD make are okay with the syntax, but Sun make/dmake are not: +AC_MSG_CHECKING([whether this make implementation supports export VAR=VAL syntax]) +nut_am_output="`printf 'export VAR=VAL\ntest:\n\t@echo "VAR=\$(VAR)"\n' | ${MAKE-make} -f - test`" +nut_am_result="$?" +AS_IF([test x"${nut_am_result}" = x0 -a x"${nut_am_output}" = x"VAR=VAL"], [ + NUT_AM_MAKE_CAN_EXPORT="" + AC_MSG_RESULT(yes) +], [ + NUT_AM_MAKE_CAN_EXPORT="#ThisMakeCanNotExport# " + AC_MSG_RESULT(no: got '${nut_am_output}') +]) +AC_SUBST(NUT_AM_MAKE_CAN_EXPORT) + dnl Some systems have older autotools without direct macro support for PKG_CONF* NUT_CHECK_PKGCONFIG @@ -4582,6 +4595,7 @@ dnl # NUT as the project and CPU architecture for resulting binaries; dnl # maybe we might use distro as well but some overlaps may be possible dnl # that result in same objects for different-looking build roots. dnl # Note this is enabled by default (explicit --without-... disables it). +dnl # Has practical effect if NUT_AM_MAKE_CAN_EXPORT test is successful. AS_IF([test x"${CCACHE_NAMESPACE}" = x], [ CCACHE_NAMESPACE="nut" dnl # Variables in this list are defined earlier in the script @@ -4608,6 +4622,9 @@ AC_ARG_WITH(CCACHE_NAMESPACE, esac ], []) NUT_REPORT_TARGET(CCACHE_NAMESPACE, "${CCACHE_NAMESPACE}", [ccache namespace tag (if ccache is used and new enough)]) +AS_IF([test x"$CCACHE_NAMESPACE" != x -a x"$NUT_AM_MAKE_CAN_EXPORT" != x], [ + AC_MSG_WARN([CCACHE_NAMESPACE setting may have no effect: this make implementation seems to not support "export VAR=VAL" syntax]) +]) dnl # Mark it as a "precious variable", for more details see dnl # https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Setting-Output-Variables.html diff --git a/drivers/Makefile.am b/drivers/Makefile.am index 6105cd1489..d7d25ea021 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -3,11 +3,11 @@ # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ # Make sure out-of-dir dependencies exist (especially when dev-building parts): $(top_builddir)/common/libcommon.la \ diff --git a/include/Makefile.am b/include/Makefile.am index 3a5c382bfc..7def0626d9 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -3,11 +3,11 @@ # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ dist_noinst_HEADERS = attribute.h common.h extstate.h proto.h \ state.h str.h timehead.h upsconf.h nut_float.h nut_stdint.h nut_platform.h \ diff --git a/lib/Makefile.am b/lib/Makefile.am index b379a5d181..7d272d8de6 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -3,11 +3,11 @@ # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ EXTRA_DIST = README.adoc diff --git a/server/Makefile.am b/server/Makefile.am index a913b3e4c5..24ce399500 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -3,11 +3,11 @@ # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ # Make sure out-of-dir dependencies exist (especially when dev-building parts): $(top_builddir)/common/libcommon.la \ diff --git a/tests/Makefile.am b/tests/Makefile.am index c41501932f..8ddb86af43 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,11 +3,11 @@ # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ SUBDIRS = . NIT diff --git a/tests/NIT/Makefile.am b/tests/NIT/Makefile.am index 86f412a580..e0638d26bd 100644 --- a/tests/NIT/Makefile.am +++ b/tests/NIT/Makefile.am @@ -3,11 +3,11 @@ # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ EXTRA_DIST = nit.sh README.adoc diff --git a/tools/Makefile.am b/tools/Makefile.am index d68c4ea4d7..bc52174d4c 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -3,11 +3,11 @@ # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ # SUBDIRS are explicitly a listing of all the directories that make # must recurse into BEFORE processing the current directory. diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 1f1b50de89..5ab51726a1 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -3,11 +3,11 @@ # Export certain values for ccache which NUT ci_build.sh can customize, # to facilitate developer iteration re-runs of "make" later. # At least GNU and BSD make implementations are okay with this syntax. -export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ -export CCACHE_BASEDIR=@CCACHE_BASEDIR@ -export CCACHE_DIR=@CCACHE_DIR@ -export CCACHE_PATH=@CCACHE_PATH@ -export PATH=@PATH_DURING_CONFIGURE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_NAMESPACE=@CCACHE_NAMESPACE@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_BASEDIR=@CCACHE_BASEDIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_DIR=@CCACHE_DIR@ +@NUT_AM_MAKE_CAN_EXPORT@export CCACHE_PATH=@CCACHE_PATH@ +@NUT_AM_MAKE_CAN_EXPORT@export PATH=@PATH_DURING_CONFIGURE@ # Generally, list headers and/or sources which are re-generated # for nut-scanner in the parent dir