test/Makefile
author Edouard Tisserant <edouard@pep-project.org>
Mon, 24 Jul 2017 15:29:32 +0200
branchgpgme_passphrase_cb
changeset 1939 d117622a7fe0
parent 1934 c59a9b6e9f40
child 1955 8ec0b81a659f
child 1988 ea7bceda4dc8
permissions -rw-r--r--
ENGINE-220 no way to use passphrase_cb with 2.0.30. Simply never get called in case of passphras protected key, pinentry dialog keeps showing up. Moving to 2.1 see if anything better
vb@1517
     1
vb@1517
     2
# This file is under GNU General Public License 3.0
vb@1517
     3
# see LICENSE.txt
vb@1517
     4
edouard@1844
     5
HERE := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
vb@2
     6
edouard@1844
     7
include ../Makefile.conf
vb@1422
     8
vb@66
     9
CC?=g++ -std=gnu++11 -pthread
vb@66
    10
CXX?=g++ -std=gnu++11 -pthread
vb@66
    11
LD?=$(CXX)
Edouard@134
    12
LDFLAGS?=-L$(HOME)/lib
vb@1304
    13
LDLIBS?=-letpan -lpEpEngine -lstdc++ -L../asn.1 -lasn1
vb@1304
    14
ifeq ($(BUILD_FOR),Linux)
vb@1310
    15
	LDLIBS+= -luuid
vb@1304
    16
endif
roker@762
    17
CXXFLAGS?=-std=c++11 -g -O0 -I../src -I../asn.1
vb@2
    18
# CXXFLAGS=-O3 -DNDEBUG
vb@2
    19
Edouard@178
    20
ifeq ("$(OPENPGP)","NETPGP")
Edouard@178
    21
	LDLIBS+= -lnetpgp
Edouard@178
    22
endif
Edouard@178
    23
vb@2
    24
TARGET=pEpEngineTest
vb@2
    25
vb@50
    26
UNIT_TESTS_SOURCE=$(wildcard *_test.cc)
vb@50
    27
UNIT_TESTS=$(subst .cc,,$(UNIT_TESTS_SOURCE))
krista@1617
    28
UNIT_TESTS_RUN=$(subst .cc,_run,$(UNIT_TESTS_SOURCE))
vb@2
    29
vb@48
    30
all: $(TARGET) $(UNIT_TESTS)
vb@2
    31
vb@2
    32
.PHONY: clean
vb@2
    33
roker@1659
    34
# don't delete .o files!
roker@1659
    35
.PRECIOUS: %.o
roker@1659
    36
edouard@1844
    37
unexport GNUPGHOME;
edouard@1844
    38
TEST_HOME=$(HERE)/test_home
edouard@1934
    39
TEST_GNUPGHOME=$(TEST_HOME)/.gnupg
edouard@1844
    40
edouard@1929
    41
ifeq ($(shell which gpg2), )
edouard@1929
    42
    GPG_CMD = gpg
edouard@1929
    43
else
edouard@1929
    44
    GPG_CMD = gpg2
edouard@1929
    45
endif
edouard@1929
    46
edouard@1844
    47
ifeq ($(shell uname), Darwin)
edouard@1844
    48
    LIBPATH = DYLD_LIBRARY_PATH
edouard@1851
    49
    LLDB_BIN = /Applications/Xcode.app/Contents/Developer/usr/bin/lldb
edouard@1844
    50
else
edouard@1844
    51
    LIBPATH = LD_LIBRARY_PATH
edouard@1851
    52
    LLDB_BIN = lldb
edouard@1844
    53
endif
edouard@1844
    54
edouard@1844
    55
TEST_CMD_PFX = $(LIBPATH)=$(HOME)/lib:../src HOME=$(TEST_HOME)
edouard@1844
    56
edouard@1934
    57
test_home_: 
edouard@1939
    58
	-gpgconf --kill gpg-agent
edouard@1939
    59
	-HOME=$(TEST_HOME) gpgconf --kill gpg-agent
edouard@1939
    60
	-killall gpg-agent
edouard@1934
    61
	rm -rf $(TEST_HOME)
edouard@1934
    62
	mkdir -p $(TEST_GNUPGHOME)/private-keys-v1.d
edouard@1934
    63
	$(GPG_CMD) --import --batch --homedir $(TEST_GNUPGHOME) 0x*.asc *_sec.asc
edouard@1844
    64
vb@2
    65
clean:
vb@458
    66
	rm -f *.o $(TARGET) *.a *~ $(UNIT_TESTS) pep_Dokument_Titel.pdf msg4.asc
edouard@1934
    67
	rm -Rf *.dSYM $(TEST_HOME) pubring.gpg secring.gpg random_seed *.conf trustdb.gpg
vb@2
    68
edouard@1844
    69
test: pEpEngineTest test_home_
edouard@1844
    70
	$(TEST_CMD_PFX) ./pEpEngineTest
vb@2
    71
roker@1656
    72
%_test : %_test.o test_util.o
roker@1656
    73
	 $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
roker@1656
    74
edouard@1844
    75
%_run : % test_home_
edouard@1844
    76
	$(TEST_CMD_PFX) ./$<
Edouard@699
    77
edouard@1844
    78
%_lldb : % test_home_
edouard@1851
    79
	$(TEST_CMD_PFX) $(LLDB_BIN) ./$<
roker@1656
    80
edouard@1844
    81
%_valgrind : % test_home_
edouard@1844
    82
	$(TEST_CMD_PFX) valgrind --leak-check=yes ./$<
Edouard@745
    83
edouard@1844
    84
%_gdb : % test_home_
edouard@1844
    85
	$(TEST_CMD_PFX) gdb ./$<
Edouard@770
    86
Edouard@699
    87
unit_tests: $(UNIT_TESTS) $(UNIT_TESTS_RUN)
vb@142
    88
vb@142
    89
install:
vb@142
    90
	make -C .. install