[pacman-dev] [PATCH 1/2] GNU make $(wildcard) assumes $(builddir) for relative paths.

Jeremy Heiner scalaprotractor at gmail.com
Thu Dec 19 15:30:59 EST 2013


So to allow VPATH builds $(srcdir) must be prepended for the globbing
and then immediately stripped back off to enable directory searching.
Without this patch 'sync200.py.in' is not found in $(build_dir) in a
VPATH build, causing 'make check' to abort.

Signed-off-by: Jeremy Heiner <ScalaProtractor at gmail.com>
---
 Makefile.am                     | 5 +++--
 test/pacman/tests/Makefile.am   | 4 ++--
 test/pacman/tests/sync200.py.in | 1 +
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 4d5adae..6396d23 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,8 +23,9 @@ dist_pkgdata_DATA = \
 	proto/proto.install \
 	proto/ChangeLog.proto
 
-$(top_srcdir)/test/pacman/tests/TESTS: $(wildcard test/pacman/tests/*.py*)
-	@printf "TESTS += %s\n" $^ | sed -e "s/\.py\.in/.py/" | LC_ALL=C sort -u > "$@"
+$(top_srcdir)/test/pacman/tests/TESTS: $(top_srcdir)/test/pacman/tests/*.py*
+	@echo "  GEN      $@"
+	@printf "TESTS += %s\n" $(patsubst %.py.in,%.py,$(patsubst $(top_srcdir)/%,%,$^)) | LC_ALL=C sort -u > "$@"
 
 TESTS =  test/scripts/parseopts_test.sh \
 				 test/scripts/human_to_size_test.sh \
diff --git a/test/pacman/tests/Makefile.am b/test/pacman/tests/Makefile.am
index 9ab0c77..c26a4a8 100644
--- a/test/pacman/tests/Makefile.am
+++ b/test/pacman/tests/Makefile.am
@@ -1,7 +1,7 @@
-CONFTESTS = $(patsubst %py.in,%py,$(wildcard *.py.in))
+CONFTESTS = $(patsubst $(srcdir)/%py.in,%py,$(wildcard $(srcdir)/*.py.in))
 
 check_SCRIPTS =	\
-	$(wildcard *.py) \
+	$(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/*.py)) \
 	$(CONFTESTS)
 
 noinst_SCRIPTS = $(check_SCRIPTS)
diff --git a/test/pacman/tests/sync200.py.in b/test/pacman/tests/sync200.py.in
index 6e47112..b6f05df 100644
--- a/test/pacman/tests/sync200.py.in
+++ b/test/pacman/tests/sync200.py.in
@@ -1,4 +1,5 @@
 self.description = "Synchronize the local database"
+# @configure_input@
 
 if len("@LIBCURL@") == 0:
 	self.option['XferCommand'] = ['/usr/bin/curl %u > %o']
-- 
1.8.5.2



More information about the pacman-dev mailing list