]> rtime.felk.cvut.cz Git - omk.git/blobdiff - snippets/wvtest.omk
Do not use CFLAGS when compiling C++ code
[omk.git] / snippets / wvtest.omk
index b5c17aa4ac1f6d01ea5be4821c9a4e880c4a326c..01ecb764599cbd3df049e8529c6c243a7716154b 100644 (file)
@@ -1,8 +1,13 @@
 # wvtest_SCRIPTS    .. list of scripts producing wvtest output
 # wvtest_PROGRAMS   .. list of the testing programs producing wvtest output
 
-# Documentation: wvtest_PROGRAMS is equivalent to test_PROGRAMS. The
-# difference is that it is automatically run during "make wvtest".
+ifndef WVTEST_LIBRARY
+WVTEST_LIBRARY = wvtest
+endif
+
+# Documentation: wvtest_PROGRAMS is amost equivalent to test_PROGRAMS.
+# The two differences are that the program is automatically linked
+# with $(WVTEST_LIBRARY) and it is run during "make wvtest".
 test_PROGRAMS += $(wvtest_PROGRAMS)
 
 # Documentation: If your project uses wvtest, it is recomended to put
@@ -19,8 +24,12 @@ define wvtest_template
 wvtest-pass-local: wvtest-run-$(1)
 .PHONY: wvtest-run-$(1)
 wvtest-run-$(1):
-       mkdir -p $(1).wvtest
-       cd $(1).wvtest && $(1)
+       $(Q)echo "Testing \"Run $(1)\" in Makefile.rules:"
+       $(Q)mkdir -p $(1).wvtest
+       $(Q)cd $(1).wvtest && \
+         PATH=$$(USER_BIN_DIR):$$$$PATH LD_LIBRARY_PATH=$$(USER_LIB_DIR):$$$$LD_LIBRARY_PATH \
+         $(1)
+$(notdir $(1))_LIBS += $$(WVTEST_LIBRARY)
 endef
 
 # Documentation: Write the test so, that it can be run from arbitrary