Browse Source

Cleanup test/Makefile, fix src install target

doc_update_sequoia
Damiano Boppart 5 years ago
parent
commit
84acc76032
3 changed files with 47 additions and 30 deletions
  1. +1
    -0
      .hgignore
  2. +1
    -0
      src/Makefile
  3. +45
    -30
      test/Makefile

+ 1
- 0
.hgignore View File

@ -3,6 +3,7 @@ syntax: regexp
^asn\.1/Makefile\.am\.sample$
^asn\.1/libasn1\.a$
.*xcuserdata/
^build/
syntax: glob
*.orig


+ 1
- 0
src/Makefile View File

@ -78,6 +78,7 @@ clean:
.PHONY: install
install: $(TARGET)
mkdir -p "$(PREFIX)/lib/"
cp $< $(PREFIX)/lib/
mkdir -p $(PREFIX)/include/pEp
cp pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h cryptotech.h sync.h sync_fsm.h sync_app.h blacklist.h openpgp_compat.h $(PREFIX)/include/pEp/


+ 45
- 30
test/Makefile View File

@ -7,49 +7,59 @@ HERE:=$(CURDIR)
include ../Makefile.conf
LDFLAGS+= $(ETPAN_LIB) -L../asn.1
LDLIBS?=-letpan -lpEpEngine -lstdc++ -lasn1
TARGET=pEpEngineTest
unexport GNUPGHOME
TEST_HOME=$(HERE)/test_home
TEST_GNUPGHOME=$(TEST_HOME)/.gnupg
LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -L../src
LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
ifeq ($(BUILD_FOR),Linux)
LDLIBS+= -luuid
LDLIBS+= -luuid
endif
ifeq ("$(OPENPGP)","NETPGP")
LDLIBS+= -lnetpgp
LDLIBS+= -lnetpgp
endif
TARGET=pEpEngineTest
ifeq ($(shell uname),Darwin)
LIBPATH=DYLD_LIBRARY_PATH
LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
else
LIBPATH=LD_LIBRARY_PATH
LLDB_BIN=lldb
endif
# Create a list of the extra library paths for the loader. We do not assume that the engine and its dependencies are not installed for testing.
# Note that += can not be used here, as it changes the amount of whitespace
EXTRA_LIB_PATHS=../src:
ifdef ETPAN_LIB
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
endif
ifdef GPGME_LIB
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
endif
ifdef NETPGP_LIB
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
endif
# Remove trailing ':'
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
TEST_CMD_PFX=$(LIBPATH)=$(EXTRA_LIB_PATHS) HOME=$(TEST_HOME)
UNIT_TESTS_SOURCE=$(wildcard *_test.cc)
UNIT_TESTS=$(subst .cc,,$(UNIT_TESTS_SOURCE))
UNIT_TESTS_RUN=$(subst .cc,_run,$(UNIT_TESTS_SOURCE))
.PHONY: all
all: $(TARGET) $(UNIT_TESTS)
.PHONY: clean
# don't delete .o files!
.PRECIOUS: %.o
unexport GNUPGHOME;
TEST_HOME=$(HERE)/test_home
TEST_GNUPGHOME=$(TEST_HOME)/.gnupg
ifeq ($(shell which gpg2), )
GPG_CMD = gpg
else
GPG_CMD = gpg2
endif
ifeq ($(shell uname), Darwin)
LIBPATH = DYLD_LIBRARY_PATH
LLDB_BIN = /Applications/Xcode.app/Contents/Developer/usr/bin/lldb
else
LIBPATH = LD_LIBRARY_PATH
LLDB_BIN = lldb
endif
TEST_CMD_PFX = $(LIBPATH)=$(HOME)/lib:../src HOME=$(TEST_HOME)
.PHONY: test_home_
test_home_:
-gpgconf --kill gpg-agent
-HOME=$(TEST_HOME) gpgconf --kill gpg-agent
@ -58,12 +68,14 @@ test_home_:
mkdir -p $(TEST_GNUPGHOME)/private-keys-v1.d
$(GPG_CMD) --import --batch --homedir $(TEST_GNUPGHOME) 0x*.asc *_sec.asc
.PHONY: clean
clean:
rm -f *.o $(TARGET) *.a *~ $(UNIT_TESTS) pep_Dokument_Titel.pdf msg4.asc
rm -Rf *.dSYM $(TEST_HOME) pubring.gpg secring.gpg random_seed *.conf trustdb.gpg
test: pEpEngineTest test_home_
$(TEST_CMD_PFX) ./pEpEngineTest
.PHONY: test
test: $(TARGET) test_home_
$(TEST_CMD_PFX) ./$<
%_test : %_test.o test_util.o
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
@ -80,7 +92,10 @@ test: pEpEngineTest test_home_
%_gdb : % test_home_
$(TEST_CMD_PFX) gdb ./$<
.PHONY: unit_tests
unit_tests: $(UNIT_TESTS) $(UNIT_TESTS_RUN)
# Installs the engine, not the test binaries
.PHONY: install
install:
make -C .. install
$(MAKE) -C .. install

Loading…
Cancel
Save