From b9c6dfc1d7b27b113e906e6d94d23908755a2cd5 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 11:43:39 +0100 Subject: [PATCH 01/36] */Makefile.am: revise CLEANFILES and DISTCLEANFILES (favored over clean-local target rules) --- Makefile.am | 41 +++++++++++++++++++++++++++++--- clients/Makefile.am | 4 ++++ common/Makefile.am | 4 ++++ conf/Makefile.am | 7 +++--- data/Makefile.am | 6 ++--- data/html/Makefile.am | 6 ++++- docs/Makefile.am | 6 +++-- docs/cables/Makefile.am | 4 ++-- docs/man/Makefile.am | 14 ++++++----- drivers/Makefile.am | 9 ++++++- include/Makefile.am | 3 ++- lib/Makefile.am | 4 ++-- scripts/Makefile.am | 2 ++ scripts/Solaris/Makefile.am | 2 ++ scripts/augeas/Makefile.am | 10 ++++++-- scripts/devd/Makefile.am | 13 +++++++++- scripts/hotplug/Makefile.am | 10 +++++++- scripts/python/Makefile.am | 1 + scripts/systemd/Makefile.am | 4 ++++ scripts/udev/Makefile.am | 11 ++++++++- scripts/ufw/Makefile.am | 4 ++-- scripts/upsdrvsvcctl/Makefile.am | 1 + server/Makefile.am | 4 ++++ tests/Makefile.am | 9 ++++++- tools/Makefile.am | 6 +++++ tools/nut-scanner/Makefile.am | 5 ++-- 26 files changed, 156 insertions(+), 34 deletions(-) diff --git a/Makefile.am b/Makefile.am index ed5ec42138..6f866c1d83 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,9 +51,27 @@ memcheck distcheck-valgrind: distcleancheck: @: -clean-local: - rm -f *-spellchecked - rm -f cppcheck*.xml +# Files made by our targets: +CLEANFILES = *-spellchecked cppcheck*.xml +DISTCLEANFILES = ChangeLog INSTALL +# Most of the files generated by custom rules in the configure script +# or by autogen.sh are cleaned by the Makefile.am in their directories: +DISTCLEANFILES += tools/gitlog2changelog.py +DISTCLEANFILES += tools/nut-snmpinfo.py + +# Files made by autotools and common rituals of the configure script: +DISTCLEANFILES_AUTOTOOLS = aclocal.m4 config.guess config.log config.sub +DISTCLEANFILES_AUTOTOOLS += configure configure~ +#???# configure.ac~ +DISTCLEANFILES_AUTOTOOLS += depcomp install-sh ltmain.sh missing test-driver +DISTCLEANFILES_AUTOTOOLS += m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 +DISTCLEANFILES_AUTOTOOLS += include/config.h.in include/config.h.in~ +DISTCLEANFILES_AUTOTOOLS += Makefile.in + +DISTCLEANFILES += $(DISTCLEANFILES_AUTOTOOLS) + +distclean-local: + rm -rf .inst tmp autom4te.cache # Hook the documentation building and validating recipes # Note: these are optionally available (as determined during configure runs) @@ -206,6 +224,23 @@ snmp build-snmp install-snmp install-snmp-mgr install-snmp-man: setver: @echo "Error: 'make setver' no longer exists." @echo "Edit configure.ac to set version number." + +# Clean the dist tarball and packages +DISTCLEANFILES_DISTBALL = nut-*.tar.gz +# HP-UX: +DISTCLEANFILES_PACKAGES = NUT_HPUX_package@PACKAGE_VERSION@.depot +# AIX as below, and RedHat-compatible (cover binary and source packages): +DISTCLEANFILES_PACKAGES += nut*rpm +# Debian-compatible (cover binary and source packages): +DISTCLEANFILES_PACKAGES += nut*deb +# Solaris SVR4 package archives: +DISTCLEANFILES_PACKAGES += NUT_solaris_*_package@PACKAGE_VERSION@.local.gz +# Newer Solaris IPS (aka "pkg(5)" format archives) +DISTCLEANFILES_PACKAGES += *.p5p + +DISTCLEANFILES += $(DISTCLEANFILES_DISTBALL) +DISTCLEANFILES += $(DISTCLEANFILES_PACKAGES) + package: DESTDIR="$(abs_builddir)/_install_pkgprotodir" ; export DESTDIR; \ rm -rf "$$DESTDIR"; \ diff --git a/clients/Makefile.am b/clients/Makefile.am index d77db3f765..95abcf4e34 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -94,3 +94,7 @@ libnutclientstub_la_LIBADD = libnutclient.la else EXTRA_DIST += nutclientmem.h nutclientmem.cpp endif + +DISTCLEANFILES = Makefile.in +clean-local: + rm -rf $(builddir)/.deps diff --git a/common/Makefile.am b/common/Makefile.am index 3917a80039..2c29ca9bc3 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -20,3 +20,7 @@ libcommonclient_la_SOURCES = common.c state.c str.c # using LTLIBOBJS. Refer to configure.in/.ac -> AC_REPLACE_FUNCS libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ libcommonclient_la_LIBADD = libparseconf.la @LTLIBOBJS@ + +DISTCLEANFILES = Makefile.in +clean-local: + rm -rf $(builddir)/.deps diff --git a/conf/Makefile.am b/conf/Makefile.am index 2d5947dd5d..d3606734ce 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -19,9 +19,6 @@ nodist_sysconf_DATA = upssched.conf.sample upsmon.conf.sample SPELLCHECK_SRC = $(dist_sysconf_DATA) \ upssched.conf.sample.in upsmon.conf.sample.in -clean-local: - rm -f *.pdf *.html *-spellchecked - # NOTE: Due to portability, we do not use a GNU percent-wildcard extension: #%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) # $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ @@ -38,3 +35,7 @@ clean-local: spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_DIR="$(srcdir)" $@ + + +DISTCLEANFILES = Makefile.in +CLEANFILES = *.pdf *.html *-spellchecked diff --git a/data/Makefile.am b/data/Makefile.am index d5a694a182..d96509e5c0 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -6,9 +6,6 @@ dist_data_DATA = cmdvartab nodist_data_DATA = driver.list EXTRA_DIST = evolution500.seq epdu-managed.dev -clean-local: - rm -f *.pdf *.html *-spellchecked - # NOTE: Due to portability, we do not use a GNU percent-wildcard extension: #%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) # $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ @@ -18,3 +15,6 @@ cmdvartab-spellchecked: cmdvartab Makefile.am $(top_srcdir)/docs/Makefile.am $(a spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="cmdvartab" SPELLCHECK_DIR="$(srcdir)" $@ + +DISTCLEANFILES = Makefile.in +CLEANFILES = *.pdf *.html *-spellchecked diff --git a/data/html/Makefile.am b/data/html/Makefile.am index 956e66b884..b6a3484192 100644 --- a/data/html/Makefile.am +++ b/data/html/Makefile.am @@ -1,7 +1,11 @@ -# Network UPS Tools: data/html +# Network UPS Tools: data/html # install these only if configured --with-cgi if WITH_CGI dist_html_DATA = index.html bottom.html nut-banner.png nodist_html_DATA = header.html endif EXTRA_DIST = README + +DISTCLEANFILES = Makefile.in +# Generated by configure script: +DISTCLEANFILES += header.html diff --git a/docs/Makefile.am b/docs/Makefile.am index a02c850f46..3e3216f4a7 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,4 +1,4 @@ -DISTCLEANFILES = +DISTCLEANFILES = Makefile.in EXTRA_DIST = # Is "egrep == grep -E" always valid? (maybe all a job for configure.ac) @@ -136,8 +136,10 @@ check-man: man: cd $(top_builddir)/docs/man/ && $(MAKE) -f Makefile all +CLEANFILES = *.xml *.html *.pdf *-spellchecked docbook-xsl.css + +# Dirs to clean clean-local: - rm -f *.pdf *.html *-spellchecked docbook-xsl.css rm -rf *.chunked *.bak tmp ### TODO: automatic dependency generation diff --git a/docs/cables/Makefile.am b/docs/cables/Makefile.am index 1431357241..86b7d30090 100644 --- a/docs/cables/Makefile.am +++ b/docs/cables/Makefile.am @@ -1,2 +1,2 @@ -clean-local: - rm -f *-spellchecked +CLEANFILES = *-spellchecked +DISTCLEANFILES = Makefile.in diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 3a4e460ec2..ba7c1619ff 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -790,7 +790,7 @@ check-man-txt: $(SRC_ALL_PAGES) echo "FAILED man-source sanity check for:$$FAILED" >&2 ; file $$FAILED >&2 ; exit 1; \ fi; echo "PASSED man-source sanity check (checked $$CHECKED files)"; exit 0 -CLEANFILES = *.xml *.html +CLEANFILES = *-spellchecked SUFFIXES = .txt .html .1 .3 .5 .8 @@ -806,6 +806,8 @@ endif if HAVE_ASCIIDOC +CLEANFILES += *.1 *.3 *.5 *.8 *.xml *.html *.pdf + # Working around a2x not friendly to parallelized runs. # See more details in the main NUT docs/Makefile.am DOCBUILD_BEGIN = { \ @@ -931,11 +933,6 @@ else !HAVE_ASCIIDOC endif !HAVE_ASCIIDOC -clean-local: - rm -f *.pdf *.html *-spellchecked - rm -f *.1 *.3 *.5 *.8 - rm -rf tmp - # NOTE: Due to portability, we do not use a GNU percent-wildcard extension: #%-spellchecked: % Makefile.am $(top_srcdir)/docs/Makefile.am $(abs_srcdir)/$(NUT_SPELL_DICT) # $(MAKE) -s -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC_ONE="$<" SPELLCHECK_DIR="$(srcdir)" $@ @@ -948,3 +945,8 @@ clean-local: spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SRC_ALL_PAGES)" SPELLCHECK_DIR="$(srcdir)" $@ + +DISTCLEANFILES = Makefile.in + +clean-local: + rm -rf tmp diff --git a/drivers/Makefile.am b/drivers/Makefile.am index c4a045d959..0126a9d8d7 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -54,7 +54,9 @@ MODBUS_DRIVERLIST = phoenixcontact_modbus generic_modbus LINUX_I2C_DRIVERLIST = asem pijuice # distribute all drivers, even ones that are not built by default -EXTRA_PROGRAMS = $(SERIAL_DRIVERLIST) $(SNMP_DRIVERLIST) $(USB_DRIVERLIST) $(SERIAL_USB_DRIVERLIST) $(NEONXML_DRIVERLIST) $(MACOSX_DRIVERLIST) +EXTRA_PROGRAMS = $(SERIAL_DRIVERLIST) $(USB_DRIVERLIST) $(SERIAL_USB_DRIVERLIST) +EXTRA_PROGRAMS += $(SNMP_DRIVERLIST) $(NEONXML_DRIVERLIST) $(MACOSX_DRIVERLIST) +EXTRA_PROGRAMS += $(LINUX_I2C_DRIVERLIST) # construct the list of drivers to build if SOME_DRIVERS @@ -325,3 +327,8 @@ libdummy_la_SOURCES = main.c dstate.c libdummy_la_LDFLAGS = -no-undefined -static libdummy_serial_la_SOURCES = serial.c libdummy_serial_la_LDFLAGS = -no-undefined -static + +CLEANFILES = $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) +DISTCLEANFILES = Makefile.in +clean-local: + rm -rf $(builddir)/.deps diff --git a/include/Makefile.am b/include/Makefile.am index 59bbfcfc57..c599805634 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,6 +4,7 @@ dist_noinst_HEADERS = attribute.h common.h extstate.h parseconf.h proto.h \ # http://www.gnu.org/software/automake/manual/automake.html#Clean BUILT_SOURCES = nut_version.h CLEANFILES = nut_version.h +DISTCLEANFILES = Makefile.in # magic to include Git version information in NUT version string # (for builds not made from the tagged commit in a Git workspace) @@ -32,7 +33,7 @@ nut_version.h: FORCE FORCE: # counter part of BUILT_SOURCES: since nut_version is not a direct -# deps of a local target, we must clean it by ourself before the +# deps of a local target, we must clean it by ourselves before the # distribution dist-hook: rm -f $(distdir)/nut_version.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 856d0db728..17335a0a8a 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -8,5 +8,5 @@ else endif endif -clean-local: - rm -f *-spellchecked +CLEANFILES = *-spellchecked +DISTCLEANFILES = Makefile.in diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 17b1dd28fb..089494a738 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -26,3 +26,5 @@ EXTRA_DIST = README \ Windows/Makefile SUBDIRS = augeas devd hotplug python systemd udev ufw Solaris upsdrvsvcctl + +DISTCLEANFILES = Makefile.in diff --git a/scripts/Solaris/Makefile.am b/scripts/Solaris/Makefile.am index b9651ef114..911e3684b7 100644 --- a/scripts/Solaris/Makefile.am +++ b/scripts/Solaris/Makefile.am @@ -84,3 +84,5 @@ check-local-solaris-smf: $(SOLARIS_SMF_MANIFESTS) echo " SVCCFG-VALIDATE $$F"; \ /usr/sbin/svccfg validate "$$F" || RES=$$? ; \ done; exit $$RES + +DISTCLEANFILES = Makefile.in diff --git a/scripts/augeas/Makefile.am b/scripts/augeas/Makefile.am index b9a6774df9..eb6fa6c494 100644 --- a/scripts/augeas/Makefile.am +++ b/scripts/augeas/Makefile.am @@ -37,5 +37,11 @@ if WITH_AUGLENS nutnutconf.aug nutupsdconf.aug nutupsmonconf.aug nutupssetconf.aug endif -clean-local: - rm -f *-spellchecked +DISTCLEANFILES = Makefile.in +CLEANFILES = *-spellchecked + +# Generated by configure script and/or autogen.sh: +DISTCLEANFILES += gen-nutupsconf-aug.py +DISTCLEANFILES += nutupsconf.aug.in + +DISTCLEANFILES += *.aug diff --git a/scripts/devd/Makefile.am b/scripts/devd/Makefile.am index e5a9bbcce9..7b64db7abb 100644 --- a/scripts/devd/Makefile.am +++ b/scripts/devd/Makefile.am @@ -9,6 +9,17 @@ endif EXTRA_DIST = README -DISTCLEANFILES = nut-usb.conf +DISTCLEANFILES = Makefile.in + +# Generated by configure script: +DISTCLEANFILES += nut-usb.conf + +# Generated by tools/nut-usbinfo.pl script among GENERATED_USB_OS_FILES: +DISTCLEANFILES += nut-usb.conf.in + # we should never remove this one, apart from a distclean-check #MAINTAINERCLEANFILES = nut-usbups.rules.in + +# What if?.. +# Generated by tools/nut-usbinfo.pl script among GENERATED_USB_OS_FILES: +DISTCLEANFILES += nut-usbups.rules.in diff --git a/scripts/hotplug/Makefile.am b/scripts/hotplug/Makefile.am index c36cd7dad1..4830418ede 100644 --- a/scripts/hotplug/Makefile.am +++ b/scripts/hotplug/Makefile.am @@ -6,6 +6,14 @@ if WITH_HOTPLUG endif EXTRA_DIST = README -DISTCLEANFILES = libhidups + +DISTCLEANFILES = Makefile.in + +# Generated by configure script: +DISTCLEANFILES += libhidups + # we should never remove this one, apart from a distclean-check #MAINTAINERCLEANFILES = libhid.usermap + +# What if?.. +DISTCLEANFILES += libhid.usermap diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index 8ab6bf6ff0..5c97a83486 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -20,3 +20,4 @@ EXTRA_DIST = README \ module/PyNUT.py.in \ module/test_nutclient.py.in +DISTCLEANFILES = Makefile.in diff --git a/scripts/systemd/Makefile.am b/scripts/systemd/Makefile.am index dfd93959bd..cab63a43ba 100644 --- a/scripts/systemd/Makefile.am +++ b/scripts/systemd/Makefile.am @@ -31,3 +31,7 @@ EXTRA_DIST += \ # NOTE: Do not EXTRA_DIST nut-common.tmpfiles.in - it is generated per build endif +DISTCLEANFILES = Makefile.in + +# Generated by configure script: +DISTCLEANFILES += nut-common.tmpfiles.in diff --git a/scripts/udev/Makefile.am b/scripts/udev/Makefile.am index 1973ccf89b..d2f022441b 100644 --- a/scripts/udev/Makefile.am +++ b/scripts/udev/Makefile.am @@ -18,7 +18,16 @@ EXTRA_DIST = README 52-nut-ipmipsu.rules: nut-ipmipsu.rules cp nut-ipmipsu.rules $@ -DISTCLEANFILES = nut-usbups.rules nut-ipmipsu.rules +DISTCLEANFILES = Makefile.in + +# Generated by configure script: +DISTCLEANFILES += nut-usbups.rules nut-ipmipsu.rules + CLEANFILES = 62-nut-usbups.rules 52-nut-ipmipsu.rules + # we should never remove this one, apart from a distclean-check #MAINTAINERCLEANFILES = nut-usbups.rules.in + +# What if?.. +# Generated by tools/nut-usbinfo.pl script among GENERATED_USB_OS_FILES: +DISTCLEANFILES += nut-usbups.rules.in diff --git a/scripts/ufw/Makefile.am b/scripts/ufw/Makefile.am index 1431357241..8130598731 100644 --- a/scripts/ufw/Makefile.am +++ b/scripts/ufw/Makefile.am @@ -1,2 +1,2 @@ -clean-local: - rm -f *-spellchecked +DISTCLEANFILES = Makefile.in +CLEANFILES = *-spellchecked diff --git a/scripts/upsdrvsvcctl/Makefile.am b/scripts/upsdrvsvcctl/Makefile.am index 7d7a0f235e..3cdb08f3e9 100644 --- a/scripts/upsdrvsvcctl/Makefile.am +++ b/scripts/upsdrvsvcctl/Makefile.am @@ -10,3 +10,4 @@ endif EXTRA_DIST += nut-driver-enumerator.sh.in upsdrvsvcctl.in +DISTCLEANFILES = Makefile.in diff --git a/server/Makefile.am b/server/Makefile.am index 76f15e6c7a..cc1a8275d8 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -33,3 +33,7 @@ upsd_SOURCES = upsd.c user.c conf.c netssl.c sstate.c desc.c \ upstype.h user-data.h user.h sockdebug_SOURCES = sockdebug.c + +DISTCLEANFILES = Makefile.in +clean-local: + rm -rf $(builddir)/.deps diff --git a/tests/Makefile.am b/tests/Makefile.am index dd2b60f11b..f60d1d3910 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -27,12 +27,14 @@ CPPUNITTESTSRC = example.cpp nutclienttest.cpp # The test driver which orchestrates running those tests above CPPUNITTESTERSRC = cpputest.cpp +TESTS_CXX11 = cppunittest + if HAVE_CXX11 if HAVE_CPPUNIT # Note: per configure script this "SHOULD" also assume # that we HAVE_CXX11 - but better have it explicit -TESTS += cppunittest +TESTS += $(TESTS_CXX11) if WITH_VALGRIND check-local: $(check_PROGRAMS) @@ -65,3 +67,8 @@ else !HAVE_CXX11 EXTRA_DIST += example.cpp cpputest.cpp endif !HAVE_CXX11 + +CLEANFILES = $(TESTS) $(TESTS_CXX11) *.trs *.log +DISTCLEANFILES = Makefile.in +clean-local: + rm -rf $(builddir)/.deps diff --git a/tools/Makefile.am b/tools/Makefile.am index 17c2252f1e..78846732b3 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -32,6 +32,10 @@ GENERATED_USB_OS_FILES += ../scripts/devd/nut-usb.conf.in # UPower output file GENERATED_USB_OS_FILES += ../scripts/upower/95-upower-hid.rules +CLEANFILES = $(GENERATED_SNMP_FILES) $(GENERATED_USB_FILES) +# We do not clean away these files, some are even tracked in Git: +#CLEANFILES += $(GENERATED_USB_OS_FILES) + all: nut-scanner-deps $(GENERATED_USB_OS_FILES) # This target is called from the making of nut-scanner to ensure its bits @@ -105,4 +109,6 @@ dist-hook: @$(distdir)/driver-list-format.sh; +DISTCLEANFILES = Makefile.in + .PHONY: nut-scanner-deps nut-scanner-snmp-deps nut-scanner-usb-deps diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 680703eb85..328c091f54 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -82,7 +82,8 @@ else dist_noinst_HEADERS += nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h endif -CLEANFILES = $(BUILT_SOURCES) +CLEANFILES = $(BUILT_SOURCES) *-spellchecked +DISTCLEANFILES = Makefile.in clean-local: - rm -f *-spellchecked + rm -rf $(builddir)/.deps From ad1716267ceab9e007f866c6c47fe9079c710b17 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 13:43:32 +0100 Subject: [PATCH 02/36] */Makefile.am: Do not clean ".deps" in SUBDIRS of the main project --- Makefile.am | 12 ++++++++++++ clients/Makefile.am | 7 +++++-- common/Makefile.am | 7 +++++-- drivers/Makefile.am | 7 +++++-- server/Makefile.am | 7 +++++-- tests/Makefile.am | 7 +++++-- tools/nut-scanner/Makefile.am | 6 ++++-- 7 files changed, 41 insertions(+), 12 deletions(-) diff --git a/Makefile.am b/Makefile.am index 6f866c1d83..ed905e3e76 100644 --- a/Makefile.am +++ b/Makefile.am @@ -70,8 +70,20 @@ DISTCLEANFILES_AUTOTOOLS += Makefile.in DISTCLEANFILES += $(DISTCLEANFILES_AUTOTOOLS) +# Do not let $SUBDIRS/Makefile rules delete their local .deps because +# this breaks our ability to clean up (e.g. some common/.../*.Plo files +# are included by generated Makefiles from other subdirectories, so they +# should be available during their clean-up). Just in case, we make sure +# here that their sub-distcleans complete first. distclean-local: + @for DIR in $(SUBDIRS) ; do \ + if test -f "$${DIR}/Makefile" ; then \ + echo " DISTCLEAN in $${DIR}" >&2 ; \ + ( cd "$${DIR}" && $(MAKE) -s distclean ) || exit ; \ + fi ; \ + done rm -rf .inst tmp autom4te.cache + find $(builddir) -type d -name '.deps' -exec rm -rf '{}' \; # Hook the documentation building and validating recipes # Note: these are optionally available (as determined during configure runs) diff --git a/clients/Makefile.am b/clients/Makefile.am index 95abcf4e34..36e5824cf1 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -96,5 +96,8 @@ EXTRA_DIST += nutclientmem.h nutclientmem.cpp endif DISTCLEANFILES = Makefile.in -clean-local: - rm -rf $(builddir)/.deps + +# NOTE: Do not clean ".deps" in SUBDIRS of the main project, +# the root Makefile.am takes care of that! +#clean-local: +# rm -rf $(builddir)/.deps diff --git a/common/Makefile.am b/common/Makefile.am index 2c29ca9bc3..4dc984c595 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -22,5 +22,8 @@ libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ libcommonclient_la_LIBADD = libparseconf.la @LTLIBOBJS@ DISTCLEANFILES = Makefile.in -clean-local: - rm -rf $(builddir)/.deps + +# NOTE: Do not clean ".deps" in SUBDIRS of the main project, +# the root Makefile.am takes care of that! +#clean-local: +# rm -rf $(builddir)/.deps diff --git a/drivers/Makefile.am b/drivers/Makefile.am index 0126a9d8d7..2fdfb575ae 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -330,5 +330,8 @@ libdummy_serial_la_LDFLAGS = -no-undefined -static CLEANFILES = $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) DISTCLEANFILES = Makefile.in -clean-local: - rm -rf $(builddir)/.deps + +# NOTE: Do not clean ".deps" in SUBDIRS of the main project, +# the root Makefile.am takes care of that! +#clean-local: +# rm -rf $(builddir)/.deps diff --git a/server/Makefile.am b/server/Makefile.am index cc1a8275d8..5cab0b210b 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -35,5 +35,8 @@ upsd_SOURCES = upsd.c user.c conf.c netssl.c sstate.c desc.c \ sockdebug_SOURCES = sockdebug.c DISTCLEANFILES = Makefile.in -clean-local: - rm -rf $(builddir)/.deps + +# NOTE: Do not clean ".deps" in SUBDIRS of the main project, +# the root Makefile.am takes care of that! +#clean-local: +# rm -rf $(builddir)/.deps diff --git a/tests/Makefile.am b/tests/Makefile.am index f60d1d3910..dc1308635f 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -70,5 +70,8 @@ endif !HAVE_CXX11 CLEANFILES = $(TESTS) $(TESTS_CXX11) *.trs *.log DISTCLEANFILES = Makefile.in -clean-local: - rm -rf $(builddir)/.deps + +# NOTE: Do not clean ".deps" in SUBDIRS of the main project, +# the root Makefile.am takes care of that! +#clean-local: +# rm -rf $(builddir)/.deps diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 328c091f54..1b2fae6311 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -85,5 +85,7 @@ endif CLEANFILES = $(BUILT_SOURCES) *-spellchecked DISTCLEANFILES = Makefile.in -clean-local: - rm -rf $(builddir)/.deps +# NOTE: Do not clean ".deps" in SUBDIRS of the main project, +# the root Makefile.am takes care of that! +#clean-local: +# rm -rf $(builddir)/.deps From 1a42889a11308b390a9885835e49532be1cd9d98 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 14:09:00 +0100 Subject: [PATCH 03/36] tests/Makefile.am: symlink source used from another directory into current builddir, do avoid external ".deps/" usage --- tests/Makefile.am | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index dc1308635f..d4b68c420c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -5,6 +5,7 @@ all: $(TESTS) EXTRA_DIST = nut-driver-enumerator-test.sh nut-driver-enumerator-test--ups.conf TESTS = nutlogtest getvaluetest +CLEANFILES = *.trs *.log AM_CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/drivers AM_CXXFLAGS = -I$(top_srcdir)/include @@ -14,7 +15,12 @@ check_PROGRAMS = $(TESTS) nutlogtest_SOURCES = nutlogtest.c nutlogtest_LDADD = $(top_builddir)/common/libcommon.la -getvaluetest_SOURCES = getvaluetest.c $(top_srcdir)/drivers/hidparser.c +# Separate the .deps of other dirs from this one +LINKED_SOURCE_FILES = hidparser.c +hidparser.c: $(top_srcdir)/drivers/hidparser.c + ln -s $< $@ + +getvaluetest_SOURCES = getvaluetest.c hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la # Make sure out-of-dir dependencies exist (especially when dev-building parts): @@ -68,7 +74,8 @@ EXTRA_DIST += example.cpp cpputest.cpp endif !HAVE_CXX11 -CLEANFILES = $(TESTS) $(TESTS_CXX11) *.trs *.log +CLEANFILES += $(LINKED_SOURCE_FILES) +CLEANFILES += $(TESTS) $(TESTS_CXX11) DISTCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, From c3a50250ae3a2b88097bbed84907aef04a3f9e54 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 14:09:15 +0100 Subject: [PATCH 04/36] tools/nut-scanner/Makefile.am: symlink source used from another directory into current builddir, do avoid external ".deps/" usage --- tools/nut-scanner/Makefile.am | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 1b2fae6311..706f9d7d2f 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -7,6 +7,7 @@ NUT_SCANNER_DEPS_C = NUT_SCANNER_DEPS = $(NUT_SCANNER_DEPS_H) $(NUT_SCANNER_DEPS_C) BUILT_SOURCES = $(NUT_SCANNER_DEPS) +CLEANFILES = $(BUILT_SOURCES) # Make sure we have the freshest files (no-op if built earlier and then # no driver sources and other dependencies were edited by a developer) @@ -21,7 +22,28 @@ $(top_builddir)/common/libcommon.la: # '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 +common.c nut-scanner.c: $(top_builddir)/include/nut_version.h + +LINKED_SOURCE_FILES = + +# Separate the .deps of other dirs from this one +LINKED_SOURCE_FILES += serial.c +serial.c: $(top_srcdir)/drivers/serial.c + ln -s $< $@ + +LINKED_SOURCE_FILES += bcmxcp_ser.c +bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c + ln -s $< $@ + +LINKED_SOURCE_FILES += common.c +common.c: $(top_srcdir)/common/common.c + ln -s $< $@ + +LINKED_SOURCE_FILES += str.c +str.c: $(top_srcdir)/common/str.c + ln -s $< $@ + +CLEANFILES += $(LINKED_SOURCE_FILES) $(top_builddir)/include/nut_version.h: @cd $(@D) && $(MAKE) -s $(@F) @@ -35,9 +57,7 @@ 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 \ - $(top_srcdir)/drivers/serial.c \ - $(top_srcdir)/drivers/bcmxcp_ser.c \ - $(top_srcdir)/common/common.c $(top_srcdir)/common/str.c + $(LINKED_SOURCE_FILES) libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) # # Below we set API versions of public libraries @@ -82,7 +102,7 @@ else dist_noinst_HEADERS += nut-scan.h nutscan-device.h nutscan-ip.h nutscan-init.h nutscan-serial.h endif -CLEANFILES = $(BUILT_SOURCES) *-spellchecked +CLEANFILES += *-spellchecked DISTCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, From b70ebdfc57c985ab72d7d10ef7a3315e3b527ebf Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 14:37:53 +0100 Subject: [PATCH 05/36] Makefile.am: distclean-local: first find(), then rm() the findings (find-recursion fails otherwise) --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index ed905e3e76..a74481a8ef 100644 --- a/Makefile.am +++ b/Makefile.am @@ -83,7 +83,7 @@ distclean-local: fi ; \ done rm -rf .inst tmp autom4te.cache - find $(builddir) -type d -name '.deps' -exec rm -rf '{}' \; + find "$(builddir)" -type d -name '.deps' | while read DIR ; do rm -rf "$${DIR}" ; done # Hook the documentation building and validating recipes # Note: these are optionally available (as determined during configure runs) From b0d020b27ac035a0e503fa11ba8053652e47a53b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 14:38:27 +0100 Subject: [PATCH 06/36] tests/Makefile.am: quote pathnames, and force the symlink (to overwrite older if any) --- tests/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index d4b68c420c..9940755ddc 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -17,8 +17,9 @@ nutlogtest_LDADD = $(top_builddir)/common/libcommon.la # Separate the .deps of other dirs from this one LINKED_SOURCE_FILES = hidparser.c + hidparser.c: $(top_srcdir)/drivers/hidparser.c - ln -s $< $@ + ln -s -f "$<" "$@" getvaluetest_SOURCES = getvaluetest.c hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la From 5a52b2b0babf4d689b9cdc779da177f392539e2c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 14:38:37 +0100 Subject: [PATCH 07/36] tools/nut-scanner/Makefile.am: quote pathnames, and force the symlink (to overwrite older if any) --- tools/nut-scanner/Makefile.am | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 706f9d7d2f..54aa63f565 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -29,19 +29,19 @@ LINKED_SOURCE_FILES = # Separate the .deps of other dirs from this one LINKED_SOURCE_FILES += serial.c serial.c: $(top_srcdir)/drivers/serial.c - ln -s $< $@ + ln -s -f "$<" "$@" LINKED_SOURCE_FILES += bcmxcp_ser.c bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c - ln -s $< $@ + ln -s -f "$<" "$@" LINKED_SOURCE_FILES += common.c common.c: $(top_srcdir)/common/common.c - ln -s $< $@ + ln -s -f "$<" "$@" LINKED_SOURCE_FILES += str.c str.c: $(top_srcdir)/common/str.c - ln -s $< $@ + ln -s -f "$<" "$@" CLEANFILES += $(LINKED_SOURCE_FILES) From d8efa3e868a025005290a7c4235ac56b531be00a Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 15:05:45 +0100 Subject: [PATCH 08/36] tests/Makefile.am: work around dmake bugs --- tests/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 9940755ddc..668580d634 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -18,8 +18,10 @@ nutlogtest_LDADD = $(top_builddir)/common/libcommon.la # Separate the .deps of other dirs from this one LINKED_SOURCE_FILES = hidparser.c +# NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver +# of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS hidparser.c: $(top_srcdir)/drivers/hidparser.c - ln -s -f "$<" "$@" + ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" getvaluetest_SOURCES = getvaluetest.c hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la From d6923b5114873882d4fcd7d711858ae3db633453 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 15:05:56 +0100 Subject: [PATCH 09/36] tools/nut-scanner/Makefile.am: work around dmake bugs --- tools/nut-scanner/Makefile.am | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 54aa63f565..ce50ffb53b 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -27,21 +27,23 @@ common.c nut-scanner.c: $(top_builddir)/include/nut_version.h LINKED_SOURCE_FILES = # Separate the .deps of other dirs from this one +# NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver +# of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS LINKED_SOURCE_FILES += serial.c serial.c: $(top_srcdir)/drivers/serial.c - ln -s -f "$<" "$@" + ln -s -f "$(top_srcdir)/drivers/serial.c" "$@" LINKED_SOURCE_FILES += bcmxcp_ser.c bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c - ln -s -f "$<" "$@" + ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@" LINKED_SOURCE_FILES += common.c common.c: $(top_srcdir)/common/common.c - ln -s -f "$<" "$@" + ln -s -f "$(top_srcdir)/common/common.c" "$@" LINKED_SOURCE_FILES += str.c str.c: $(top_srcdir)/common/str.c - ln -s -f "$<" "$@" + ln -s -f "$(top_srcdir)/common/str.c" "$@" CLEANFILES += $(LINKED_SOURCE_FILES) From a908b93c9d0ca39c86b690c7e392877c838033b7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 15:23:05 +0100 Subject: [PATCH 10/36] tests/Makefile.am: make sure to symlink sources into $(builddir)/ --- tests/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 668580d634..fdd75d07e3 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,14 +16,14 @@ nutlogtest_SOURCES = nutlogtest.c nutlogtest_LDADD = $(top_builddir)/common/libcommon.la # Separate the .deps of other dirs from this one -LINKED_SOURCE_FILES = hidparser.c +LINKED_SOURCE_FILES = $(builddir)/hidparser.c # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -hidparser.c: $(top_srcdir)/drivers/hidparser.c +$(builddir)/hidparser.c: $(top_srcdir)/drivers/hidparser.c ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" -getvaluetest_SOURCES = getvaluetest.c hidparser.c +getvaluetest_SOURCES = getvaluetest.c $(builddir)/hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la # Make sure out-of-dir dependencies exist (especially when dev-building parts): From de79263d3492c2314582fa6e846dd2b9def02280 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 15:23:19 +0100 Subject: [PATCH 11/36] tools/nut-scanner/Makefile.am: make sure to symlink sources into $(builddir)/ --- tools/nut-scanner/Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index ce50ffb53b..667a715ad2 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -29,20 +29,20 @@ LINKED_SOURCE_FILES = # Separate the .deps of other dirs from this one # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -LINKED_SOURCE_FILES += serial.c -serial.c: $(top_srcdir)/drivers/serial.c +LINKED_SOURCE_FILES += $(builddir)/serial.c +$(builddir)/serial.c: $(top_srcdir)/drivers/serial.c ln -s -f "$(top_srcdir)/drivers/serial.c" "$@" -LINKED_SOURCE_FILES += bcmxcp_ser.c -bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c +LINKED_SOURCE_FILES += $(builddir)/bcmxcp_ser.c +$(builddir)/bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@" -LINKED_SOURCE_FILES += common.c -common.c: $(top_srcdir)/common/common.c +LINKED_SOURCE_FILES += $(builddir)/common.c +$(builddir)/common.c: $(top_srcdir)/common/common.c ln -s -f "$(top_srcdir)/common/common.c" "$@" -LINKED_SOURCE_FILES += str.c -str.c: $(top_srcdir)/common/str.c +LINKED_SOURCE_FILES += $(builddir)/str.c +$(builddir)/str.c: $(top_srcdir)/common/str.c ln -s -f "$(top_srcdir)/common/str.c" "$@" CLEANFILES += $(LINKED_SOURCE_FILES) From 32ab475588f8a74bca933e935f93d05aa8304e31 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 16:05:51 +0100 Subject: [PATCH 12/36] tests/Makefile.am: revise the magic of LINKED_SOURCE_FILES for distcheck --- tests/Makefile.am | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index fdd75d07e3..02569a034e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,14 +16,15 @@ nutlogtest_SOURCES = nutlogtest.c nutlogtest_LDADD = $(top_builddir)/common/libcommon.la # Separate the .deps of other dirs from this one -LINKED_SOURCE_FILES = $(builddir)/hidparser.c +LINKED_SOURCE_FILES = ./hidparser.c # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -$(builddir)/hidparser.c: $(top_srcdir)/drivers/hidparser.c +./hidparser.c: $(top_srcdir)/drivers/hidparser.c + rm -f "$@" ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" -getvaluetest_SOURCES = getvaluetest.c $(builddir)/hidparser.c +getvaluetest_SOURCES = getvaluetest.c ./hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la # Make sure out-of-dir dependencies exist (especially when dev-building parts): From af13c91be6c46c51782360422ea2ebeed51d548d Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 16:06:01 +0100 Subject: [PATCH 13/36] tools/nut-scanner/Makefile.am: revise the magic of LINKED_SOURCE_FILES for distcheck --- tools/nut-scanner/Makefile.am | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 667a715ad2..dbe253b524 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -29,20 +29,24 @@ LINKED_SOURCE_FILES = # Separate the .deps of other dirs from this one # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -LINKED_SOURCE_FILES += $(builddir)/serial.c -$(builddir)/serial.c: $(top_srcdir)/drivers/serial.c +LINKED_SOURCE_FILES += ./serial.c +./serial.c: $(top_srcdir)/drivers/serial.c + rm -f "$@" ln -s -f "$(top_srcdir)/drivers/serial.c" "$@" -LINKED_SOURCE_FILES += $(builddir)/bcmxcp_ser.c -$(builddir)/bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c +LINKED_SOURCE_FILES += ./bcmxcp_ser.c +./bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c + rm -f "$@" ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@" -LINKED_SOURCE_FILES += $(builddir)/common.c -$(builddir)/common.c: $(top_srcdir)/common/common.c +LINKED_SOURCE_FILES += ./common.c +./common.c: $(top_srcdir)/common/common.c + rm -f "$@" ln -s -f "$(top_srcdir)/common/common.c" "$@" -LINKED_SOURCE_FILES += $(builddir)/str.c -$(builddir)/str.c: $(top_srcdir)/common/str.c +LINKED_SOURCE_FILES += ./str.c +./str.c: $(top_srcdir)/common/str.c + rm -f "$@" ln -s -f "$(top_srcdir)/common/str.c" "$@" CLEANFILES += $(LINKED_SOURCE_FILES) From 420a6e6d22eb89ca6ec91cf9c314fa314a515f0b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 16:08:18 +0100 Subject: [PATCH 14/36] ci_build.sh: add a DO_DISTCHECK_CLEAN to make sure we clean everything made, and no more (after any distcheck) --- ci_build.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ci_build.sh b/ci_build.sh index 8f29b81626..890c3fdf5d 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -827,6 +827,33 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp echo "=== Are GitIgnores good after '$MAKE distcheck'? (should have no output below)" git status -s || true echo "===" + + if [ -n "`git status -s`" ] && [ "$CI_REQUIRE_GOOD_GITIGNORE" != false ]; then + echo "FATAL: There are changes in some files listed above - tracked sources should be updated in the PR, and build products should be added to a .gitignore file!" >&2 + git diff || true + echo "===" + exit 1 + fi + + if [ "$DO_DISTCHECK_CLEAN" == "no" ] ; then + echo "Skipping distclean check (doc generation is disabled, it would fail)" + else + [ -z "$CI_TIME" ] || echo "`date`: Starting distclean check of currently tested project..." + + # Note: currently Makefile.am has just a dummy "distcleancheck" rule + $CI_TIME $MAKE VERBOSE=1 DISTCHECK_FLAGS="$DISTCHECK_FLAGS" $PARMAKE_FLAGS distclean + + echo "=== Are GitIgnores good after '$MAKE distclean'? (should have no output below)" + git status --ignored -s || true + echo "===" + + if [ -n "`git status --ignored -s`" ] && [ "$CI_REQUIRE_GOOD_GITIGNORE" != false ]; then + echo "FATAL: There are changes in some files listed above - tracked sources should be updated in the PR, and build products should be added to a .gitignore file, everything made should be cleaned and no tracked files should be removed!" >&2 + git diff || true + echo "===" + exit 1 + fi + fi ) fi From 1ef745306f3f8439c8aac11965ff8734c03c5568 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 16:11:08 +0100 Subject: [PATCH 15/36] tests/Makefile.am: revise the magic of LINKED_SOURCE_FILES for distcheck --- tests/Makefile.am | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 02569a034e..b701759061 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -21,8 +21,7 @@ LINKED_SOURCE_FILES = ./hidparser.c # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS ./hidparser.c: $(top_srcdir)/drivers/hidparser.c - rm -f "$@" - ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" + test -s "$@" || ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" getvaluetest_SOURCES = getvaluetest.c ./hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la From fbe707f5214025e09bcb8547c04df7037dc2f762 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 16:11:15 +0100 Subject: [PATCH 16/36] tools/nut-scanner/Makefile.am: revise the magic of LINKED_SOURCE_FILES for distcheck --- tools/nut-scanner/Makefile.am | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index dbe253b524..874eead92b 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -31,23 +31,19 @@ LINKED_SOURCE_FILES = # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS LINKED_SOURCE_FILES += ./serial.c ./serial.c: $(top_srcdir)/drivers/serial.c - rm -f "$@" - ln -s -f "$(top_srcdir)/drivers/serial.c" "$@" + test -s "$@" || ln -s -f "$(top_srcdir)/drivers/serial.c" "$@" LINKED_SOURCE_FILES += ./bcmxcp_ser.c ./bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c - rm -f "$@" - ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@" + test -s "$@" || ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@" LINKED_SOURCE_FILES += ./common.c ./common.c: $(top_srcdir)/common/common.c - rm -f "$@" - ln -s -f "$(top_srcdir)/common/common.c" "$@" + test -s "$@" || ln -s -f "$(top_srcdir)/common/common.c" "$@" LINKED_SOURCE_FILES += ./str.c ./str.c: $(top_srcdir)/common/str.c - rm -f "$@" - ln -s -f "$(top_srcdir)/common/str.c" "$@" + test -s "$@" || ln -s -f "$(top_srcdir)/common/str.c" "$@" CLEANFILES += $(LINKED_SOURCE_FILES) From b86c605a3b8d4dfdd0dbcf85d45beea67a03c40e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 20:57:47 +0100 Subject: [PATCH 17/36] ci_build.sh: configure_nut(): call ./autogen.sh before CONFIGURE_SCRIPT if there is no configure script --- ci_build.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ci_build.sh b/ci_build.sh index 890c3fdf5d..201e8ebf34 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -220,6 +220,19 @@ configure_nut() { CONFIGURE_SCRIPT=./configure.bat fi + if [ ! -s "$CONFIGURE_SCRIPT" ]; then + # Note: modern auto(re)conf requires pkg-config to generate the configure + # script, so to stage the situation of building without one (as if on an + # older system) we have to remove it when we already have the script. + # This matches the use-case of distro-building from release tarballs that + # include all needed pre-generated files to rely less on OS facilities. + if [ "$CI_OS_NAME" = "windows" ] ; then + $CI_TIME ./autogen.sh || true + else + $CI_TIME ./autogen.sh ### 2>/dev/null + fi || exit + fi + # Help copy-pasting build setups from CI logs to terminal: local CONFIG_OPTS_STR="`for F in "${CONFIG_OPTS[@]}" ; do echo "'$F' " ; done`" ### | tr '\n' ' '`" echo "=== CONFIGURING NUT: $CONFIGURE_SCRIPT ${CONFIG_OPTS_STR}" From d3d18ae21dfe0a6c7951383625a832a9a0284e27 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 21:00:28 +0100 Subject: [PATCH 18/36] ci_build.sh: only call dpkg if present --- ci_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci_build.sh b/ci_build.sh index 201e8ebf34..5cfc43f8f4 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -655,7 +655,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp else $CI_TIME ./autogen.sh ### 2>/dev/null fi - if [ "$NO_PKG_CONFIG" == "true" ] && [ "$CI_OS_NAME" = "linux" ] ; then + if [ "$NO_PKG_CONFIG" == "true" ] && [ "$CI_OS_NAME" = "linux" ] && (command -v dpkg) ; then echo "NO_PKG_CONFIG==true : BUTCHER pkg-config for this test case" >&2 sudo dpkg -r --force all pkg-config fi From 8574a6fae5ca226a0e2eda0b54377eeaff6eaec3 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 21:06:26 +0100 Subject: [PATCH 19/36] tests/Makefile.am: use BUILT_SOURCES=LINKED_SOURCE_FILES to avoid dist-ing temporary symlinks as files --- tests/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index b701759061..a246fdf058 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -77,6 +77,7 @@ EXTRA_DIST += example.cpp cpputest.cpp endif !HAVE_CXX11 +BUILT_SOURCES = $(LINKED_SOURCE_FILES) CLEANFILES += $(LINKED_SOURCE_FILES) CLEANFILES += $(TESTS) $(TESTS_CXX11) DISTCLEANFILES = Makefile.in From 31ae226dd4ff91f5d885a214ff4db4f94b0736e6 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Fri, 5 Nov 2021 21:06:40 +0100 Subject: [PATCH 20/36] tools/nut-scanner/Makefile.am: use BUILT_SOURCES=LINKED_SOURCE_FILES to avoid dist-ing temporary symlinks as files --- tools/nut-scanner/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 874eead92b..071eeebe26 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -46,6 +46,7 @@ LINKED_SOURCE_FILES += ./str.c test -s "$@" || ln -s -f "$(top_srcdir)/common/str.c" "$@" CLEANFILES += $(LINKED_SOURCE_FILES) +BUILT_SOURCES += $(LINKED_SOURCE_FILES) $(top_builddir)/include/nut_version.h: @cd $(@D) && $(MAKE) -s $(@F) From 42bb19a4e2e78d76ab2094865aa316c8d71a0e6b Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:06:24 +0100 Subject: [PATCH 21/36] Makefile.am: delete the configure script and its components not in a "make distclean" but in "make realclean" --- Makefile.am | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index a74481a8ef..70e9ed0b0f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -53,22 +53,26 @@ distcleancheck: # Files made by our targets: CLEANFILES = *-spellchecked cppcheck*.xml -DISTCLEANFILES = ChangeLog INSTALL -# Most of the files generated by custom rules in the configure script -# or by autogen.sh are cleaned by the Makefile.am in their directories: -DISTCLEANFILES += tools/gitlog2changelog.py -DISTCLEANFILES += tools/nut-snmpinfo.py +DISTCLEANFILES = ChangeLog -# Files made by autotools and common rituals of the configure script: -DISTCLEANFILES_AUTOTOOLS = aclocal.m4 config.guess config.log config.sub -DISTCLEANFILES_AUTOTOOLS += configure configure~ +# Most of the files generated by custom rules in the configure script +# or by autogen.sh are cleaned by the Makefile.am in their directories. +# Files below are re-created by running `configure` script and may be +# wiped by a `make distclean`: +DISTCLEANFILES += Makefile.in +DISTCLEANFILES += config.guess config.log config.sub configure~ #???# configure.ac~ -DISTCLEANFILES_AUTOTOOLS += depcomp install-sh ltmain.sh missing test-driver -DISTCLEANFILES_AUTOTOOLS += m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 -DISTCLEANFILES_AUTOTOOLS += include/config.h.in include/config.h.in~ -DISTCLEANFILES_AUTOTOOLS += Makefile.in - -DISTCLEANFILES += $(DISTCLEANFILES_AUTOTOOLS) +DISTCLEANFILES += include/config.h.in include/config.h.in~ + +# Files made by autotools and common rituals of the configure script, +# these are needed to run the configure script itself so are not wiped +# by a mere `make distclean`; most of these are copied by autotools +# from their installation on the system which generates `configure`: +REALCLEANFILES = INSTALL +REALCLEANFILES += aclocal.m4 +REALCLEANFILES += configure +REALCLEANFILES += depcomp install-sh ltmain.sh missing test-driver +REALCLEANFILES += m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 # Do not let $SUBDIRS/Makefile rules delete their local .deps because # this breaks our ability to clean up (e.g. some common/.../*.Plo files From 96ce6f8252603355b0c8893a9bd26b0fa56193a9 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:06:52 +0100 Subject: [PATCH 22/36] Makefile.am: regenerate the helper needed for ChangeLog if cleaned away --- Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.am b/Makefile.am index 70e9ed0b0f..961a302013 100644 --- a/Makefile.am +++ b/Makefile.am @@ -175,6 +175,9 @@ ChangeLog: tools/gitlog2changelog.py dummy-stamp nut_version.h include/nut_version.h: cd $(abs_top_builddir)/include && $(MAKE) nut_version.h +tools/gitlog2changelog.py: tools/gitlog2changelog.py.in + cd $(@D) && $(MAKE) -s $(@F) + # ---------------------------------------------------------------------- # Maintainers targets: distribution signature and hashes dist-sig: From 36a59ec6559e35eb49b5d9fb4d7251ac7e48c882 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:08:16 +0100 Subject: [PATCH 23/36] ci_build.sh: change the cleanliness check from "distcheck" to "realcheck" and factor into a method --- ci_build.sh | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index 5cfc43f8f4..629e15691d 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -265,6 +265,29 @@ build_to_only_catch_errors() { return 0 } +optional_realclean_check() { + if [ "${DO_REALCHECK_CLEAN-}" = "no" ] ; then + echo "Skipping realclean check because recipe/developer said so" + else + [ -z "$CI_TIME" ] || echo "`date`: Starting realclean check of currently tested project..." + + # Note: currently Makefile.am has just a dummy "realcleancheck" rule + $CI_TIME $MAKE VERBOSE=1 DISTCHECK_FLAGS="$DISTCHECK_FLAGS" $PARMAKE_FLAGS realclean || return + + echo "=== Are GitIgnores good after '$MAKE realclean'? (should have no output below)" + git status --ignored -s || true + echo "===" + + if [ -n "`git status --ignored -s`" ] && [ "$CI_REQUIRE_GOOD_GITIGNORE" != false ]; then + echo "FATAL: There are changes in some files listed above - tracked sources should be updated in the PR, and build products should be added to a .gitignore file, everything made should be cleaned and no tracked files should be removed!" >&2 + git diff || true + echo "===" + return 1 + fi + fi + return 0 +} + echo "Processing BUILD_TYPE='${BUILD_TYPE}' ..." echo "Build host settings:" @@ -848,25 +871,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp exit 1 fi - if [ "$DO_DISTCHECK_CLEAN" == "no" ] ; then - echo "Skipping distclean check (doc generation is disabled, it would fail)" - else - [ -z "$CI_TIME" ] || echo "`date`: Starting distclean check of currently tested project..." - - # Note: currently Makefile.am has just a dummy "distcleancheck" rule - $CI_TIME $MAKE VERBOSE=1 DISTCHECK_FLAGS="$DISTCHECK_FLAGS" $PARMAKE_FLAGS distclean - - echo "=== Are GitIgnores good after '$MAKE distclean'? (should have no output below)" - git status --ignored -s || true - echo "===" - - if [ -n "`git status --ignored -s`" ] && [ "$CI_REQUIRE_GOOD_GITIGNORE" != false ]; then - echo "FATAL: There are changes in some files listed above - tracked sources should be updated in the PR, and build products should be added to a .gitignore file, everything made should be cleaned and no tracked files should be removed!" >&2 - git diff || true - echo "===" - exit 1 - fi - fi + optional_realclean_check || exit ) fi From 5cfddbc856e625866dc4fc053475c3d1850a60e4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:08:39 +0100 Subject: [PATCH 24/36] tools/Makefile.am: distclean the helper scripts that can be re-made --- tools/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/Makefile.am b/tools/Makefile.am index 78846732b3..e0ec5c720e 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -110,5 +110,7 @@ dist-hook: @$(distdir)/driver-list-format.sh; DISTCLEANFILES = Makefile.in +DISTCLEANFILES += gitlog2changelog.py +DISTCLEANFILES += nut-snmpinfo.py .PHONY: nut-scanner-deps nut-scanner-snmp-deps nut-scanner-usb-deps From 2ff03895e755cf9a61fc376af75fb4a1c4c9853c Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:11:46 +0100 Subject: [PATCH 25/36] ci_build.sh: call optional_realclean_check() after more build variants --- ci_build.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index 629e15691d..f3ef049653 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -714,6 +714,9 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp echo "CCache stats after build:" ccache -s fi + + optional_realclean_check || exit + echo "=== Exiting after the custom-build target '$MAKE $BUILD_TGT' succeeded OK" exit 0 ;; @@ -813,6 +816,11 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp RES=$? FAILED="${FAILED} NUT_SSL_VARIANT=${NUT_SSL_VARIANT}[build]" } + + optional_realclean_check || { + RES=$? + FAILED="${FAILED} NUT_SSL_VARIANT=${NUT_SSL_VARIANT}[realclean]" + } done # TODO: Similar loops for other variations like TESTING, # MGE SHUT vs other serial protocols, libusb version... @@ -870,11 +878,11 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp echo "===" exit 1 fi - - optional_realclean_check || exit ) fi + optional_realclean_check || exit + if [ "$HAVE_CCACHE" = yes ]; then echo "CCache stats after build:" ccache -s From f4aaa4fd8a3b2e43a01b0981a6fcb8d1dad72232 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:13:32 +0100 Subject: [PATCH 26/36] tests/Makefile.am: restore use of $(builddir) for LINKED_SOURCE_FILES --- tests/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index a246fdf058..74c4ef3e07 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -16,14 +16,14 @@ nutlogtest_SOURCES = nutlogtest.c nutlogtest_LDADD = $(top_builddir)/common/libcommon.la # Separate the .deps of other dirs from this one -LINKED_SOURCE_FILES = ./hidparser.c +LINKED_SOURCE_FILES = $(builddir)/hidparser.c # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -./hidparser.c: $(top_srcdir)/drivers/hidparser.c +$(builddir)/hidparser.c: $(top_srcdir)/drivers/hidparser.c test -s "$@" || ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" -getvaluetest_SOURCES = getvaluetest.c ./hidparser.c +getvaluetest_SOURCES = getvaluetest.c $(builddir)/hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la # Make sure out-of-dir dependencies exist (especially when dev-building parts): From d18543e6d3e98672cf625cc93de71e5010bc4ac4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:14:12 +0100 Subject: [PATCH 27/36] tools/nut-scanner/Makefile.am: restore use of $(builddir) for LINKED_SOURCE_FILES --- tools/nut-scanner/Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 071eeebe26..352c795aa7 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -29,20 +29,20 @@ LINKED_SOURCE_FILES = # Separate the .deps of other dirs from this one # NOTE: Not using "$<" due to a legacy Sun/illumos dmake bug with resolver # of dynamic vars, see e.g. https://man.omnios.org/man1/make#BUGS -LINKED_SOURCE_FILES += ./serial.c -./serial.c: $(top_srcdir)/drivers/serial.c +LINKED_SOURCE_FILES += $(builddir)/serial.c +$(builddir)/serial.c: $(top_srcdir)/drivers/serial.c test -s "$@" || ln -s -f "$(top_srcdir)/drivers/serial.c" "$@" -LINKED_SOURCE_FILES += ./bcmxcp_ser.c -./bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c +LINKED_SOURCE_FILES += $(builddir)/bcmxcp_ser.c +$(builddir)/bcmxcp_ser.c: $(top_srcdir)/drivers/bcmxcp_ser.c test -s "$@" || ln -s -f "$(top_srcdir)/drivers/bcmxcp_ser.c" "$@" -LINKED_SOURCE_FILES += ./common.c -./common.c: $(top_srcdir)/common/common.c +LINKED_SOURCE_FILES += $(builddir)/common.c +$(builddir)/common.c: $(top_srcdir)/common/common.c test -s "$@" || ln -s -f "$(top_srcdir)/common/common.c" "$@" -LINKED_SOURCE_FILES += ./str.c -./str.c: $(top_srcdir)/common/str.c +LINKED_SOURCE_FILES += $(builddir)/str.c +$(builddir)/str.c: $(top_srcdir)/common/str.c test -s "$@" || ln -s -f "$(top_srcdir)/common/str.c" "$@" CLEANFILES += $(LINKED_SOURCE_FILES) From 1d398c0cd1fe3b4014fc8308c82a3edc59ef9599 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:16:23 +0100 Subject: [PATCH 28/36] Makefile.am: do not "distclean" away some more parts of "configure" script ecosystem (leave that to "realclean") --- Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 961a302013..65071596ab 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,7 +60,7 @@ DISTCLEANFILES = ChangeLog # Files below are re-created by running `configure` script and may be # wiped by a `make distclean`: DISTCLEANFILES += Makefile.in -DISTCLEANFILES += config.guess config.log config.sub configure~ +DISTCLEANFILES += config.log configure~ #???# configure.ac~ DISTCLEANFILES += include/config.h.in include/config.h.in~ @@ -69,7 +69,7 @@ DISTCLEANFILES += include/config.h.in include/config.h.in~ # by a mere `make distclean`; most of these are copied by autotools # from their installation on the system which generates `configure`: REALCLEANFILES = INSTALL -REALCLEANFILES += aclocal.m4 +REALCLEANFILES += aclocal.m4 config.guess config.sub REALCLEANFILES += configure REALCLEANFILES += depcomp install-sh ltmain.sh missing test-driver REALCLEANFILES += m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 From c63c7eb4cc0e15b2bdc4257fc09ada79d022a886 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 10:39:18 +0100 Subject: [PATCH 29/36] */Makefile.am: reshuffle what we remove as part of "make distclean" vs. "make realclean" (can be remade only by autogen.sh) --- Makefile.am | 8 +++++--- clients/Makefile.am | 2 +- common/Makefile.am | 2 +- conf/Makefile.am | 2 +- data/Makefile.am | 2 +- data/html/Makefile.am | 4 ++-- docs/Makefile.am | 4 ++-- docs/cables/Makefile.am | 2 +- docs/man/Makefile.am | 2 +- drivers/Makefile.am | 2 +- include/Makefile.am | 2 +- lib/Makefile.am | 2 +- scripts/Makefile.am | 2 +- scripts/Solaris/Makefile.am | 2 +- scripts/augeas/Makefile.am | 10 ++++++---- scripts/devd/Makefile.am | 15 +++++++-------- scripts/hotplug/Makefile.am | 10 ++++++---- scripts/python/Makefile.am | 2 +- scripts/systemd/Makefile.am | 6 +++--- scripts/udev/Makefile.am | 11 ++++++----- scripts/ufw/Makefile.am | 2 +- scripts/upsdrvsvcctl/Makefile.am | 2 +- server/Makefile.am | 2 +- tests/Makefile.am | 2 +- tools/Makefile.am | 7 +++++-- tools/nut-scanner/Makefile.am | 2 +- 26 files changed, 59 insertions(+), 50 deletions(-) diff --git a/Makefile.am b/Makefile.am index 65071596ab..0e0d1cc0a8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -59,20 +59,22 @@ DISTCLEANFILES = ChangeLog # or by autogen.sh are cleaned by the Makefile.am in their directories. # Files below are re-created by running `configure` script and may be # wiped by a `make distclean`: -DISTCLEANFILES += Makefile.in DISTCLEANFILES += config.log configure~ #???# configure.ac~ -DISTCLEANFILES += include/config.h.in include/config.h.in~ +DISTCLEANFILES += include/config.h.in~ # Files made by autotools and common rituals of the configure script, # these are needed to run the configure script itself so are not wiped # by a mere `make distclean`; most of these are copied by autotools -# from their installation on the system which generates `configure`: +# from their installation, or made by `automake` etc. on the system +# which generates `configure`; rebuilding NUT after deleting these +# requires `autogen.sh` script to be re-run (and tools available): REALCLEANFILES = INSTALL REALCLEANFILES += aclocal.m4 config.guess config.sub REALCLEANFILES += configure REALCLEANFILES += depcomp install-sh ltmain.sh missing test-driver REALCLEANFILES += m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 +REALCLEANFILES += Makefile.in include/config.h.in # Do not let $SUBDIRS/Makefile rules delete their local .deps because # this breaks our ability to clean up (e.g. some common/.../*.Plo files diff --git a/clients/Makefile.am b/clients/Makefile.am index 36e5824cf1..b7ee8f1ba2 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -95,7 +95,7 @@ else EXTRA_DIST += nutclientmem.h nutclientmem.cpp endif -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/common/Makefile.am b/common/Makefile.am index 4dc984c595..257d226271 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -21,7 +21,7 @@ libcommonclient_la_SOURCES = common.c state.c str.c libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ libcommonclient_la_LIBADD = libparseconf.la @LTLIBOBJS@ -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/conf/Makefile.am b/conf/Makefile.am index d3606734ce..51b2f0d823 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -37,5 +37,5 @@ spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_DIR="$(srcdir)" $@ -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in CLEANFILES = *.pdf *.html *-spellchecked diff --git a/data/Makefile.am b/data/Makefile.am index d96509e5c0..46f3497ec0 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -16,5 +16,5 @@ cmdvartab-spellchecked: cmdvartab Makefile.am $(top_srcdir)/docs/Makefile.am $(a spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="cmdvartab" SPELLCHECK_DIR="$(srcdir)" $@ -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in CLEANFILES = *.pdf *.html *-spellchecked diff --git a/data/html/Makefile.am b/data/html/Makefile.am index b6a3484192..955e80a72b 100644 --- a/data/html/Makefile.am +++ b/data/html/Makefile.am @@ -6,6 +6,6 @@ if WITH_CGI endif EXTRA_DIST = README -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # Generated by configure script: -DISTCLEANFILES += header.html +DISTCLEANFILES = header.html diff --git a/docs/Makefile.am b/docs/Makefile.am index 3e3216f4a7..9e535c530d 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,4 +1,4 @@ -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in EXTRA_DIST = # Is "egrep == grep -E" always valid? (maybe all a job for configure.ac) @@ -370,7 +370,7 @@ $(abs_builddir)/$(NUT_SPELL_DICT).sorted: $(abs_srcdir)/$(NUT_SPELL_DICT) cp -f "$(abs_builddir)/$(NUT_SPELL_DICT).bak-pre-sorting" "$(abs_srcdir)/" || true ; \ fi -DISTCLEANFILES += $(NUT_SPELL_DICT).bak-pre-sorting .$(NUT_SPELL_DICT).sorted $(NUT_SPELL_DICT).sorted +DISTCLEANFILES = $(NUT_SPELL_DICT).bak-pre-sorting .$(NUT_SPELL_DICT).sorted $(NUT_SPELL_DICT).sorted spellcheck-interactive: @FAILED="" ; for docsrc in $(SPELLCHECK_SRC); do \ diff --git a/docs/cables/Makefile.am b/docs/cables/Makefile.am index 86b7d30090..aa99fac912 100644 --- a/docs/cables/Makefile.am +++ b/docs/cables/Makefile.am @@ -1,2 +1,2 @@ CLEANFILES = *-spellchecked -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index ba7c1619ff..90b5df635d 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -946,7 +946,7 @@ endif !HAVE_ASCIIDOC spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SRC_ALL_PAGES)" SPELLCHECK_DIR="$(srcdir)" $@ -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in clean-local: rm -rf tmp diff --git a/drivers/Makefile.am b/drivers/Makefile.am index 2fdfb575ae..d142dcc8e6 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -329,7 +329,7 @@ libdummy_serial_la_SOURCES = serial.c libdummy_serial_la_LDFLAGS = -no-undefined -static CLEANFILES = $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/include/Makefile.am b/include/Makefile.am index c599805634..2df81b12f1 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,7 +4,7 @@ dist_noinst_HEADERS = attribute.h common.h extstate.h parseconf.h proto.h \ # http://www.gnu.org/software/automake/manual/automake.html#Clean BUILT_SOURCES = nut_version.h CLEANFILES = nut_version.h -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # magic to include Git version information in NUT version string # (for builds not made from the tagged commit in a Git workspace) diff --git a/lib/Makefile.am b/lib/Makefile.am index 17335a0a8a..2252054508 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -9,4 +9,4 @@ endif endif CLEANFILES = *-spellchecked -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 089494a738..b291837e41 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -27,4 +27,4 @@ EXTRA_DIST = README \ SUBDIRS = augeas devd hotplug python systemd udev ufw Solaris upsdrvsvcctl -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in diff --git a/scripts/Solaris/Makefile.am b/scripts/Solaris/Makefile.am index 911e3684b7..593cfd67d0 100644 --- a/scripts/Solaris/Makefile.am +++ b/scripts/Solaris/Makefile.am @@ -85,4 +85,4 @@ check-local-solaris-smf: $(SOLARIS_SMF_MANIFESTS) /usr/sbin/svccfg validate "$$F" || RES=$$? ; \ done; exit $$RES -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in diff --git a/scripts/augeas/Makefile.am b/scripts/augeas/Makefile.am index eb6fa6c494..47c47a0bfa 100644 --- a/scripts/augeas/Makefile.am +++ b/scripts/augeas/Makefile.am @@ -37,11 +37,13 @@ if WITH_AUGLENS nutnutconf.aug nutupsdconf.aug nutupsmonconf.aug nutupssetconf.aug endif -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in CLEANFILES = *-spellchecked -# Generated by configure script and/or autogen.sh: -DISTCLEANFILES += gen-nutupsconf-aug.py -DISTCLEANFILES += nutupsconf.aug.in +# Can be re-generated by configure script and/or make: +DISTCLEANFILES = gen-nutupsconf-aug.py + +# Generated by autogen.sh and needed to run the configure script: +REALCLEANFILES += nutupsconf.aug.in DISTCLEANFILES += *.aug diff --git a/scripts/devd/Makefile.am b/scripts/devd/Makefile.am index 7b64db7abb..5b00465a62 100644 --- a/scripts/devd/Makefile.am +++ b/scripts/devd/Makefile.am @@ -9,17 +9,16 @@ endif EXTRA_DIST = README -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # Generated by configure script: -DISTCLEANFILES += nut-usb.conf - -# Generated by tools/nut-usbinfo.pl script among GENERATED_USB_OS_FILES: -DISTCLEANFILES += nut-usb.conf.in +DISTCLEANFILES = nut-usb.conf # we should never remove this one, apart from a distclean-check #MAINTAINERCLEANFILES = nut-usbups.rules.in -# What if?.. -# Generated by tools/nut-usbinfo.pl script among GENERATED_USB_OS_FILES: -DISTCLEANFILES += nut-usbups.rules.in +# Generated by autogen.sh and needed to run the configure script +# (technically, generated by tools/nut-usbinfo.pl script among +# GENERATED_USB_OS_FILES): +REALCLEANFILES += nut-usbups.rules.in +REALCLEANFILES += nut-usb.conf.in diff --git a/scripts/hotplug/Makefile.am b/scripts/hotplug/Makefile.am index 4830418ede..397927ece3 100644 --- a/scripts/hotplug/Makefile.am +++ b/scripts/hotplug/Makefile.am @@ -7,13 +7,15 @@ endif EXTRA_DIST = README -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # Generated by configure script: -DISTCLEANFILES += libhidups +DISTCLEANFILES = libhidups # we should never remove this one, apart from a distclean-check #MAINTAINERCLEANFILES = libhid.usermap -# What if?.. -DISTCLEANFILES += libhid.usermap +# Generated by autogen.sh and needed to run the configure script +# (technically, generated by tools/nut-usbinfo.pl script among +# GENERATED_USB_OS_FILES): +REALCLEANFILES += libhid.usermap diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index 5c97a83486..7cc91661f2 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -20,4 +20,4 @@ EXTRA_DIST = README \ module/PyNUT.py.in \ module/test_nutclient.py.in -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in diff --git a/scripts/systemd/Makefile.am b/scripts/systemd/Makefile.am index cab63a43ba..4a3bf0b9b3 100644 --- a/scripts/systemd/Makefile.am +++ b/scripts/systemd/Makefile.am @@ -31,7 +31,7 @@ EXTRA_DIST += \ # NOTE: Do not EXTRA_DIST nut-common.tmpfiles.in - it is generated per build endif -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in -# Generated by configure script: -DISTCLEANFILES += nut-common.tmpfiles.in +# Generated by autogen.sh and needed to run the configure script: +REALCLEANFILES += nut-common.tmpfiles.in diff --git a/scripts/udev/Makefile.am b/scripts/udev/Makefile.am index d2f022441b..91fc1d8076 100644 --- a/scripts/udev/Makefile.am +++ b/scripts/udev/Makefile.am @@ -18,16 +18,17 @@ EXTRA_DIST = README 52-nut-ipmipsu.rules: nut-ipmipsu.rules cp nut-ipmipsu.rules $@ -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # Generated by configure script: -DISTCLEANFILES += nut-usbups.rules nut-ipmipsu.rules +DISTCLEANFILES = nut-usbups.rules nut-ipmipsu.rules CLEANFILES = 62-nut-usbups.rules 52-nut-ipmipsu.rules # we should never remove this one, apart from a distclean-check #MAINTAINERCLEANFILES = nut-usbups.rules.in -# What if?.. -# Generated by tools/nut-usbinfo.pl script among GENERATED_USB_OS_FILES: -DISTCLEANFILES += nut-usbups.rules.in +# Generated by autogen.sh and needed to run the configure script +# (technically, generated by tools/nut-usbinfo.pl script among +# GENERATED_USB_OS_FILES): +REALCLEANFILES += nut-usbups.rules.in diff --git a/scripts/ufw/Makefile.am b/scripts/ufw/Makefile.am index 8130598731..9998adaea6 100644 --- a/scripts/ufw/Makefile.am +++ b/scripts/ufw/Makefile.am @@ -1,2 +1,2 @@ -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in CLEANFILES = *-spellchecked diff --git a/scripts/upsdrvsvcctl/Makefile.am b/scripts/upsdrvsvcctl/Makefile.am index 3cdb08f3e9..04c525b4d2 100644 --- a/scripts/upsdrvsvcctl/Makefile.am +++ b/scripts/upsdrvsvcctl/Makefile.am @@ -10,4 +10,4 @@ endif EXTRA_DIST += nut-driver-enumerator.sh.in upsdrvsvcctl.in -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in diff --git a/server/Makefile.am b/server/Makefile.am index 5cab0b210b..3bab5c40d9 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -34,7 +34,7 @@ upsd_SOURCES = upsd.c user.c conf.c netssl.c sstate.c desc.c \ sockdebug_SOURCES = sockdebug.c -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/tests/Makefile.am b/tests/Makefile.am index 74c4ef3e07..3d0422f37a 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -80,7 +80,7 @@ endif !HAVE_CXX11 BUILT_SOURCES = $(LINKED_SOURCE_FILES) CLEANFILES += $(LINKED_SOURCE_FILES) CLEANFILES += $(TESTS) $(TESTS_CXX11) -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/tools/Makefile.am b/tools/Makefile.am index e0ec5c720e..ce0dde7d30 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -109,8 +109,11 @@ dist-hook: @$(distdir)/driver-list-format.sh; -DISTCLEANFILES = Makefile.in -DISTCLEANFILES += gitlog2changelog.py +REALCLEANFILES = Makefile.in + +# Can be recreated by `make` or `configure`, +# impacted by choice of PYTHON version: +DISTCLEANFILES = gitlog2changelog.py DISTCLEANFILES += nut-snmpinfo.py .PHONY: nut-scanner-deps nut-scanner-snmp-deps nut-scanner-usb-deps diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 352c795aa7..1eae6521b0 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -106,7 +106,7 @@ else endif CLEANFILES += *-spellchecked -DISTCLEANFILES = Makefile.in +REALCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! From b49281fd5e631d8abd5446af1104042f98c4cec7 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 12:04:09 +0100 Subject: [PATCH 30/36] */Makefile.am: there is no default "make realclean" implem in autotools, fall back to "maintainer-clean" support for wipingg the workspace --- Makefile.am | 14 +++++++------- clients/Makefile.am | 2 +- common/Makefile.am | 2 +- conf/Makefile.am | 2 +- data/Makefile.am | 2 +- data/html/Makefile.am | 2 +- docs/Makefile.am | 2 +- docs/cables/Makefile.am | 2 +- docs/man/Makefile.am | 2 +- drivers/Makefile.am | 2 +- include/Makefile.am | 2 +- lib/Makefile.am | 2 +- scripts/Makefile.am | 2 +- scripts/Solaris/Makefile.am | 2 +- scripts/augeas/Makefile.am | 4 ++-- scripts/devd/Makefile.am | 6 +++--- scripts/hotplug/Makefile.am | 4 ++-- scripts/python/Makefile.am | 2 +- scripts/systemd/Makefile.am | 4 ++-- scripts/udev/Makefile.am | 4 ++-- scripts/ufw/Makefile.am | 2 +- scripts/upsdrvsvcctl/Makefile.am | 2 +- server/Makefile.am | 2 +- tests/Makefile.am | 2 +- tools/Makefile.am | 2 +- tools/nut-scanner/Makefile.am | 2 +- 26 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0e0d1cc0a8..73e6dc49fb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,12 +69,12 @@ DISTCLEANFILES += include/config.h.in~ # from their installation, or made by `automake` etc. on the system # which generates `configure`; rebuilding NUT after deleting these # requires `autogen.sh` script to be re-run (and tools available): -REALCLEANFILES = INSTALL -REALCLEANFILES += aclocal.m4 config.guess config.sub -REALCLEANFILES += configure -REALCLEANFILES += depcomp install-sh ltmain.sh missing test-driver -REALCLEANFILES += m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 -REALCLEANFILES += Makefile.in include/config.h.in +MAINTAINERCLEANFILES = INSTALL +MAINTAINERCLEANFILES += aclocal.m4 config.guess config.sub +MAINTAINERCLEANFILES += configure +MAINTAINERCLEANFILES += depcomp install-sh ltmain.sh missing test-driver +MAINTAINERCLEANFILES += m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 +MAINTAINERCLEANFILES += Makefile.in include/config.h.in # Do not let $SUBDIRS/Makefile rules delete their local .deps because # this breaks our ability to clean up (e.g. some common/.../*.Plo files @@ -158,7 +158,7 @@ endif !HAVE_CPPCHECK # ---------------------------------------------------------------------- # Automatically generate the ChangeLog from Git logs: -MAINTAINERCLEAN_FILES = ChangeLog +MAINTAINERCLEAN_FILES += ChangeLog # Older boundary of the ChangeLog commits range # It can be a tag ('v2.2.0'), a commit hash, a date, ... diff --git a/clients/Makefile.am b/clients/Makefile.am index b7ee8f1ba2..25a2c7e93c 100644 --- a/clients/Makefile.am +++ b/clients/Makefile.am @@ -95,7 +95,7 @@ else EXTRA_DIST += nutclientmem.h nutclientmem.cpp endif -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/common/Makefile.am b/common/Makefile.am index 257d226271..1d00e38123 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -21,7 +21,7 @@ libcommonclient_la_SOURCES = common.c state.c str.c libcommon_la_LIBADD = libparseconf.la @LTLIBOBJS@ libcommonclient_la_LIBADD = libparseconf.la @LTLIBOBJS@ -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/conf/Makefile.am b/conf/Makefile.am index 51b2f0d823..220265312b 100644 --- a/conf/Makefile.am +++ b/conf/Makefile.am @@ -37,5 +37,5 @@ spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SPELLCHECK_SRC)" SPELLCHECK_DIR="$(srcdir)" $@ -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in CLEANFILES = *.pdf *.html *-spellchecked diff --git a/data/Makefile.am b/data/Makefile.am index 46f3497ec0..23d7b8098c 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -16,5 +16,5 @@ cmdvartab-spellchecked: cmdvartab Makefile.am $(top_srcdir)/docs/Makefile.am $(a spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="cmdvartab" SPELLCHECK_DIR="$(srcdir)" $@ -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in CLEANFILES = *.pdf *.html *-spellchecked diff --git a/data/html/Makefile.am b/data/html/Makefile.am index 955e80a72b..823f18a9bc 100644 --- a/data/html/Makefile.am +++ b/data/html/Makefile.am @@ -6,6 +6,6 @@ if WITH_CGI endif EXTRA_DIST = README -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # Generated by configure script: DISTCLEANFILES = header.html diff --git a/docs/Makefile.am b/docs/Makefile.am index 9e535c530d..fe2032861e 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,4 +1,4 @@ -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in EXTRA_DIST = # Is "egrep == grep -E" always valid? (maybe all a job for configure.ac) diff --git a/docs/cables/Makefile.am b/docs/cables/Makefile.am index aa99fac912..ee269a84c4 100644 --- a/docs/cables/Makefile.am +++ b/docs/cables/Makefile.am @@ -1,2 +1,2 @@ CLEANFILES = *-spellchecked -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in diff --git a/docs/man/Makefile.am b/docs/man/Makefile.am index 90b5df635d..43f326f468 100644 --- a/docs/man/Makefile.am +++ b/docs/man/Makefile.am @@ -946,7 +946,7 @@ endif !HAVE_ASCIIDOC spellcheck spellcheck-interactive spellcheck-sortdict: $(MAKE) -f $(top_builddir)/docs/Makefile SPELLCHECK_SRC="$(SRC_ALL_PAGES)" SPELLCHECK_DIR="$(srcdir)" $@ -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in clean-local: rm -rf tmp diff --git a/drivers/Makefile.am b/drivers/Makefile.am index d142dcc8e6..3bebfc7562 100644 --- a/drivers/Makefile.am +++ b/drivers/Makefile.am @@ -329,7 +329,7 @@ libdummy_serial_la_SOURCES = serial.c libdummy_serial_la_LDFLAGS = -no-undefined -static CLEANFILES = $(EXTRA_LTLIBRARIES) $(EXTRA_PROGRAMS) -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/include/Makefile.am b/include/Makefile.am index 2df81b12f1..385e32eb61 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -4,7 +4,7 @@ dist_noinst_HEADERS = attribute.h common.h extstate.h parseconf.h proto.h \ # http://www.gnu.org/software/automake/manual/automake.html#Clean BUILT_SOURCES = nut_version.h CLEANFILES = nut_version.h -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # magic to include Git version information in NUT version string # (for builds not made from the tagged commit in a Git workspace) diff --git a/lib/Makefile.am b/lib/Makefile.am index 2252054508..8256a9ad6b 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -9,4 +9,4 @@ endif endif CLEANFILES = *-spellchecked -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in diff --git a/scripts/Makefile.am b/scripts/Makefile.am index b291837e41..bb076ece15 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -27,4 +27,4 @@ EXTRA_DIST = README \ SUBDIRS = augeas devd hotplug python systemd udev ufw Solaris upsdrvsvcctl -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in diff --git a/scripts/Solaris/Makefile.am b/scripts/Solaris/Makefile.am index 593cfd67d0..5a76433188 100644 --- a/scripts/Solaris/Makefile.am +++ b/scripts/Solaris/Makefile.am @@ -85,4 +85,4 @@ check-local-solaris-smf: $(SOLARIS_SMF_MANIFESTS) /usr/sbin/svccfg validate "$$F" || RES=$$? ; \ done; exit $$RES -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in diff --git a/scripts/augeas/Makefile.am b/scripts/augeas/Makefile.am index 47c47a0bfa..ae667f9c53 100644 --- a/scripts/augeas/Makefile.am +++ b/scripts/augeas/Makefile.am @@ -37,13 +37,13 @@ if WITH_AUGLENS nutnutconf.aug nutupsdconf.aug nutupsmonconf.aug nutupssetconf.aug endif -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in CLEANFILES = *-spellchecked # Can be re-generated by configure script and/or make: DISTCLEANFILES = gen-nutupsconf-aug.py # Generated by autogen.sh and needed to run the configure script: -REALCLEANFILES += nutupsconf.aug.in +MAINTAINERCLEANFILES += nutupsconf.aug.in DISTCLEANFILES += *.aug diff --git a/scripts/devd/Makefile.am b/scripts/devd/Makefile.am index 5b00465a62..f809a999b9 100644 --- a/scripts/devd/Makefile.am +++ b/scripts/devd/Makefile.am @@ -9,7 +9,7 @@ endif EXTRA_DIST = README -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # Generated by configure script: DISTCLEANFILES = nut-usb.conf @@ -20,5 +20,5 @@ DISTCLEANFILES = nut-usb.conf # Generated by autogen.sh and needed to run the configure script # (technically, generated by tools/nut-usbinfo.pl script among # GENERATED_USB_OS_FILES): -REALCLEANFILES += nut-usbups.rules.in -REALCLEANFILES += nut-usb.conf.in +MAINTAINERCLEANFILES += nut-usbups.rules.in +MAINTAINERCLEANFILES += nut-usb.conf.in diff --git a/scripts/hotplug/Makefile.am b/scripts/hotplug/Makefile.am index 397927ece3..9ba1d22f5f 100644 --- a/scripts/hotplug/Makefile.am +++ b/scripts/hotplug/Makefile.am @@ -7,7 +7,7 @@ endif EXTRA_DIST = README -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # Generated by configure script: DISTCLEANFILES = libhidups @@ -18,4 +18,4 @@ DISTCLEANFILES = libhidups # Generated by autogen.sh and needed to run the configure script # (technically, generated by tools/nut-usbinfo.pl script among # GENERATED_USB_OS_FILES): -REALCLEANFILES += libhid.usermap +MAINTAINERCLEANFILES += libhid.usermap diff --git a/scripts/python/Makefile.am b/scripts/python/Makefile.am index 7cc91661f2..ce23b825fb 100644 --- a/scripts/python/Makefile.am +++ b/scripts/python/Makefile.am @@ -20,4 +20,4 @@ EXTRA_DIST = README \ module/PyNUT.py.in \ module/test_nutclient.py.in -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in diff --git a/scripts/systemd/Makefile.am b/scripts/systemd/Makefile.am index 4a3bf0b9b3..594ee9de6c 100644 --- a/scripts/systemd/Makefile.am +++ b/scripts/systemd/Makefile.am @@ -31,7 +31,7 @@ EXTRA_DIST += \ # NOTE: Do not EXTRA_DIST nut-common.tmpfiles.in - it is generated per build endif -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # Generated by autogen.sh and needed to run the configure script: -REALCLEANFILES += nut-common.tmpfiles.in +MAINTAINERCLEANFILES += nut-common.tmpfiles.in diff --git a/scripts/udev/Makefile.am b/scripts/udev/Makefile.am index 91fc1d8076..5977f8eca2 100644 --- a/scripts/udev/Makefile.am +++ b/scripts/udev/Makefile.am @@ -18,7 +18,7 @@ EXTRA_DIST = README 52-nut-ipmipsu.rules: nut-ipmipsu.rules cp nut-ipmipsu.rules $@ -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # Generated by configure script: DISTCLEANFILES = nut-usbups.rules nut-ipmipsu.rules @@ -31,4 +31,4 @@ CLEANFILES = 62-nut-usbups.rules 52-nut-ipmipsu.rules # Generated by autogen.sh and needed to run the configure script # (technically, generated by tools/nut-usbinfo.pl script among # GENERATED_USB_OS_FILES): -REALCLEANFILES += nut-usbups.rules.in +MAINTAINERCLEANFILES += nut-usbups.rules.in diff --git a/scripts/ufw/Makefile.am b/scripts/ufw/Makefile.am index 9998adaea6..7793f24713 100644 --- a/scripts/ufw/Makefile.am +++ b/scripts/ufw/Makefile.am @@ -1,2 +1,2 @@ -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in CLEANFILES = *-spellchecked diff --git a/scripts/upsdrvsvcctl/Makefile.am b/scripts/upsdrvsvcctl/Makefile.am index 04c525b4d2..2af566cfea 100644 --- a/scripts/upsdrvsvcctl/Makefile.am +++ b/scripts/upsdrvsvcctl/Makefile.am @@ -10,4 +10,4 @@ endif EXTRA_DIST += nut-driver-enumerator.sh.in upsdrvsvcctl.in -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in diff --git a/server/Makefile.am b/server/Makefile.am index 3bab5c40d9..0d1b933560 100644 --- a/server/Makefile.am +++ b/server/Makefile.am @@ -34,7 +34,7 @@ upsd_SOURCES = upsd.c user.c conf.c netssl.c sstate.c desc.c \ sockdebug_SOURCES = sockdebug.c -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/tests/Makefile.am b/tests/Makefile.am index 3d0422f37a..91287f46c8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -80,7 +80,7 @@ endif !HAVE_CXX11 BUILT_SOURCES = $(LINKED_SOURCE_FILES) CLEANFILES += $(LINKED_SOURCE_FILES) CLEANFILES += $(TESTS) $(TESTS_CXX11) -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! diff --git a/tools/Makefile.am b/tools/Makefile.am index ce0dde7d30..5a2bb7fc67 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -109,7 +109,7 @@ dist-hook: @$(distdir)/driver-list-format.sh; -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # Can be recreated by `make` or `configure`, # impacted by choice of PYTHON version: diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index 1eae6521b0..e775b4943e 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -106,7 +106,7 @@ else endif CLEANFILES += *-spellchecked -REALCLEANFILES = Makefile.in +MAINTAINERCLEANFILES = Makefile.in # NOTE: Do not clean ".deps" in SUBDIRS of the main project, # the root Makefile.am takes care of that! From 8165508f8bc7fa395c1606d25e630d0d05f08013 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 12:04:24 +0100 Subject: [PATCH 31/36] ci_build.sh: there is no default "make realclean" implem in autotools, fall back to "maintainer-clean" support for wipingg the workspace --- ci_build.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ci_build.sh b/ci_build.sh index f3ef049653..904a662e9a 100755 --- a/ci_build.sh +++ b/ci_build.sh @@ -265,16 +265,16 @@ build_to_only_catch_errors() { return 0 } -optional_realclean_check() { - if [ "${DO_REALCHECK_CLEAN-}" = "no" ] ; then - echo "Skipping realclean check because recipe/developer said so" +optional_maintainer_clean_check() { + if [ "${DO_MAINTAINER_CLEAN_CHECK-}" = "no" ] ; then + echo "Skipping maintainer-clean check because recipe/developer said so" else - [ -z "$CI_TIME" ] || echo "`date`: Starting realclean check of currently tested project..." + [ -z "$CI_TIME" ] || echo "`date`: Starting maintainer-clean check of currently tested project..." - # Note: currently Makefile.am has just a dummy "realcleancheck" rule - $CI_TIME $MAKE VERBOSE=1 DISTCHECK_FLAGS="$DISTCHECK_FLAGS" $PARMAKE_FLAGS realclean || return + # Note: currently Makefile.am has just a dummy "distcleancheck" rule + $CI_TIME $MAKE VERBOSE=1 DISTCHECK_FLAGS="$DISTCHECK_FLAGS" $PARMAKE_FLAGS maintainer-clean || return - echo "=== Are GitIgnores good after '$MAKE realclean'? (should have no output below)" + echo "=== Are GitIgnores good after '$MAKE maintainer-clean'? (should have no output below)" git status --ignored -s || true echo "===" @@ -715,7 +715,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp ccache -s fi - optional_realclean_check || exit + optional_maintainer_clean_check || exit echo "=== Exiting after the custom-build target '$MAKE $BUILD_TGT' succeeded OK" exit 0 @@ -817,9 +817,9 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp FAILED="${FAILED} NUT_SSL_VARIANT=${NUT_SSL_VARIANT}[build]" } - optional_realclean_check || { + optional_maintainer_clean_check || { RES=$? - FAILED="${FAILED} NUT_SSL_VARIANT=${NUT_SSL_VARIANT}[realclean]" + FAILED="${FAILED} NUT_SSL_VARIANT=${NUT_SSL_VARIANT}[maintainer_clean]" } done # TODO: Similar loops for other variations like TESTING, @@ -881,7 +881,7 @@ default|default-alldrv|default-alldrv:no-distcheck|default-all-errors|default-sp ) fi - optional_realclean_check || exit + optional_maintainer_clean_check || exit if [ "$HAVE_CCACHE" = yes ]; then echo "CCache stats after build:" From bb14d7b3c030bbdd76db06140629b276d5832043 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 12:07:11 +0100 Subject: [PATCH 32/36] Makefile.am: typo fix MAINTAINERCLEAN_FILES => MAINTAINERCLEANFILES --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 73e6dc49fb..b02b6dfc2d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -158,7 +158,7 @@ endif !HAVE_CPPCHECK # ---------------------------------------------------------------------- # Automatically generate the ChangeLog from Git logs: -MAINTAINERCLEAN_FILES += ChangeLog +MAINTAINERCLEANFILES += ChangeLog # Older boundary of the ChangeLog commits range # It can be a tag ('v2.2.0'), a commit hash, a date, ... From 40f760fe7e185d2c7f8e3536c8c1ae9bc8b8c6db Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 12:09:20 +0100 Subject: [PATCH 33/36] Makefile.am: add a "make realclean" as alias to maintainer-clean --- Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile.am b/Makefile.am index b02b6dfc2d..aea1e6b389 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,6 +51,9 @@ memcheck distcheck-valgrind: distcleancheck: @: +# Quick alias for root dir recipe: +realclean: maintainer-clean + # Files made by our targets: CLEANFILES = *-spellchecked cppcheck*.xml DISTCLEANFILES = ChangeLog From 9a565f0aa2b060443cef75bfb2945c709cb480f4 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 12:21:39 +0100 Subject: [PATCH 34/36] tests/Makefile.am: mark use of LINKED_SOURCE_FILES as "nodist" --- tests/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 91287f46c8..095b1d838d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -23,7 +23,8 @@ LINKED_SOURCE_FILES = $(builddir)/hidparser.c $(builddir)/hidparser.c: $(top_srcdir)/drivers/hidparser.c test -s "$@" || ln -s -f "$(top_srcdir)/drivers/hidparser.c" "$@" -getvaluetest_SOURCES = getvaluetest.c $(builddir)/hidparser.c +getvaluetest_SOURCES = getvaluetest.c +nodist_getvaluetest_SOURCES = $(builddir)/hidparser.c getvaluetest_LDADD = $(top_builddir)/common/libcommon.la # Make sure out-of-dir dependencies exist (especially when dev-building parts): From 9905f42bc22d0c223cb0a056c262b216d2211c2f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 12:21:49 +0100 Subject: [PATCH 35/36] tools/nut-scanner/Makefile.am: mark use of LINKED_SOURCE_FILES as "nodist" --- tools/nut-scanner/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index e775b4943e..938ad32cf3 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -59,8 +59,8 @@ endif 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 \ - $(LINKED_SOURCE_FILES) + scan_avahi.c scan_eaton_serial.c nutscan-serial.c +nodist_libnutscan_la_SOURCES = $(LINKED_SOURCE_FILES) libnutscan_la_LIBADD = $(NETLIBS) $(LIBLTDL_LIBS) # # Below we set API versions of public libraries From fefb214d7f707fa70f69aac2cbbd64b954513134 Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sat, 6 Nov 2021 12:25:17 +0100 Subject: [PATCH 36/36] Makefile.am: move removal of dist tarballs and build packages from "distclean" to "maintainer-clean" --- Makefile.am | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile.am b/Makefile.am index aea1e6b389..9c5bfa5356 100644 --- a/Makefile.am +++ b/Makefile.am @@ -250,20 +250,20 @@ setver: @echo "Edit configure.ac to set version number." # Clean the dist tarball and packages -DISTCLEANFILES_DISTBALL = nut-*.tar.gz +MAINTAINERCLEANFILES_DISTBALL = nut-*.tar.gz # HP-UX: -DISTCLEANFILES_PACKAGES = NUT_HPUX_package@PACKAGE_VERSION@.depot +MAINTAINERCLEANFILES_PACKAGES = NUT_HPUX_package@PACKAGE_VERSION@.depot # AIX as below, and RedHat-compatible (cover binary and source packages): -DISTCLEANFILES_PACKAGES += nut*rpm +MAINTAINERCLEANFILES_PACKAGES += nut*rpm # Debian-compatible (cover binary and source packages): -DISTCLEANFILES_PACKAGES += nut*deb +MAINTAINERCLEANFILES_PACKAGES += nut*deb # Solaris SVR4 package archives: -DISTCLEANFILES_PACKAGES += NUT_solaris_*_package@PACKAGE_VERSION@.local.gz +MAINTAINERCLEANFILES_PACKAGES += NUT_solaris_*_package@PACKAGE_VERSION@.local.gz # Newer Solaris IPS (aka "pkg(5)" format archives) -DISTCLEANFILES_PACKAGES += *.p5p +MAINTAINERCLEANFILES_PACKAGES += *.p5p -DISTCLEANFILES += $(DISTCLEANFILES_DISTBALL) -DISTCLEANFILES += $(DISTCLEANFILES_PACKAGES) +MAINTAINERCLEANFILES += $(MAINTAINERCLEANFILES_DISTBALL) +MAINTAINERCLEANFILES += $(MAINTAINERCLEANFILES_PACKAGES) package: DESTDIR="$(abs_builddir)/_install_pkgprotodir" ; export DESTDIR; \