Skip to content

Commit

Permalink
*/Makefile.am, configure.ac: constrain makefile exports to implementa…
Browse files Browse the repository at this point in the history
…tions where NUT_AM_MAKE_CAN_EXPORT

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Jan 2, 2024
1 parent cf5a027 commit d2ee53f
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 55 deletions.
10 changes: 5 additions & 5 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions clients/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions drivers/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 5 additions & 5 deletions include/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 5 additions & 5 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions server/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
10 changes: 5 additions & 5 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions tests/NIT/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions tools/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions tools/nut-scanner/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d2ee53f

Please sign in to comment.