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@2645
|
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@3170
|
20 |
INC_DIRS := ./include /usr/local/include ../src ../sync ../asn.1
|
damiano@2975
|
21 |
INC_FLAGS := $(addprefix -I,$(INC_DIRS)) $(GPGME_INC) $(CPPUNIT_INC)
|
krista@2637
|
22 |
|
krista@3245
|
23 |
LDFLAGS += -L/usr/local/lib
|
krista@2637
|
24 |
|
krista@2637
|
25 |
CFLAGS += -Wno-deprecated
|
krista@2637
|
26 |
CXXFLAGS += -Wno-deprecated
|
krista@3170
|
27 |
CFLAGS:=$(filter-out -Wall,$(CFLAGS))
|
damiano@1970
|
28 |
|
damiano@2975
|
29 |
LDFLAGS+= $(ETPAN_LIB) $(CPPUNIT_LIB) -L../asn.1 -L../src
|
damiano@1970
|
30 |
LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
|
damiano@1970
|
31 |
|
krista@1989
|
32 |
ifeq ($(BUILD_FOR),Linux)
|
krista@2637
|
33 |
LDLIBS+= -luuid
|
krista@1989
|
34 |
endif
|
krista@1988
|
35 |
|
damiano@1972
|
36 |
ifeq ($(OPENPGP),NETPGP)
|
krista@3245
|
37 |
LDLIBS+= -lnetpgp
|
krista@3170
|
38 |
CFLAGS+= -DUSE_NETPGP
|
krista@3164
|
39 |
ifeq ($(BUILD_FOR),Linux)
|
krista@3164
|
40 |
LDLIBS+= -ltre
|
krista@3164
|
41 |
endif
|
Edouard@178
|
42 |
endif
|
Edouard@178
|
43 |
|
neal@3191
|
44 |
ifeq ($(OPENPGP),SEQUOIA)
|
neal@3191
|
45 |
LDFLAGS+= $(SEQUOIA_LDFLAGS)
|
neal@3191
|
46 |
LDLIBS+= $(SEQUOIA_LIB)
|
neal@3210
|
47 |
CFLAGS+= $(SEQUOIA_CFLAGS) -DUSE_SEQUOIA
|
neal@3191
|
48 |
INC_FLAGS+= $(SEQUOIA_INC)
|
neal@3191
|
49 |
endif
|
neal@3191
|
50 |
|
damiano@2002
|
51 |
ifdef SQLITE3_FROM_OS
|
krista@2637
|
52 |
LDLIBS+= -lsqlite3
|
damiano@2002
|
53 |
endif
|
damiano@2002
|
54 |
|
damiano@1970
|
55 |
ifeq ($(shell uname),Darwin)
|
krista@2637
|
56 |
LIBPATH=DYLD_LIBRARY_PATH
|
krista@2637
|
57 |
LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
|
damiano@1970
|
58 |
else
|
krista@2637
|
59 |
LIBPATH=LD_LIBRARY_PATH
|
krista@2637
|
60 |
LLDB_BIN=lldb
|
Edouard@178
|
61 |
endif
|
Edouard@178
|
62 |
|
krista@2925
|
63 |
LDLIBS+= -lcpptest
|
krista@2637
|
64 |
|
krista@2637
|
65 |
|
damiano@1972
|
66 |
# 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
|
67 |
# Note that += can not be used here, as it changes the amount of whitespace
|
damiano@1970
|
68 |
EXTRA_LIB_PATHS=../src:
|
damiano@1970
|
69 |
ifdef ETPAN_LIB
|
krista@2637
|
70 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
|
damiano@1970
|
71 |
endif
|
damiano@1970
|
72 |
ifdef GPGME_LIB
|
krista@2637
|
73 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
|
damiano@1970
|
74 |
endif
|
damiano@1970
|
75 |
ifdef NETPGP_LIB
|
krista@2637
|
76 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
|
damiano@1970
|
77 |
endif
|
krista@2637
|
78 |
|
damiano@1970
|
79 |
# Remove trailing ':'
|
damiano@1970
|
80 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
|
damiano@1970
|
81 |
|
damiano@2074
|
82 |
CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
|
damiano@2063
|
83 |
ifneq ($(MAKECMDGOALS),clean)
|
krista@2637
|
84 |
ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
|
krista@2637
|
85 |
$(error The macro NDEBUG must not be defined for test compilation.)
|
krista@2637
|
86 |
endif
|
damiano@2062
|
87 |
endif
|
damiano@2062
|
88 |
|
damiano@2075
|
89 |
CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
|
damiano@2075
|
90 |
ifneq ($(MAKECMDGOALS),clean)
|
krista@2637
|
91 |
ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
|
krista@2637
|
92 |
$(error The macro NDEBUG must not be defined for test compilation.)
|
krista@2637
|
93 |
endif
|
damiano@2075
|
94 |
endif
|
damiano@2075
|
95 |
|
krista@2637
|
96 |
CPPFLAGS += $(INC_FLAGS) -MMD -MP
|
roker@1659
|
97 |
|
krista@2703
|
98 |
all: suitemaker $(TARGET) test_home_ scripts
|
krista@2639
|
99 |
|
krista@3170
|
100 |
%.o: %.cc
|
krista@3170
|
101 |
$(CXX) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
|
krista@3170
|
102 |
|
krista@2637
|
103 |
$(TARGET): $(OBJS)
|
krista@3170
|
104 |
$(CXX) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
|
krista@2639
|
105 |
|
krista@2642
|
106 |
.PHONY: suitemaker
|
krista@2642
|
107 |
suitemaker:
|
krista@2642
|
108 |
ifndef PY_ENV
|
krista@2642
|
109 |
@echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
|
krista@2642
|
110 |
else
|
krista@2941
|
111 |
ifndef EXCLUDE
|
krista@2642
|
112 |
$(PY_ENV) gensuitemaker.py
|
krista@2941
|
113 |
else
|
krista@2941
|
114 |
# Comma-separated list, no spaces
|
krista@2941
|
115 |
$(PY_ENV) gensuitemaker.py --exclude=$(EXCLUDE)
|
krista@2941
|
116 |
endif
|
krista@2642
|
117 |
endif
|
krista@2642
|
118 |
|
krista@2639
|
119 |
.PHONY: test_home_
|
krista@2639
|
120 |
test_home_:
|
krista@2703
|
121 |
|
krista@2703
|
122 |
|
vb@2750
|
123 |
.PHONY: scripts
|
krista@2703
|
124 |
scripts:
|
krista@2703
|
125 |
ifdef PY_ENV
|
krista@2703
|
126 |
$(PY_ENV) genscripts.py
|
krista@2703
|
127 |
endif
|
edouard@1844
|
128 |
|
krista@2639
|
129 |
.PHONY: test
|
krista@2639
|
130 |
test: all
|
neal@3191
|
131 |
ulimit -n 20000; $(TEST_DEBUGGER) ./$(TARGET)
|
neal@3191
|
132 |
|
damiano@1970
|
133 |
.PHONY: clean
|
vb@2
|
134 |
clean:
|
krista@2637
|
135 |
$(RM) $(TARGET) $(OBJS) $(DEPS)
|
vb@2831
|
136 |
$(RM) $(HERE)/*Tests msg_2.0.asc
|
vb@2
|
137 |
|
roker@1656
|
138 |
|
roker@1656
|
139 |
|
krista@2639
|
140 |
-include $(DEPS)
|
krista@2639
|
141 |
|