test/Makefile
author Krista Bennett <krista@pep-project.org>
Thu, 27 Sep 2018 17:34:45 +0200
branchsync_and_key_reset
changeset 2955 3b2500a15709
parent 2831 be6623599adb
parent 2943 dd40810a7490
child 3001 8c1aafb3ad57
permissions -rw-r--r--
ENGINE-398: merging key reset into sync; key reset needs some adjustments. Not compiling yet.
     1 
     2 # Copyright 2017, pEp Foundation
     3 # This file is part of pEpEngine
     4 # This file may be used under the terms of the GNU General Public License version 3
     5 # see LICENSE.txt
     6 
     7 include ../default.conf
     8 
     9 PY_ENV := $(shell command -v python3 2> /dev/null)
    10 
    11 HERE:=$(CURDIR)
    12 TEST_HOME=$(HERE)/pEp_test_home
    13 
    14 TARGET=TestDriver
    15 
    16 SRCS := $(wildcard src/*.cc) $(wildcard src/*/*.cc)
    17 OBJS := $(addsuffix .o,$(basename $(SRCS)))
    18 DEPS := $(OBJS:.o=.d)
    19 
    20 INC_DIRS := ./include /usr/local/include 
    21 INC_FLAGS := $(addprefix -I,$(INC_DIRS)) $(GPGME_INC)
    22 
    23 LDFLAGS += -L/usr/local/lib
    24 
    25 CFLAGS += -Wno-deprecated
    26 CXXFLAGS += -Wno-deprecated
    27 
    28 LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -L../src
    29 LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
    30 
    31 ifeq ($(BUILD_FOR),Linux)
    32 	LDLIBS+= -luuid
    33 endif
    34 
    35 ifeq ($(OPENPGP),NETPGP)
    36 	LDLIBS+= -lnetpgp
    37 endif
    38 
    39 ifdef SQLITE3_FROM_OS
    40 	LDLIBS+= -lsqlite3
    41 endif
    42 
    43 ifeq ($(shell uname),Darwin)
    44 	LIBPATH=DYLD_LIBRARY_PATH
    45 	LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
    46 else
    47 	LIBPATH=LD_LIBRARY_PATH
    48 	LLDB_BIN=lldb
    49 endif
    50 
    51 LDLIBS+= -lcpptest
    52 
    53 
    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.
    55 # Note that += can not be used here, as it changes the amount of whitespace
    56 EXTRA_LIB_PATHS=../src:
    57 ifdef ETPAN_LIB
    58 	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
    59 endif
    60 ifdef GPGME_LIB
    61 	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
    62 endif
    63 ifdef NETPGP_LIB
    64 	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
    65 endif
    66 
    67 # Remove trailing ':'
    68 EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
    69 
    70 CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
    71 ifneq ($(MAKECMDGOALS),clean)
    72 	ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
    73 		$(error The macro NDEBUG must not be defined for test compilation.)
    74 	endif
    75 endif
    76 
    77 CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
    78 ifneq ($(MAKECMDGOALS),clean)
    79 	ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
    80 		$(error The macro NDEBUG must not be defined for test compilation.)
    81 	endif
    82 endif
    83 
    84 CPPFLAGS += $(INC_FLAGS) -MMD -MP
    85 
    86 all: suitemaker $(TARGET) test_home_ scripts
    87 	
    88 $(TARGET): $(OBJS)
    89 	$(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
    90 
    91 .PHONY: suitemaker
    92 suitemaker:
    93 ifndef PY_ENV
    94 	@echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
    95 else
    96 ifndef EXCLUDE
    97 	$(PY_ENV) gensuitemaker.py
    98 else
    99 	# Comma-separated list, no spaces
   100 	$(PY_ENV) gensuitemaker.py --exclude=$(EXCLUDE)
   101 endif
   102 endif
   103 		
   104 .PHONY: test_home_
   105 test_home_: 
   106 	
   107 
   108 .PHONY: scripts
   109 scripts: 
   110 ifdef PY_ENV
   111 	$(PY_ENV) genscripts.py
   112 endif
   113 
   114 .PHONY: test
   115 test: all
   116 	$(TEST_DEBUGGER) ./$(TARGET)
   117 	
   118 .PHONY: clean
   119 clean:
   120 	$(RM) $(TARGET) $(OBJS) $(DEPS)
   121 	$(RM) $(HERE)/*Tests msg_2.0.asc
   122 
   123 
   124 
   125 -include $(DEPS)
   126