From 2d90e558080ac8ed9c0f2330e46dc5d348da9e5d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 30 Oct 2021 09:46:17 +0000 Subject: [PATCH 1/5] ci_build.sh: default "minimal" ritual should not spend half the time building docs --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index 4acf58e81b..d21ab86fae 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -749,7 +749,7 @@ bindings) echo "" ./autogen.sh #./configure - ./configure --with-cgi=auto --with-serial=auto --with-dev=auto + ./configure --with-cgi=auto --with-serial=auto --with-dev=auto --with-doc=skip $MAKE all && $MAKE check ;; *) From ee1abd650c596e421cdc98f7cbc6d666c2538f47 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 30 Oct 2021 10:40:30 +0000 Subject: [PATCH 2/5] common/Makefile.am: reference nut_version.h in a way that does not offend "make dist(check)" --- common/Makefile.am | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/Makefile.am b/common/Makefile.am index e2a4acb697..3917a80039 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -9,6 +9,11 @@ libparseconf_la_SOURCES = parseconf.c # 'dist', and is only required for actual build, in which case # BUILT_SOURCES (in ../include) will ensure nut_version.h will # be built before anything else +common.c: $(top_builddir)/include/nut_version.h + +$(top_builddir)/include/nut_version.h: + @cd $(@D) && $(MAKE) -s $(@F) + libcommon_la_SOURCES = common.c state.c str.c upsconf.c libcommonclient_la_SOURCES = common.c state.c str.c # ensure inclusion of local implementation of missing systems functions From 3a3f6846c5ea7fb33053dc70900efb010b21d9ba Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 30 Oct 2021 10:42:17 +0000 Subject: [PATCH 3/5] */Makefile.am: define dependencies on out-of-dir *.la helper libs, and reference them via top_builddir (not ..) --- clients/Makefile.am | 12 +++++++++--- drivers/Makefile.am | 10 ++++++++-- server/Makefile.am | 7 ++++++- tests/Makefile.am | 9 +++++++++ tools/nut-scanner/Makefile.am | 6 +++++- 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/clients/Makefile.am b/clients/Makefile.am index f9774bc8ce..d77db3f765 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -6,8 +6,14 @@ EXTRA_DIST = # was never triggered in fact, not until pushed through command line like this: AM_CXXFLAGS = -DHAVE_NUTCOMMON=1 -I$(top_srcdir)/include +# Make sure out-of-dir dependencies exist (especially when dev-building parts): +$(top_builddir)/common/libcommon.la \ +$(top_builddir)/common/libcommonclient.la \ +$(top_builddir)/common/libparseconf.la: + @cd $(@D) && $(MAKE) -s $(@F) + # by default, link programs in this directory with libcommon.a -LDADD = ../common/libcommon.la libupsclient.la $(NETLIBS) +LDADD = $(top_builddir)/common/libcommon.la libupsclient.la $(NETLIBS) if WITH_SSL LDADD += $(LIBSSL_LIBS) endif @@ -45,7 +51,7 @@ upslog_SOURCES = upslog.c upsclient.h upslog.h upsmon_SOURCES = upsmon.c upsmon.h upsclient.h upssched_SOURCES = upssched.c upssched.h -upssched_LDADD = ../common/libcommon.la ../common/libparseconf.la $(NETLIBS) +upssched_LDADD = $(top_builddir)/common/libcommon.la $(top_builddir)/common/libparseconf.la $(NETLIBS) upsimage_cgi_SOURCES = upsimage.c upsclient.h upsimagearg.h cgilib.c cgilib.h upsimage_cgi_LDADD = $(LDADD) $(LIBGD_LDFLAGS) @@ -56,7 +62,7 @@ upsstats_cgi_SOURCES = upsstats.c upsclient.h status.h upsstats.h \ # not LDADD. libupsclient_la_SOURCES = upsclient.c upsclient.h -libupsclient_la_LIBADD = ../common/libcommonclient.la +libupsclient_la_LIBADD = $(top_builddir)/common/libcommonclient.la if WITH_SSL libupsclient_la_LIBADD += $(LIBSSL_LIBS) endif diff --git a/drivers/Makefile.am b/drivers/Makefile.am index 19f376eab5..c4a045d959 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -1,9 +1,15 @@ # Network UPS Tools: drivers +# Make sure out-of-dir dependencies exist (especially when dev-building parts): +$(top_builddir)/common/libcommon.la \ +$(top_builddir)/common/libparseconf.la \ +$(top_builddir)/clients/libupsclient.la: + @cd $(@D) && $(MAKE) -s $(@F) + # by default, link programs in this directory with libcommon.la # (libtool version of the static lib, in order to access LTLIBOBJS) #FIXME: SERLIBS is only useful for LDADD_DRIVERS_SERIAL not for LDADD_COMMON -LDADD_COMMON = ../common/libcommon.la ../common/libparseconf.la +LDADD_COMMON = $(top_builddir)/common/libcommon.la $(top_builddir)/common/libparseconf.la LDADD_DRIVERS = libdummy.la $(LDADD_COMMON) LDADD_DRIVERS_SERIAL = libdummy_serial.la $(LDADD_DRIVERS) $(SERLIBS) @@ -155,7 +161,7 @@ riello_ser_LDADD = $(LDADD) -lm # dummy dummy_ups_SOURCES = dummy-ups.c dummy_ups_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/clients -dummy_ups_LDADD = $(LDADD_DRIVERS) ../clients/libupsclient.la +dummy_ups_LDADD = $(LDADD_DRIVERS) $(top_builddir)/clients/libupsclient.la if WITH_SSL dummy_ups_CFLAGS += $(LIBSSL_CFLAGS) dummy_ups_LDADD += $(LIBSSL_LIBS) diff --git a/server/Makefile.am b/server/Makefile.am index 8146568a09..76f15e6c7a 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -1,5 +1,10 @@ # Network UPS Tools: server +# Make sure out-of-dir dependencies exist (especially when dev-building parts): +$(top_builddir)/common/libcommon.la \ +$(top_builddir)/common/libparseconf.la: + @cd $(@D) && $(MAKE) -s $(@F) + # Avoid per-target CFLAGS, because this will prevent re-use of object # files. In any case, CFLAGS are only -I options, so there is no harm, # but only add them if we really use the target. @@ -10,7 +15,7 @@ endif if WITH_SSL AM_CFLAGS += $(LIBSSL_CFLAGS) endif -LDADD = ../common/libcommon.la ../common/libparseconf.la $(NETLIBS) +LDADD = $(top_builddir)/common/libcommon.la $(top_builddir)/common/libparseconf.la $(NETLIBS) if WITH_WRAP LDADD += $(LIBWRAP_LIBS) endif diff --git a/tests/Makefile.am b/tests/Makefile.am index 08fbd79ecf..dd2b60f11b 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,6 +17,10 @@ nutlogtest_LDADD = $(top_builddir)/common/libcommon.la getvaluetest_SOURCES = getvaluetest.c $(top_srcdir)/drivers/hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la +# Make sure out-of-dir dependencies exist (especially when dev-building parts): +$(top_builddir)/common/libcommon.la: + @cd $(@D) && $(MAKE) -s $(@F) + ### Optional tests which can not be built everywhere # List of src files for CppUnit tests CPPUNITTESTSRC = example.cpp nutclienttest.cpp @@ -43,6 +47,11 @@ cppunittest_LDFLAGS = $(CPPUNIT_LIBS) cppunittest_LDADD = $(top_builddir)/clients/libnutclient.la $(top_builddir)/clients/libnutclientstub.la cppunittest_SOURCES = $(CPPUNITTESTSRC) $(CPPUNITTESTERSRC) +# Make sure out-of-dir C++ dependencies exist (especially when dev-building +# only some parts of NUT): +$(top_builddir)/clients/libnutclient.la $(top_builddir)/clients/libnutclientstub.la: + @cd $(@D) && $(MAKE) -s $(@F) + else !HAVE_CPPUNIT # Just redistribute test source into tarball diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 0314395c6e..9f16befce8 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -13,6 +13,10 @@ BUILT_SOURCES = $(NUT_SCANNER_DEPS) $(NUT_SCANNER_DEPS): cd ..; $(MAKE) $(AM_MAKEFLAGS) nut-scanner-deps +# Make sure out-of-dir dependencies exist (especially when dev-building parts): +$(top_builddir)/common/libcommon.la: + @cd $(@D) && $(MAKE) -s $(@F) + # Only build nut-scanner, and its library, if libltdl was found (required!) if WITH_LIBLTDL bin_PROGRAMS = nut-scanner @@ -38,7 +42,7 @@ libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include $(LIBLTDL nut_scanner_SOURCES = nut-scanner.c nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include -nut_scanner_LDADD = ../../common/libcommon.la libnutscan.la +nut_scanner_LDADD = $(top_builddir)/common/libcommon.la libnutscan.la if WITH_SSL libnutscan_la_CFLAGS += $(LIBSSL_CFLAGS) From 4d4c52f2d0e5d5f096f81f290b666cc90cdc51d1 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 30 Oct 2021 10:42:58 +0000 Subject: [PATCH 4/5] tools/nut-scanner/Makefile.am: reference some out-of-dir sources via top_srcdir (not ../..) --- tools/nut-scanner/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 9f16befce8..d0c73557d5 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -26,9 +26,9 @@ libnutscan_la_SOURCES = scan_nut.c scan_ipmi.c \ nutscan-device.c nutscan-ip.c nutscan-display.c \ nutscan-init.c scan_usb.c scan_snmp.c scan_xml_http.c \ scan_avahi.c scan_eaton_serial.c nutscan-serial.c \ - ../../drivers/serial.c \ - ../../drivers/bcmxcp_ser.c \ - ../../common/common.c ../../common/str.c + $(top_srcdir)/drivers/serial.c \ + $(top_srcdir)/drivers/bcmxcp_ser.c \ + $(top_srcdir)/common/common.c $(top_srcdir)/common/str.c libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) # # Below we set API versions of public libraries From 3d1a77051b928161acf31f0ebbf75c39ba5be382 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 30 Oct 2021 10:49:35 +0000 Subject: [PATCH 5/5] tools/nut-scanner/Makefile.am: reference nut_version.h in a way that does not offend "make dist(check)" --- tools/nut-scanner/Makefile.am | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index d0c73557d5..680703eb85 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -17,6 +17,15 @@ $(NUT_SCANNER_DEPS): $(top_builddir)/common/libcommon.la: @cd $(@D) && $(MAKE) -s $(@F) +# do not hard depend on '../include/nut_version.h', since it blocks +# 'dist', and is only required for actual build, in which case +# BUILT_SOURCES (in ../include) will ensure nut_version.h will +# be built before anything else +$(top_srcdir)/common/common.c nut-scanner.c: $(top_builddir)/include/nut_version.h + +$(top_builddir)/include/nut_version.h: + @cd $(@D) && $(MAKE) -s $(@F) + # Only build nut-scanner, and its library, if libltdl was found (required!) if WITH_LIBLTDL bin_PROGRAMS = nut-scanner