krista@2637
|
1 |
|
damiano@1960
|
2 |
# Copyright 2017, pEp Foundation
|
damiano@1958
|
3 |
# This file is part of pEpEngine
|
damiano@1958
|
4 |
# This file may be used under the terms of the GNU General Public License version 3
|
vb@1517
|
5 |
# see LICENSE.txt
|
vb@1517
|
6 |
|
damiano@2210
|
7 |
include ../default.conf
|
vb@1422
|
8 |
|
krista@2644
|
9 |
#PY_ENV := $(shell command -v python3 2> /dev/null)
|
krista@2642
|
10 |
|
krista@2637
|
11 |
HERE:=$(CURDIR)
|
krista@2639
|
12 |
TEST_HOME=$(HERE)/pEp_test_home
|
krista@2637
|
13 |
|
krista@2638
|
14 |
TARGET=TestDriver
|
krista@2638
|
15 |
|
krista@2639
|
16 |
SRCS := $(wildcard src/*.cc) $(wildcard src/*/*.cc)
|
krista@2637
|
17 |
OBJS := $(addsuffix .o,$(basename $(SRCS)))
|
krista@2637
|
18 |
DEPS := $(OBJS:.o=.d)
|
damiano@1970
|
19 |
|
krista@2639
|
20 |
INC_DIRS := ./include /usr/local/include
|
krista@2637
|
21 |
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
krista@2637
|
22 |
|
krista@2637
|
23 |
LDFLAGS += -L/usr/local/lib
|
krista@2637
|
24 |
|
krista@2637
|
25 |
CFLAGS += -Wno-deprecated
|
krista@2637
|
26 |
CXXFLAGS += -Wno-deprecated
|
damiano@1970
|
27 |
|
damiano@1970
|
28 |
LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -L../src
|
damiano@1970
|
29 |
LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
|
damiano@1970
|
30 |
|
krista@1989
|
31 |
ifeq ($(BUILD_FOR),Linux)
|
krista@2637
|
32 |
LDLIBS+= -luuid
|
krista@1989
|
33 |
endif
|
krista@1988
|
34 |
|
damiano@1972
|
35 |
ifeq ($(OPENPGP),NETPGP)
|
krista@2637
|
36 |
LDLIBS+= -lnetpgp
|
Edouard@178
|
37 |
endif
|
Edouard@178
|
38 |
|
damiano@2002
|
39 |
ifdef SQLITE3_FROM_OS
|
krista@2637
|
40 |
LDLIBS+= -lsqlite3
|
damiano@2002
|
41 |
endif
|
damiano@2002
|
42 |
|
damiano@1970
|
43 |
ifeq ($(shell uname),Darwin)
|
krista@2637
|
44 |
LIBPATH=DYLD_LIBRARY_PATH
|
krista@2637
|
45 |
LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
|
damiano@1970
|
46 |
else
|
krista@2637
|
47 |
LIBPATH=LD_LIBRARY_PATH
|
krista@2637
|
48 |
LLDB_BIN=lldb
|
Edouard@178
|
49 |
endif
|
Edouard@178
|
50 |
|
krista@2637
|
51 |
LDLIBS += -lcpptest
|
krista@2637
|
52 |
|
krista@2637
|
53 |
|
damiano@1972
|
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.
|
damiano@1970
|
55 |
# Note that += can not be used here, as it changes the amount of whitespace
|
damiano@1970
|
56 |
EXTRA_LIB_PATHS=../src:
|
damiano@1970
|
57 |
ifdef ETPAN_LIB
|
krista@2637
|
58 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
|
damiano@1970
|
59 |
endif
|
damiano@1970
|
60 |
ifdef GPGME_LIB
|
krista@2637
|
61 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
|
damiano@1970
|
62 |
endif
|
damiano@1970
|
63 |
ifdef NETPGP_LIB
|
krista@2637
|
64 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
|
damiano@1970
|
65 |
endif
|
krista@2637
|
66 |
|
damiano@1970
|
67 |
# Remove trailing ':'
|
damiano@1970
|
68 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
|
damiano@1970
|
69 |
|
damiano@2074
|
70 |
CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
|
damiano@2063
|
71 |
ifneq ($(MAKECMDGOALS),clean)
|
krista@2637
|
72 |
ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
|
krista@2637
|
73 |
$(error The macro NDEBUG must not be defined for test compilation.)
|
krista@2637
|
74 |
endif
|
damiano@2062
|
75 |
endif
|
damiano@2062
|
76 |
|
damiano@2075
|
77 |
CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
|
damiano@2075
|
78 |
ifneq ($(MAKECMDGOALS),clean)
|
krista@2637
|
79 |
ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
|
krista@2637
|
80 |
$(error The macro NDEBUG must not be defined for test compilation.)
|
krista@2637
|
81 |
endif
|
damiano@2075
|
82 |
endif
|
damiano@2075
|
83 |
|
krista@2637
|
84 |
CPPFLAGS += $(INC_FLAGS) -MMD -MP
|
roker@1659
|
85 |
|
krista@2642
|
86 |
all: suitemaker $(TARGET) test_home_
|
krista@2639
|
87 |
|
krista@2637
|
88 |
$(TARGET): $(OBJS)
|
krista@2639
|
89 |
$(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
|
krista@2639
|
90 |
|
krista@2642
|
91 |
.PHONY: suitemaker
|
krista@2642
|
92 |
suitemaker:
|
krista@2642
|
93 |
ifndef PY_ENV
|
krista@2642
|
94 |
@echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
|
krista@2642
|
95 |
else
|
krista@2642
|
96 |
$(PY_ENV) gensuitemaker.py
|
krista@2642
|
97 |
endif
|
krista@2642
|
98 |
|
krista@2639
|
99 |
.PHONY: test_home_
|
krista@2639
|
100 |
test_home_:
|
krista@2639
|
101 |
mkdir -p $(TEST_HOME)
|
edouard@1844
|
102 |
|
krista@2639
|
103 |
TEST_CMD_=$(TARGET)
|
krista@2639
|
104 |
|
krista@2639
|
105 |
.PHONY: test
|
krista@2639
|
106 |
test: all
|
krista@2639
|
107 |
./$(TARGET) $(TEST_CMD_)
|
krista@2639
|
108 |
|
damiano@1970
|
109 |
.PHONY: clean
|
vb@2
|
110 |
clean:
|
krista@2637
|
111 |
$(RM) $(TARGET) $(OBJS) $(DEPS)
|
vb@2
|
112 |
|
roker@1656
|
113 |
|
roker@1656
|
114 |
|
krista@2639
|
115 |
-include $(DEPS)
|
krista@2639
|
116 |
|