1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
# Make any tests, and possibly run them.
# A selection of variables are exported from the master Makefile.
# As each test will have a main function we need to handle this file by file.
# We're using the fairly typical convention that any file ending in _test.cpp
# is a test executable.
SOURCES = $(wildcard *.cpp)
OBJS = $(sort $(SOURCES:%.cpp=$(ODIR)/%.o))
CATA_LIB=../$(BUILD_PREFIX)cataclysm.a
# If you invoke this makefile directly and the parent directory was
# built with BUILD_PREFIX set, you must set it for this invocation as well.
ODIR ?= obj
LDFLAGS += -L.
# Allow use of any header files from cataclysm.
# Catch sections throw unused variable warnings.
# Add no-sign-compare to fix MXE issue when compiling
# Catch also uses "#pragma gcc diagnostic", which is not recognized on some supported compilers.
# Clang and mingw are warning about Catch macros around perfectly normal boolean operations.
CXXFLAGS += -I../src -Wno-unused-variable -Wno-sign-compare -Wno-unknown-pragmas -Wno-parentheses -MMD -MP
CXXFLAGS += -Wall -Wextra
TEST_TARGET = $(BUILD_PREFIX)cata_test
tests: $(TEST_TARGET)
$(BUILD_PREFIX)cata_test: $(OBJS) $(CATA_LIB)
+$(CXX) $(W32FLAGS) -o $@ $(DEFINES) $(OBJS) $(CATA_LIB) $(CXXFLAGS) $(LDFLAGS)
# Iterate over all the individual tests.
check: $(TEST_TARGET)
cd .. && tests/$(TEST_TARGET) -d yes -r cata --rng-seed time
clean:
rm -rf *obj
rm -f *cata_test
#Unconditionally create object directory on invocation.
$(shell mkdir -p $(ODIR))
$(ODIR)/%.o: %.cpp
$(CXX) $(DEFINES) $(CXXFLAGS) -c $< -o $@
.PHONY: clean check tests
.SECONDARY: $(OBJS)
-include ${OBJS:.o=.d}
|