test/Makefile
author Damiano Boppart <damiano.boppart@pep.security>
Sat, 22 Dec 2018 01:34:30 +0100
branchmake-cleanup
changeset 3204 fa2e7ead0f4e
parent 3203 47bb3a01f2e1
child 3205 eb1093486582
permissions -rw-r--r--
Minor makefile fixes
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@1513
     4
# see LICENSE.txt
vb@1513
     5
damiano@3202
     6
HERE:=$(CURDIR)
damiano@3202
     7
damiano@3201
     8
include ../Makefile.conf
vb@2
     9
damiano@3204
    10
VPATH=src
damiano@3204
    11
damiano@3202
    12
# User's without python3 will skip the generated parts of the test suite. That's OK.
krista@3200
    13
PY_ENV:=$(shell command -v python3 2> /dev/null)
krista@2642
    14
krista@2639
    15
TEST_HOME=$(HERE)/pEp_test_home
damiano@1970
    16
krista@2638
    17
TARGET=TestDriver
krista@2638
    18
damiano@3202
    19
SRCS:=$(wildcard src/*.cc) $(wildcard src/*/*.cc)
damiano@3202
    20
OBJS:=$(addsuffix .o,$(basename $(SRCS)))
damiano@3202
    21
DEPS:=$(OBJS:.o=.d)
krista@2637
    22
krista@2637
    23
damiano@3202
    24
LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(CPPUNIT_LIB)
krista@2637
    25
damiano@3202
    26
ifeq ($(OPENPGP),GPG)
damiano@3202
    27
    LDFLAGS+= $(GPGME_LIB)
damiano@3202
    28
else ifeq ($(OPENPGP),NETPGP)
damiano@3202
    29
    LDFLAGS+= $(NETGPG_LIB)
Edouard@178
    30
endif
Edouard@178
    31
damiano@3202
    32
damiano@3202
    33
LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1 -lcpptest
damiano@3202
    34
krista@3164
    35
ifeq ($(BUILD_FOR),Linux)
damiano@3202
    36
    LDLIBS+= -luuid
edouard@1939
    37
endif
edouard@1939
    38
damiano@2002
    39
ifdef SQLITE3_FROM_OS
damiano@3202
    40
    LDLIBS+= -lsqlite3
damiano@2002
    41
endif
damiano@2002
    42
damiano@3202
    43
ifeq ($(OPENPGP),GPG)
damiano@3202
    44
    #LDLIBS+= -lgpgme
damiano@3202
    45
else ifeq ($(OPENPGP),NETPGP)
damiano@3202
    46
    LDLIBS+= -lnetpgp
damiano@3202
    47
    ifeq ($(BUILD_FOR),Linux)
damiano@3202
    48
        LDLIBS+= -ltre
damiano@3202
    49
    endif
damiano@1970
    50
endif
damiano@1970
    51
krista@2637
    52
damiano@3202
    53
CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
damiano@3202
    54
damiano@3202
    55
# FIXME Possibly missing incdirs: ASN1C_INC
damiano@3202
    56
CXXFLAGS+= -I./include -I../sync $(CPPUNIT_INC) -Wno-deprecated
damiano@3202
    57
damiano@3202
    58
ifeq ($(OPENPGP),GPG)
damiano@3202
    59
    CXXFLAGS+= -DUSE_GPG $(GPGME_INC)
damiano@3202
    60
else ifeq ($(OPENPGP),NETPGP)
damiano@3202
    61
    CXXFLAGS+= -DUSE_NETPGP $(NETPGP_INC)
damiano@1970
    62
endif
krista@2637
    63
damiano@1970
    64
damiano@3202
    65
.PHONY: all
damiano@3202
    66
all: suitemaker $(TARGET) scripts
damiano@2062
    67
damiano@3202
    68
%.d: %.cc
damiano@3202
    69
	$(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< | sed -e 's,\($*\)\.o[ :]*,\1.o $@: ,g' > $@
krista@3170
    70
krista@2637
    71
$(TARGET): $(OBJS)
damiano@3203
    72
# This should actually be done with a built-in rule
damiano@3203
    73
#	$(LINK.cc) $^ $(LOADLIBES) $(LDLIBS) -o $@
edouard@1844
    74
krista@2642
    75
.PHONY: suitemaker
krista@2642
    76
suitemaker:
krista@2642
    77
ifndef PY_ENV
krista@2642
    78
	@echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
krista@2642
    79
else
krista@2941
    80
ifndef EXCLUDE
krista@2642
    81
	$(PY_ENV) gensuitemaker.py
krista@2941
    82
else
krista@2941
    83
	# Comma-separated list, no spaces
krista@2941
    84
	$(PY_ENV) gensuitemaker.py --exclude=$(EXCLUDE)
krista@2941
    85
endif
krista@2642
    86
endif
krista@2696
    87
vb@2750
    88
.PHONY: scripts
damiano@3202
    89
scripts:
krista@2696
    90
ifdef PY_ENV
krista@2696
    91
	$(PY_ENV) genscripts.py
krista@2696
    92
endif
krista@2639
    93
krista@2639
    94
.PHONY: test
krista@2639
    95
test: all
vb@2750
    96
	$(TEST_DEBUGGER) ./$(TARGET)
damiano@3202
    97
damiano@1970
    98
.PHONY: clean
vb@2
    99
clean:
damiano@3204
   100
	$(RM) $(TARGET) $(TARGET).o $(OBJS) $(notdir $(basename $(OBJS))) $(DEPS)
vb@2831
   101
	$(RM) $(HERE)/*Tests msg_2.0.asc
vb@2
   102
damiano@3202
   103
# If only the goal 'clean' is given, do not generate and include the '%.d' files.¬
damiano@3202
   104
ifneq ($(MAKECMDGOALS),clean)
damiano@3202
   105
    -include $(DEPS)
damiano@3202
   106
endif