Commit 2e3a415bdceeafdbab2c306874da1c851a68faef

Simon McVittie 2021-09-06T13:09:09

test: Use a static pattern rule to copy data to $(builddir) The version with an implicit pattern rule tended to fail if test/ was built in an "out-of-tree" build directory not below test/, for example: cd SDL mkdir _build-test ( cd _build-test; ../test/configure ) make -C _build-test as a result of the pattern rule first checking for axis.bmp, then for ../test/axis.bmp, then ../test/../test/axis.bmp, and so on until the maximum path length was reached. Note that this requires GNU make. The FreeBSD ports file for SDL seems to use GNU make (gmake) already, so presumably SDL's build system is already relying on GNU make extensions. Signed-off-by: Simon McVittie <smcv@debian.org>

diff --git a/test/Makefile.in b/test/Makefile.in
index e505799..019d0bb 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -336,26 +336,24 @@ distclean: clean
 	rm -f config.status config.cache config.log
 	rm -rf $(srcdir)/autom4te*
 
-ifneq ($(srcdir), .)
-%.bmp: $(srcdir)/%.bmp
-	cp $< $@
+DATA = \
+	axis.bmp \
+	button.bmp \
+	controllermap.bmp \
+	controllermap_back.bmp \
+	icon.bmp \
+	moose.dat \
+	sample.bmp \
+	sample.wav \
+	testgles2_sdf_img_normal.bmp \
+	testgles2_sdf_img_sdf.bmp \
+	testyuv.bmp \
+	$(NULL)
 
-%.wav: $(srcdir)/%.wav
-	cp $< $@
-
-%.dat: $(srcdir)/%.dat
+ifneq ($(srcdir), .)
+$(DATA) : %: $(srcdir)/% Makefile
 	cp $< $@
 endif
 
-copydatafiles: copybmpfiles copywavfiles copydatfiles
+copydatafiles: $(DATA)
 .PHONY : copydatafiles
-
-copybmpfiles: $(foreach bmp,$(wildcard $(srcdir)/*.bmp),$(notdir $(bmp)))
-.PHONY : copybmpfiles
-
-copywavfiles: $(foreach wav,$(wildcard $(srcdir)/*.wav),$(notdir $(wav)))
-.PHONY : copywavfiles
-
-copydatfiles: $(foreach dat,$(wildcard $(srcdir)/*.dat),$(notdir $(dat)))
-.PHONY : copydatfiles
-