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