test/Makefile
author Edouard Tisserant <edouard@pep-project.org>
Mon, 20 Mar 2017 18:19:06 +0100
changeset 1682 1a6a30a2b30c
parent 1659 2d123f24b05f
child 1811 04d2a7abcfa2
permissions -rw-r--r--
Added %_valgrind target in test's Makefile. Added doc to build with netpgp on macosx
     1 
     2 # This file is under GNU General Public License 3.0
     3 # see LICENSE.txt
     4 
     5 include ../Makefile.conf
     6 
     7 export GNUPGHOME=.
     8 
     9 CC?=g++ -std=gnu++11 -pthread
    10 CXX?=g++ -std=gnu++11 -pthread
    11 LD?=$(CXX)
    12 LDFLAGS?=-L$(HOME)/lib
    13 LDLIBS?=-letpan -lpEpEngine -lstdc++ -L../asn.1 -lasn1
    14 ifeq ($(BUILD_FOR),Linux)
    15 	LDLIBS+= -luuid
    16 endif
    17 CXXFLAGS?=-std=c++11 -g -O0 -I../src -I../asn.1
    18 # CXXFLAGS=-O3 -DNDEBUG
    19 
    20 ifeq ("$(OPENPGP)","NETPGP")
    21 	LDLIBS+= -lnetpgp
    22 endif
    23 
    24 TARGET=pEpEngineTest
    25 
    26 UNIT_TESTS_SOURCE=$(wildcard *_test.cc)
    27 UNIT_TESTS=$(subst .cc,,$(UNIT_TESTS_SOURCE))
    28 UNIT_TESTS_RUN=$(subst .cc,_run,$(UNIT_TESTS_SOURCE))
    29 
    30 all: $(TARGET) $(UNIT_TESTS)
    31 
    32 .PHONY: clean
    33 
    34 # don't delete .o files!
    35 .PRECIOUS: %.o
    36 
    37 clean:
    38 	rm -f *.o $(TARGET) *.a *~ $(UNIT_TESTS) pep_Dokument_Titel.pdf msg4.asc
    39 	rm -Rf *.dSYM .imported pubring.gpg secring.gpg random_seed *.conf trustdb.gpg
    40 
    41 .imported:
    42 	-cat 0x*.asc *_sec.asc | gpg2 --import
    43 	touch .imported
    44 
    45 test: pEpEngineTest .imported
    46 	LD_LIBRARY_PATH=~/lib:../src ./pEpEngineTest
    47 
    48 %_test : %_test.o test_util.o
    49 	 $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
    50 
    51 %_run : %
    52 	LD_LIBRARY_PATH=~/lib:../src ./$<
    53 
    54 
    55 %_lldb : %
    56 	LD_LIBRARY_PATH=~/lib:../src lldb ./$<
    57 
    58 %_valgrind : %
    59 	LD_LIBRARY_PATH=~/lib:../src valgrind --leak-check=yes ./$<
    60 
    61 %_gdb : %
    62 	LD_LIBRARY_PATH=~/lib:../src gdb ./$<
    63 
    64 unit_tests: $(UNIT_TESTS) $(UNIT_TESTS_RUN)
    65 
    66 install:
    67 	make -C .. install