pull in latest common.mk
Bug: None
Test: unittests pass
Change-Id: I20ea842ad7e8c4024d6b1be4c95295134fceefd3
diff --git a/common.mk b/common.mk
index 58252f9..7b39d33 100644
--- a/common.mk
+++ b/common.mk
@@ -101,6 +101,7 @@
VERBOSE ?= 0
MODE ?= opt
CXXEXCEPTIONS ?= 0
+RUN_TESTS ?= 1
ARCH ?= $(shell uname -m)
# Put objects in a separate tree based on makefile locations
@@ -318,7 +319,8 @@
# The same goes for CFLAGS.
COMMON_CFLAGS-gcc := -fvisibility=internal -ggdb3 -Wa,--noexecstack
COMMON_CFLAGS-clang := -fvisibility=hidden -ggdb
-COMMON_CFLAGS := -Wall -Werror -fno-strict-aliasing $(SSP_CFLAGS) -O1 -Wformat=2
+COMMON_CFLAGS := -Wall -Wunused -Wno-unused-parameter -Werror -Wformat=2 \
+ -fno-strict-aliasing $(SSP_CFLAGS) -O1
CXXFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CXXDRIVER)) -std=gnu++11
CFLAGS += $(COMMON_CFLAGS) $(COMMON_CFLAGS-$(CDRIVER)) -std=gnu11
CPPFLAGS += -D_FORTIFY_SOURCE=2
@@ -520,8 +522,11 @@
$(error Typo alert! LIBARY != LIBRARY)
-TEST(%): % qemu_chroot_install
+TEST(%): %
$(call TEST_implementation)
+ifneq ($(RUN_TESTS),0)
+TEST(%): qemu_chroot_install
+endif
.PHONY: TEST
# multiple targets with a wildcard need to share an directory.
@@ -587,13 +592,12 @@
$$(QUIET)touch "$$@"
endef
+# Wrap all the deps in $$(wildcard) so a missing header won't cause weirdness.
+# First we remove newlines and \, then wrap it.
define OBJECT_PATTERN_implementation
@$(ECHO) "$(1) $(subst $(SRC)/,,$<) -> $(2).o"
$(call auto_mkdir,$@)
$(QUIET)$($(1)) -c -MD -MF $(2).d $(3) -o $(2).o $<
- $(QUIET)# Wrap all the deps in $$(wildcard) so a missing header
- $(QUIET)# won't cause weirdness. First we remove newlines and \,
- $(QUIET)# then wrap it.
$(QUIET)sed -i -e :j -e '$$!N;s|\\\s*\n| |;tj' \
-e 's|^\(.*\s*:\s*\)\(.*\)$$|\1 $$\(wildcard \2\)|' $(2).d
endef
@@ -732,7 +736,9 @@
fi
@$(ECHO) "COVERAGE [$(COLOR_YELLOW)FINISHED$(COLOR_RESET)]"
endif
-.PHONY: tests
+# Standard name everyone else uses.
+check: tests
+.PHONY: check tests
qemu_chroot_install:
ifeq ($(USE_QEMU),1)
@@ -805,12 +811,17 @@
VALGRIND_CMD = /usr/bin/valgrind --tool=memcheck $(VALGRIND_ARGS) --
endif
+ifneq ($(RUN_TESTS),0)
define TEST_implementation
$(QUIET)$(call TEST_setup)
$(QUIET)$(call TEST_run)
$(QUIET)$(call TEST_teardown)
$(QUIET)exit $$(cat $(OUT)$(TARGET_OR_MEMBER).status.test)
endef
+else
+define TEST_implementation
+endef
+endif
define TEST_setup
@$(ECHO) -n "TEST $(TARGET_OR_MEMBER) "