damiano@1960
|
1 |
# Copyright 2017, pEp Foundation
|
damiano@1958
|
2 |
# This file is part of pEpEngine
|
damiano@1958
|
3 |
# This file may be used under the terms of the GNU General Public License version 3
|
vb@1517
|
4 |
# see LICENSE.txt
|
vb@1517
|
5 |
|
damiano@3202
|
6 |
HERE:=$(CURDIR)
|
damiano@3202
|
7 |
|
damiano@3201
|
8 |
include ../Makefile.conf
|
vb@1422
|
9 |
|
damiano@3202
|
10 |
# User's without python3 will skip the generated parts of the test suite. That's OK.
|
krista@3200
|
11 |
PY_ENV:=$(shell command -v python3 2> /dev/null)
|
krista@2642
|
12 |
|
krista@2639
|
13 |
TEST_HOME=$(HERE)/pEp_test_home
|
krista@2637
|
14 |
|
krista@2638
|
15 |
TARGET=TestDriver
|
krista@2638
|
16 |
|
damiano@3202
|
17 |
SRCS:=$(wildcard src/*.cc) $(wildcard src/*/*.cc)
|
damiano@3202
|
18 |
OBJS:=$(addsuffix .o,$(basename $(SRCS)))
|
damiano@3202
|
19 |
DEPS:=$(OBJS:.o=.d)
|
damiano@1970
|
20 |
|
krista@2637
|
21 |
|
damiano@3202
|
22 |
LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(CPPUNIT_LIB)
|
krista@2637
|
23 |
|
damiano@3202
|
24 |
ifeq ($(OPENPGP),GPG)
|
damiano@3202
|
25 |
LDFLAGS+= $(GPGME_LIB)
|
damiano@3202
|
26 |
else ifeq ($(OPENPGP),NETPGP)
|
damiano@3202
|
27 |
LDFLAGS+= $(NETGPG_LIB)
|
krista@1989
|
28 |
endif
|
damiano@1970
|
29 |
|
damiano@1970
|
30 |
|
damiano@3202
|
31 |
LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1 -lcpptest
|
damiano@1970
|
32 |
|
krista@1989
|
33 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3202
|
34 |
LDLIBS+= -luuid
|
Edouard@178
|
35 |
endif
|
Edouard@178
|
36 |
|
neal@3191
|
37 |
ifeq ($(OPENPGP),SEQUOIA)
|
damiano@3236
|
38 |
LDFLAGS+= $(SEQUOIA_LDFLAGS)
|
damiano@3236
|
39 |
LDLIBS+= $(SEQUOIA_LIB)
|
krista@3538
|
40 |
CXXFLAGS+= $(SEQUOIA_CFLAGS) -DUSE_SEQUOIA
|
damiano@3236
|
41 |
INC_FLAGS+= $(SEQUOIA_INC)
|
neal@3191
|
42 |
endif
|
neal@3191
|
43 |
|
damiano@2002
|
44 |
ifdef SQLITE3_FROM_OS
|
damiano@3202
|
45 |
LDLIBS+= -lsqlite3
|
damiano@2002
|
46 |
endif
|
damiano@2002
|
47 |
|
damiano@3202
|
48 |
ifeq ($(OPENPGP),GPG)
|
damiano@3202
|
49 |
#LDLIBS+= -lgpgme
|
damiano@3202
|
50 |
else ifeq ($(OPENPGP),NETPGP)
|
damiano@3202
|
51 |
LDLIBS+= -lnetpgp
|
damiano@3202
|
52 |
ifeq ($(BUILD_FOR),Linux)
|
damiano@3202
|
53 |
LDLIBS+= -ltre
|
damiano@3202
|
54 |
endif
|
Edouard@178
|
55 |
endif
|
Edouard@178
|
56 |
|
damiano@2062
|
57 |
|
damiano@2075
|
58 |
CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
|
damiano@3202
|
59 |
|
damiano@3202
|
60 |
# FIXME Possibly missing incdirs: ASN1C_INC
|
krista@3538
|
61 |
CXXFLAGS+= -I./include -I../sync $(CPPUNIT_INC) $(INC_FLAGS) -Wno-deprecated
|
damiano@3202
|
62 |
|
damiano@3202
|
63 |
ifeq ($(OPENPGP),GPG)
|
damiano@3202
|
64 |
CXXFLAGS+= -DUSE_GPG $(GPGME_INC)
|
damiano@3202
|
65 |
else ifeq ($(OPENPGP),NETPGP)
|
damiano@3202
|
66 |
CXXFLAGS+= -DUSE_NETPGP $(NETPGP_INC)
|
damiano@2075
|
67 |
endif
|
krista@2637
|
68 |
|
krista@2637
|
69 |
|
damiano@3208
|
70 |
EXTRA_LIB_PATHS=.:../src:
|
damiano@1970
|
71 |
ifdef ETPAN_LIB
|
damiano@3206
|
72 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
|
damiano@1970
|
73 |
endif
|
damiano@1970
|
74 |
ifdef GPGME_LIB
|
damiano@3206
|
75 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
|
damiano@1970
|
76 |
endif
|
damiano@1970
|
77 |
ifdef NETPGP_LIB
|
damiano@3206
|
78 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
|
damiano@3206
|
79 |
endif
|
damiano@3206
|
80 |
ifdef CPPUNIT_LIB
|
damiano@3206
|
81 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(CPPUNIT_LIB)):
|
damiano@1970
|
82 |
endif
|
krista@2637
|
83 |
|
damiano@1970
|
84 |
# Remove trailing ':'
|
damiano@1970
|
85 |
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
|
damiano@1970
|
86 |
|
damiano@3206
|
87 |
ifeq ($(BUILD_FOR),Darwin)
|
damiano@3206
|
88 |
LIBPATH=DYLD_LIBRARY_PATH
|
damiano@3206
|
89 |
else
|
damiano@3206
|
90 |
LIBPATH=LD_LIBRARY_PATH
|
damiano@2062
|
91 |
endif
|
damiano@2062
|
92 |
|
krista@3427
|
93 |
# FIXME: this forces a path on execution which overrides system paths for
|
krista@3427
|
94 |
# libraries like iconv and causes runtime errors.
|
krista@3427
|
95 |
#TEST_CMD_PFX=$(LIBPATH)=$(EXTRA_LIB_PATHS)
|
krista@3427
|
96 |
TEST_CMD_PFX=
|
damiano@3206
|
97 |
|
vb@3456
|
98 |
.PHONY: all clean test
|
damiano@2075
|
99 |
|
vb@3466
|
100 |
all:
|
vb@3466
|
101 |
make .suitemaker
|
vb@3451
|
102 |
make $(TARGET) .scripts
|
vb@3466
|
103 |
touch .suitemaker
|
roker@1659
|
104 |
|
damiano@3202
|
105 |
%.d: %.cc
|
damiano@3202
|
106 |
$(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< | sed -e 's,\($*\)\.o[ :]*,\1.o $@: ,g' > $@
|
krista@3170
|
107 |
|
vb@3466
|
108 |
.suitemaker: src
|
krista@2642
|
109 |
ifndef PY_ENV
|
krista@2642
|
110 |
@echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
|
krista@2642
|
111 |
else
|
krista@2941
|
112 |
ifndef EXCLUDE
|
krista@2642
|
113 |
$(PY_ENV) gensuitemaker.py
|
krista@2941
|
114 |
else
|
krista@2941
|
115 |
# Comma-separated list, no spaces
|
krista@2941
|
116 |
$(PY_ENV) gensuitemaker.py --exclude=$(EXCLUDE)
|
krista@2941
|
117 |
endif
|
krista@2642
|
118 |
endif
|
krista@2703
|
119 |
|
vb@3451
|
120 |
$(TARGET): $(OBJS)
|
vb@3449
|
121 |
$(LINK.cc) $(OBJS) $(LOADLIBES) $(LDLIBS) -o $@
|
vb@3449
|
122 |
|
vb@3449
|
123 |
.scripts:
|
krista@2703
|
124 |
ifdef PY_ENV
|
krista@2703
|
125 |
$(PY_ENV) genscripts.py
|
vb@3449
|
126 |
touch .scripts
|
krista@2703
|
127 |
endif
|
edouard@1844
|
128 |
|
krista@2639
|
129 |
test: all
|
damiano@3236
|
130 |
$(TEST_CMD_PFX) $(TEST_DEBUGGER) ./$(TARGET)
|
neal@3191
|
131 |
|
vb@2
|
132 |
clean:
|
krista@3436
|
133 |
$(RM) $(TARGET) $(TARGET).o $(TARGET).d $(OBJS) $(notdir $(basename $(OBJS))) $(DEPS)
|
vb@3468
|
134 |
$(RM) $(HERE)/*Tests msg_2.0.asc $(HERE)/pEp_test_home .scripts .suitemaker
|
roker@1656
|
135 |
|
damiano@3202
|
136 |
# If only the goal 'clean' is given, do not generate and include the '%.d' files.¬
|
damiano@3202
|
137 |
ifneq ($(MAKECMDGOALS),clean)
|
damiano@3202
|
138 |
-include $(DEPS)
|
damiano@3202
|
139 |
endif
|