summaryrefslogtreecommitdiff
path: root/camlibs/Makefile.am
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2020-02-16 18:25:46 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2020-02-17 23:19:41 +0100
commitbe9e0a889ad4b6551ae16df3324b2f7ebba0600c (patch)
tree24066d9baa8fd668ebd194c20a7196d1aac72e64 /camlibs/Makefile.am
parent7539525efde5bba86052c0678a769cc8b427e0ce (diff)
downloadlibgphoto2-be9e0a889ad4b6551ae16df3324b2f7ebba0600c.tar.gz
New set based camlib definition and --with-camlibs handling
This uses proper set operations both for GP_CAMLIB and for handling the --with-camlibs value. This allows all GP_CAMLIB definitions to be present at autoreconf time (as m4 code) time while some camlib definitions being conditional at the time of the configure run (in the sh code). The ./configure output is still a bit verbose, but we can reduce that verbosity later when we have found out that this works well on people's different systems. Fixes: https://github.com/gphoto/libgphoto2/issues/467
Diffstat (limited to 'camlibs/Makefile.am')
-rw-r--r--camlibs/Makefile.am84
1 files changed, 62 insertions, 22 deletions
diff --git a/camlibs/Makefile.am b/camlibs/Makefile.am
index c6a6e257a..34926281a 100644
--- a/camlibs/Makefile.am
+++ b/camlibs/Makefile.am
@@ -6,8 +6,8 @@
# or
# ( cd camlibs && make agfa_cl20.la )
#
-# If you only want to install a single camlib or two, run
-# make BUILD_THESE_CAMLIBS="canon.la agfa_cl20.la" install
+# If you only want to build/install a single camlib or two, run
+# make GP_CAMLIB_SET="canon.la agfa_cl20.la" install
# in the camlibs/ subdir or in the libgphoto2 top-level directory.
########################################################################
@@ -35,6 +35,18 @@ EXTRA_LTLIBRARIES =
########################################################################
+# We pass the list of camlibs through this set of variables in order
+# to remain compatible with older calling conventions.
+
+# Actually implement BUILD_THESE_CAMLIBS as documented
+BUILD_THESE_CAMLIBS = $(GP_CAMLIB_SET)
+
+# while keeping compatibility with the variable which has been working
+# for so long
+INSTALL_THESE_CAMLIBS = $(BUILD_THESE_CAMLIBS)
+
+
+########################################################################
# All camlibs are defined as EXTRA_LTLIBRARIES. This requires that
# all camlibs have -rpath set explicitly in foobar_la_LDFLAGS.
# You're probably best off by using the camlib_* variables defined
@@ -46,17 +58,29 @@ camlib_LTLIBRARIES = $(INSTALL_THESE_CAMLIBS)
# Define the compile/link/etc. flags common to all camlibs in one place,
# i.e. here.
-camlib_dependencies = $(top_srcdir)/camlibs/camlib.sym
-camlib_ldflags = -module -no-undefined -avoid-version -export-dynamic \
- -export-symbols '$(top_srcdir)/camlibs/camlib.sym' \
- -rpath '$(camlibdir)'
-camlib_libadd = $(top_builddir)/libgphoto2/libgphoto2.la $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la
+camlib_dependencies =
+camlib_dependencies += $(top_srcdir)/camlibs/camlib.sym
+
+camlib_ldflags =
+camlib_ldflags += -module
+camlib_ldflags += -no-undefined
+camlib_ldflags += -avoid-version
+camlib_ldflags += -export-dynamic
+camlib_ldflags += -export-symbols '$(top_srcdir)/camlibs/camlib.sym'
+camlib_ldflags += -rpath '$(camlibdir)'
+
+camlib_libadd =
+camlib_libadd += $(top_builddir)/libgphoto2/libgphoto2.la
+camlib_libadd += $(top_builddir)/libgphoto2_port/libgphoto2_port/libgphoto2_port.la
+
+AM_CPPFLAGS += -I$(top_srcdir) -I$(top_builddir)
+AM_CPPFLAGS += -I$(top_srcdir)/libgphoto2_port
+AM_CPPFLAGS += -I$(top_srcdir)/libgphoto2 -I$(top_builddir)/libgphoto2
-AM_CPPFLAGS += -I$(top_srcdir) -I$(top_builddir) -I$(top_srcdir)/libgphoto2_port -I$(top_srcdir)/libgphoto2 -I$(top_builddir)/libgphoto2
########################################################################
# You can generate this Makefile-files include list by running
-# find . -name Makefile-files -exec echo include {} \; | sort | sed 's| ./| |g'
+# find . -name Makefile-files -exec echo include {} \; | sort | sed 's| ./| |g'
include adc65/Makefile-files
include agfa-cl20/Makefile-files
include aox/Makefile-files
@@ -136,17 +160,33 @@ print-camlibs: Makefile
# Make sure that the list of camlibs defined in configure.ac using
# GP_CAMLIB(...) and the list of camlibs defined in */Makefile-files
# match.
-CLEANFILES += all-src-camlibs all-def-camlibs
-all-local: Makefile
- @:; \
- (for x in $(EXTRA_LTLIBRARIES) template.la; do echo "$$(basename "$$x" ".la")"; done) \
- | sort > all-src-camlibs; \
- (for x in $(ALL_DEFINED_CAMLIBS); do echo "$$x"; done) \
- | sort > all-def-camlibs; \
- if cmp all-def-camlibs all-src-camlibs; then :; else \
- diff -u all-def-camlibs all-src-camlibs; \
- echo "List of camlibs in configure.ac is out of date."; \
- echo "Have a developer update it using \"make -C camlibs print-camlibs\"."; \
+
+# List all camlibs defined in configure.ac
+CLEANFILES += all-cfg-camlibs
+all-cfg-camlibs: Makefile
+ @(for x in $(GP_CAMLIB_SET_EVERYTHING); do echo "$$x"; done) \
+ | LC_ALL=C $(SORT) > all-cfg-camlibs
+
+# List all camlibs defined in the camlibs/ source subtree Makefile-files
+CLEANFILES += all-mkf-camlibs
+all-mkf-camlibs: Makefile
+ @(for x in $(EXTRA_LTLIBRARIES) $(noinst_LTLIBRARIES); do echo "$$(basename "$$x" ".la")"; done) \
+ | LC_ALL=C $(SORT) > all-mkf-camlibs
+
+.PHONY: all-local
+all-local: all-cfg-camlibs all-mkf-camlibs
+ @if $(CMP) all-cfg-camlibs all-mkf-camlibs > /dev/null 2>&1; then :; else \
+ echo "#"; \
+ for camlib in $$($(COMM) -23 all-cfg-camlibs all-mkf-camlibs); do \
+ echo "# - '$${camlib}' camlib in 'configure.ac', but not in Makefiles."; \
+ done; \
+ for camlib in $$($(COMM) -13 all-cfg-camlibs all-mkf-camlibs); do \
+ echo "# - '$${camlib}' camlib in Makefiles, but not in 'configure.ac'"; \
+ done; \
+ echo "#"; \
+ echo "# The camlib set definitions in 'configure.ac' and Makefiles are inconsistent"; \
+ echo "# Have a developer sync them, maybe using \"make -C camlibs print-camlibs\"."; \
+ echo "#"; \
exit 1; \
fi
@@ -155,8 +195,8 @@ all-local: Makefile
# Shortcut for installation of a subset of camlibs
# Usage: make CAMLIBS="canon.la ptp2.la" install-camlibs
-install-camlibs:
- $(MAKE) $(AM_MAKEFLAGS) BUILD_THESE_CAMLIBS="$(CAMLIBS)" install-camlibLTLIBRARIES
+install-camlibs: $(GP_CAMLIB_SET)
+ $(MAKE) $(AM_MAKEFLAGS) GP_CAMLIB_SET="$(GP_CAMLIB_SET)" install-camlibLTLIBRARIES
########################################################################