You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thomas Nilefalk edited this page Jul 13, 2020
·
2 revisions
Makefiles
Here's a macro that minimizes typing when defining yet another unittest with Cgreen and its runner:
# Macro for unittests that link the SUT and a small number of dependent .o
# $(1) = the SUT name and it assumes that the tests are in $(1)_tests.c
# $(2) = space separated list of extra .o to link
define UNITTEST
$(1)_DEPENDENCIES = $(2)
$(1)_DEPS = $$(patsubst %,$(OBJDIR)/%.o,$$($(1)_DEPENDENCIES))
$(1)_tests.so: $(OBJDIR)/$(1)_tests.o $(OBJDIR)/$(1).o $$($(1)_DEPS)
gcc -shared -o $$@ $$^ $$(COVERAGE) $$(CGREEN)
endef