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>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
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
-