1NULL = 2 3noinst_PROGRAMS = test-unit 4 5test_unit_SOURCES = test-unit-main.c 6 7SHEXT = $(EXEEXT) 8 9# For convenience, this provides a way to easily run individual unit tests: 10.PHONY: wrappers clean-wrappers 11 12wrappers: stamp-test-unit 13 @true 14stamp-test-unit: Makefile test-unit$(EXEEXT) 15 @mkdir -p wrappers 16 . $(top_builddir)/cogl/libmuffin-cogl-$(MUFFIN_PLUGIN_API_VERSION).la ; \ 17 $(NM) $(top_builddir)/cogl/.libs/"$$dlname"| \ 18 grep '[DR] _\?unit_test_'|sed 's/.\+ [DR] _\?//' > unit-tests 19 @chmod +x $(top_srcdir)/tests/test-launcher.sh 20 @( echo "/stamp-test-unit" ; \ 21 echo "/test-unit$(EXEEXT)" ; \ 22 echo "*.o" ; \ 23 echo ".gitignore" ; \ 24 echo "unit-tests" ; ) > .gitignore 25 @for i in `cat unit-tests`; \ 26 do \ 27 unit=`echo $$i | sed -e s/_/-/g | sed s/unit-test-//`; \ 28 echo " GEN $$unit"; \ 29 ( echo "#!/bin/sh" ; echo "$(top_srcdir)/tests/test-launcher.sh $(abs_builddir)/test-unit$(EXEEXT) 'unit_test_' '$$i' \"\$$@\"" ) > $$unit$(SHEXT) ; \ 30 chmod +x $$unit$(SHEXT); \ 31 echo "/$$unit$(SHEXT)" >> .gitignore; \ 32 done \ 33 && echo timestamp > $(@F) 34 35clean-wrappers: 36 @for i in `cat unit-tests`; \ 37 do \ 38 unit=`echo $$i | sed -e s/_/-/g | sed s/unit-test-//`; \ 39 echo " RM $$unit"; \ 40 rm -f $$unit$(SHEXT) ; \ 41 done \ 42 && rm -f unit-tests \ 43 && rm -f stamp-test-unit 44 45# NB: BUILT_SOURCES here a misnomer. We aren't building source, just inserting 46# a phony rule that will generate symlink scripts for running individual tests 47BUILT_SOURCES = wrappers 48 49# The include of the $(buildir)/cogl directory here is to make it so 50# that tests that directly include Cogl source code for whitebox 51# testing (such as test-bitmask) will still compile 52AM_CPPFLAGS = \ 53 -I$(top_srcdir) \ 54 -I$(top_srcdir)/test-fixtures \ 55 -I$(top_builddir)/cogl 56 57AM_CPPFLAGS += \ 58 -DCOGL_DISABLE_DEPRECATED \ 59 -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" \ 60 -DCOGL_COMPILATION 61 62test_unit_CFLAGS = -g3 -O0 $(COGL_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) 63test_unit_LDADD = \ 64 $(COGL_DEP_LIBS) \ 65 $(top_builddir)/cogl/libmuffin-cogl-$(MUFFIN_PLUGIN_API_VERSION).la \ 66 $(LIBM) 67test_unit_LDFLAGS = -export-dynamic 68 69# XXX: uncomment when tests get fixed 70#test: wrappers 71# @$(top_srcdir)/tests/run-tests.sh $(abs_builddir)/../config.env $(abs_builddir)/test-unit$(EXEEXT) 72 73# XXX: we could prevent the unit test suite from running 74# by simply defining this variable conditionally 75TEST_PROGS = test-unit 76 77.PHONY: test 78 79DISTCLEANFILES = .gitignore 80 81# we override the clean-generic target to clean up the wrappers so 82# we cannot use CLEANFILES 83clean-generic: clean-wrappers 84 $(QUIET_RM)rm -f .log 85