2 # Copyright 2017, pEp Foundation
3 # This file is part of pEpEngine
4 # This file may be used under the terms of the GNU General Public License version 3
7 include ../default.conf
9 PY_ENV := $(shell command -v python3 2> /dev/null)
12 TEST_HOME=$(HERE)/pEp_test_home
16 SRCS := $(wildcard src/*.cc) $(wildcard src/*/*.cc)
17 OBJS := $(addsuffix .o,$(basename $(SRCS)))
20 INC_DIRS := ./include /usr/local/include
21 INC_FLAGS := $(addprefix -I,$(INC_DIRS)) $(GPGME_INC) $(CPPUNIT_INC)
23 LDFLAGS += -L/usr/local/lib
25 CFLAGS += -Wno-deprecated
26 CXXFLAGS += -Wno-deprecated
28 LDFLAGS+= $(ETPAN_LIB) $(CPPUNIT_LIB) -L../asn.1 -L../src
29 LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
31 ifeq ($(BUILD_FOR),Linux)
35 ifeq ($(OPENPGP),NETPGP)
43 ifeq ($(shell uname),Darwin)
44 LIBPATH=DYLD_LIBRARY_PATH
45 LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
47 LIBPATH=LD_LIBRARY_PATH
54 # Create a list of the extra library paths for the loader. I do not assume that the engine (and its dependencies) are installed for testing.
55 # Note that += can not be used here, as it changes the amount of whitespace
56 EXTRA_LIB_PATHS=../src:
58 EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
61 EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
64 EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
68 EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
70 CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
71 ifneq ($(MAKECMDGOALS),clean)
72 ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
73 $(error The macro NDEBUG must not be defined for test compilation.)
77 CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
78 ifneq ($(MAKECMDGOALS),clean)
79 ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
80 $(error The macro NDEBUG must not be defined for test compilation.)
84 CPPFLAGS += $(INC_FLAGS) -MMD -MP
86 all: suitemaker $(TARGET) test_home_ scripts
89 $(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
94 @echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
97 $(PY_ENV) gensuitemaker.py
99 # Comma-separated list, no spaces
100 $(PY_ENV) gensuitemaker.py --exclude=$(EXCLUDE)
111 $(PY_ENV) genscripts.py
116 $(TEST_DEBUGGER) ./$(TARGET)
120 $(RM) $(TARGET) $(OBJS) $(DEPS)