# (C) Copyright 2006, 2007, 2008, 2009, 2010 by Michal Sojka - Czech Technical University, FEE, DCE
#
# Homepage: http://rtime.felk.cvut.cz/omk/
-# Version: 0.2-27-g254fd61
+# Version: 0.2-35-gb9c630c
#
# The OMK build system is distributed under the GNU General Public
# License. See file COPYING for details.
# W .. whole tree - if set to 1, make is always called from the top-level directory
# SUBDIRS .. list of subdirectories intended for make from actual directory
# default_CONFIG .. list of default config assignments CONFIG_XXX=y/n ...
+# wvtest_SCRIPTS .. list of scripts producing wvtest output #OMK:wvtest.omk
+# wvtest_PROGRAMS .. list of the testing programs producing wvtest output
# LN_HEADERS .. if "y", header files are symbolicaly linked instead of copied. #OMK:include.omk
# input variables #OMK:linux.omk
# lib_LIBRARIES .. list of the user-space libraries
cp -v Makefile "$${d}/Makefile"; \
fi \
done
+ #OMK:wvtest.omk@Makefile.rules.linux
+# Documentation: wvtest_PROGRAMS is equivalent to test_PROGRAMS. The
+# difference is that it is automatically run during "make wvtest".
+test_PROGRAMS += $(wvtest_PROGRAMS)
+
+# Documentation: If your project uses wvtest, it is recomended to put
+# the "test: wvtest" rule to config.target.
+wvtest:
+ $(Q)$(MAKERULES_DIR)/wvtestrun $(MAKE) wvtest-pass
+
+.PHONY: wvtest
+
+$(eval $(call omk_pass_template,wvtest-pass,$$(LOCAL_BUILD_DIR),,$(wvtest_SCRIPTS)$(wvtest_PROGRAMS)))
+
+# Usage: $(call wvtest_template,<shell command>)
+define wvtest_template
+wvtest-pass-local: wvtest-run-$(1)
+.PHONY: wvtest-run-$(1)
+wvtest-run-$(1):
+ mkdir -p $(1).wvtest
+ cd $(1).wvtest && $(1)
+endef
+
+# Documentation: Write the test so, that it can be run from arbitrary
+# directory, i.e. in case of a script ensure that the wvtest library
+# is sourced like this:
+#
+# . $(dirname $0)/wvtest.sh
+
+$(foreach script,$(wvtest_SCRIPTS),$(eval $(call wvtest_template,$(SOURCES_DIR)/$(script))))
+# Hack!!!
+USER_TESTS_DIR := $(OUTPUT_DIR)/_compiled/bin-tests
+$(foreach prog,$(wvtest_PROGRAMS),$(eval $(call wvtest_template,$(USER_TESTS_DIR)/$(prog))))
ifeq ($(OMK_VERBOSE),1) #OMK:include.omk@Makefile.rules.linux
CPHEADER_FLAGS += -v
LNHEADER_FLAGS += -v
define cp_cmd
if ! cmp --quiet $(1) $(2); then \
echo " CP $(1:$(OUTPUT_DIR)/%=%) -> $(2:$(OUTPUT_DIR)/%=%)"; \
- install -C -D $(CPHEADER_FLAGS) $(1) $(2) || exit 1; \
+ install -D $(CPHEADER_FLAGS) $(1) $(2) || exit 1; \
fi
endef
else