nut/tools/Makefile.am

120 lines
5.1 KiB
Makefile
Raw Permalink Normal View History

2012-06-01 13:55:19 +00:00
# SUBDIRS are explicitly a listing of all the directories that make
# must recurse into BEFORE processing the current directory.
#
# These python scripts must be moved into a sub-directory, and _only_
# executed IF they need to be, and all the nut-scanner sources need
# to be moved out of a sub-directory into this directory.
#
# Anyway, for the time being, we force build in ./ before nut-scanner,
# to have nutscan-{usb,snmp}.h built before going into the nut-scanner
2022-06-29 10:37:36 +00:00
# sub-directory. For good measure we also call this from nut-scanner's
# make, to handle developer workflow (editing the *.c sources this uses).
2011-09-29 18:14:46 +00:00
SUBDIRS = . nut-scanner
2022-06-29 10:37:36 +00:00
PYTHON = @PYTHON@
EXTRA_DIST = nut-usbinfo.pl nut-recorder.sh nut-ddl-dump.sh nut-dumpdiff.sh \
gitlog2changelog.py.in nut-snmpinfo.py.in driver-list-format.sh
GENERATED_SNMP_FILES = nut-scanner/nutscan-snmp.h
GENERATED_USB_FILES = nut-scanner/nutscan-usb.h
# Hotplug output file
GENERATED_USB_OS_FILES = ../scripts/hotplug/libhid.usermap
# udev output file
GENERATED_USB_OS_FILES += ../scripts/udev/nut-usbups.rules.in
2011-09-29 18:14:46 +00:00
2022-06-29 10:37:36 +00:00
# BSD devd output file
GENERATED_USB_OS_FILES += ../scripts/devd/nut-usb.conf.in
2011-09-29 18:14:46 +00:00
2022-06-29 10:37:36 +00:00
# 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
nut-scanner-deps: $(GENERATED_SNMP_FILES) $(GENERATED_USB_FILES)
# Aliases for particular files, if someone has a need:
nut-scanner-deps-snmpinfo: $(GENERATED_SNMP_FILES)
nut-scanner-deps-usb: $(GENERATED_USB_FILES)
# The distributed nut-snmpinfo.py.in template is assumed to only differ from
# a generated nut-snmpinfo.py by the @PYTHON@ shebang.
$(GENERATED_SNMP_FILES): $(top_srcdir)/drivers/*-mib.c
@if [ -n "$(PYTHON)" ] && $(PYTHON) -c 1; then \
echo "Regenerating the SNMP helper files in SRC dir with '$(PYTHON)'."; \
TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \
TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \
cd $(builddir) && $(PYTHON) $(top_srcdir)/tools/nut-snmpinfo.py.in; \
2011-09-29 18:14:46 +00:00
else \
echo "----------------------------------------------------------------------"; \
echo "Warning: Python is not available."; \
2022-06-29 10:37:36 +00:00
echo "Skipping the SNMP helper files regeneration in SRC dir."; \
2011-09-29 18:14:46 +00:00
echo "----------------------------------------------------------------------"; \
fi
2022-06-29 10:37:36 +00:00
$(GENERATED_USB_FILES): $(top_srcdir)/drivers/*-hid.c $(top_srcdir)/drivers/*usb*.c $(top_srcdir)/drivers/nutdrv_qx.c
2011-09-29 18:14:46 +00:00
@if perl -e 1; then \
2022-06-29 10:37:36 +00:00
echo "Regenerating the USB helper files in SRC dir."; \
TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \
TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \
cd $(builddir) && $(top_srcdir)/tools/nut-usbinfo.pl; \
2011-09-29 18:14:46 +00:00
else \
echo "----------------------------------------------------------------------"; \
echo "Warning: Perl is not available."; \
2022-06-29 10:37:36 +00:00
echo "Skipping the USB helper files regeneration in SRC dir."; \
2011-09-29 18:14:46 +00:00
echo "----------------------------------------------------------------------"; \
fi
2011-01-26 09:35:08 +00:00
2011-09-29 18:14:46 +00:00
# call the USB info script upon "make dist", and if Perl is present
# call the SNMP info script upon "make dist", and if Python is present
# and call both for building nut-scanner
2016-07-18 00:11:41 +00:00
# Also ensure that data/driver.list is well formatted
2022-06-29 10:37:36 +00:00
# NOTE: Beware that current working directory for the script should be builddir
# so it may write the files in "dist" case (read-only sources), but the script
# is called from the distdir where its copy is present.
# The distributed nut-snmpinfo.py.in template is assumed to only differ from
# a generated nut-snmpinfo.py by the @PYTHON@ shebang.
2010-03-25 23:20:59 +00:00
dist-hook:
2022-06-29 10:37:36 +00:00
@if [ -n "$(PYTHON)" ] && $(PYTHON) -c 1; then \
echo "Regenerating the SNMP helper files in DIST dir with '$(PYTHON)'."; \
TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \
TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \
$(PYTHON) $(distdir)/nut-snmpinfo.py.in; \
2011-09-29 18:14:46 +00:00
else \
echo "----------------------------------------------------------------------"; \
echo "Warning: Python is not available."; \
2022-06-29 10:37:36 +00:00
echo "Skipping the SNMP helper files regeneration in DIST dir."; \
2011-09-29 18:14:46 +00:00
echo "----------------------------------------------------------------------"; \
fi
2011-01-26 09:35:08 +00:00
@if perl -e 1; then \
2022-06-29 10:37:36 +00:00
echo "Regenerating the USB helper files in DIST dir."; \
TOP_SRCDIR="$(top_srcdir)" ; export TOP_SRCDIR; \
TOP_BUILDDIR="$(top_builddir)" ; export TOP_BUILDDIR; \
2010-03-25 23:20:59 +00:00
$(distdir)/nut-usbinfo.pl; \
else \
echo "----------------------------------------------------------------------"; \
echo "Warning: Perl is not available."; \
2022-06-29 10:37:36 +00:00
echo "Skipping the USB helper files regeneration in DIST dir."; \
2010-03-25 23:20:59 +00:00
echo "----------------------------------------------------------------------"; \
fi
2011-09-29 18:14:46 +00:00
2016-07-18 00:11:41 +00:00
@$(distdir)/driver-list-format.sh;
2022-06-29 10:37:36 +00:00
MAINTAINERCLEANFILES = Makefile.in .dirstamp
# Can be recreated by `make` or `configure`,
# impacted by choice of PYTHON version:
DISTCLEANFILES = gitlog2changelog.py
DISTCLEANFILES += nut-snmpinfo.py
2011-09-29 18:14:46 +00:00
.PHONY: nut-scanner-deps nut-scanner-snmp-deps nut-scanner-usb-deps