2019-08-26 13:38:21 +02:00
|
|
|
# Copyright 2019, pEp Foundation
|
2017-08-14 02:26:09 +02:00
|
|
|
# This file is part of pEpEngine
|
|
|
|
# This file may be used under the terms of the GNU General Public License version 3
|
2016-12-27 21:13:41 +01:00
|
|
|
# see LICENSE.txt
|
|
|
|
|
2018-12-22 00:32:04 +01:00
|
|
|
HERE:=$(CURDIR)
|
|
|
|
|
2019-11-14 16:47:46 +01:00
|
|
|
GTEST_SRC_DIR:=/usr/src/gtest
|
|
|
|
GTEST_INC_DIR:=$(GTEST_SRC_DIR)/include
|
2021-05-11 08:33:31 +02:00
|
|
|
GTEST_PL:=$(HOME)/src/gtest-parallel/gtest_parallel.py
|
2019-08-28 23:32:04 +02:00
|
|
|
|
2019-11-14 16:47:46 +01:00
|
|
|
include ../Makefile.conf # This should import changed values for the above from
|
|
|
|
# local.conf
|
2018-04-30 15:22:22 +02:00
|
|
|
|
2018-12-22 00:32:04 +01:00
|
|
|
SRCS:=$(wildcard src/*.cc) $(wildcard src/*/*.cc)
|
|
|
|
OBJS:=$(addsuffix .o,$(basename $(SRCS)))
|
|
|
|
DEPS:=$(OBJS:.o=.d)
|
2018-04-30 15:22:22 +02:00
|
|
|
|
2020-07-31 15:11:36 +02:00
|
|
|
LDFLAGS+= -L../asn.1 -L../src $(ETPAN_LIB) $(GTEST_LDFLAGS)
|
2017-08-17 18:01:20 +02:00
|
|
|
|
2019-11-14 16:47:46 +01:00
|
|
|
TARGET:=EngineTests
|
|
|
|
|
|
|
|
GTEST_SUITE_SYM:=test_suite_name
|
|
|
|
|
|
|
|
ifeq ($(shell grep -c $(GTEST_SUITE_SYM) $(GTEST_SRC_DIR)/src/gtest.cc),0)
|
|
|
|
GTEST_SUITE_SYM=test_case_name
|
|
|
|
endif
|
|
|
|
|
2021-02-03 10:18:19 +01:00
|
|
|
CPPFLAGS+= -DGTEST_SUITE_SYM=$(GTEST_SUITE_SYM)
|
2019-08-26 13:38:21 +02:00
|
|
|
|
2021-01-28 19:25:08 +01:00
|
|
|
ifdef PEP_MIME
|
2021-02-03 11:40:10 +01:00
|
|
|
LDLIBS+= -lpEpMIME
|
2021-01-28 19:25:08 +01:00
|
|
|
else
|
2021-02-03 11:40:10 +01:00
|
|
|
LDLIBS+= -letpan
|
2021-01-28 19:25:08 +01:00
|
|
|
endif
|
|
|
|
|
|
|
|
LDLIBS+= -lpEpEngine -lstdc++ -lasn1
|
2014-06-25 18:48:18 +02:00
|
|
|
|
2018-11-29 09:01:36 +01:00
|
|
|
ifeq ($(BUILD_FOR),Linux)
|
2018-12-22 00:32:04 +01:00
|
|
|
LDLIBS+= -luuid
|
2015-04-02 16:19:23 +02:00
|
|
|
endif
|
|
|
|
|
2018-12-15 17:03:46 +01:00
|
|
|
ifeq ($(OPENPGP),SEQUOIA)
|
2019-01-23 15:29:54 +01:00
|
|
|
LDFLAGS+= $(SEQUOIA_LDFLAGS)
|
|
|
|
LDLIBS+= $(SEQUOIA_LIB)
|
2021-02-03 10:18:19 +01:00
|
|
|
CXXFLAGS+= $(SEQUOIA_CFLAGS)
|
|
|
|
CPPFLAGS+= -DUSE_SEQUOIA
|
2019-01-23 15:29:54 +01:00
|
|
|
INC_FLAGS+= $(SEQUOIA_INC)
|
2018-12-15 17:03:46 +01:00
|
|
|
endif
|
|
|
|
|
2017-08-27 16:33:36 +02:00
|
|
|
ifdef SQLITE3_FROM_OS
|
2018-12-22 00:32:04 +01:00
|
|
|
LDLIBS+= -lsqlite3
|
2017-08-27 16:33:36 +02:00
|
|
|
endif
|
|
|
|
|
2021-02-03 11:40:10 +01:00
|
|
|
CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS)) -I$(GTEST_INC_DIR)
|
2021-02-03 10:18:19 +01:00
|
|
|
CPPFLAGS:=$(filter-out -DNDEBUG,$(CPPFLAGS))
|
2018-04-30 15:22:22 +02:00
|
|
|
|
2021-05-03 11:36:52 +02:00
|
|
|
CXXFLAGS+= -I./src -I../src -I ../asn.1 -I../sync $(INC_FLAGS)
|
|
|
|
CXXFLAGS+= -Wno-deprecated -Wno-unused-variable
|
2017-08-17 18:01:20 +02:00
|
|
|
|
2018-12-24 15:32:27 +01:00
|
|
|
EXTRA_LIB_PATHS=.:../src:
|
2021-01-28 19:25:08 +01:00
|
|
|
ifndef PEP_MIME
|
2018-12-24 15:22:55 +01:00
|
|
|
ifdef ETPAN_LIB
|
|
|
|
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
|
|
|
|
endif
|
2021-01-28 19:25:08 +01:00
|
|
|
endif
|
|
|
|
|
2018-12-24 15:22:55 +01:00
|
|
|
# Remove trailing ':'
|
|
|
|
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
|
|
|
|
|
|
|
|
ifeq ($(BUILD_FOR),Darwin)
|
|
|
|
LIBPATH=DYLD_LIBRARY_PATH
|
|
|
|
else
|
|
|
|
LIBPATH=LD_LIBRARY_PATH
|
|
|
|
endif
|
|
|
|
|
2019-04-01 21:16:34 +02:00
|
|
|
# FIXME: this forces a path on execution which overrides system paths for
|
|
|
|
# libraries like iconv and causes runtime errors.
|
|
|
|
#TEST_CMD_PFX=$(LIBPATH)=$(EXTRA_LIB_PATHS)
|
2021-04-19 19:02:40 +02:00
|
|
|
ifeq ($(TEST_CMD_PFX),)
|
|
|
|
TEST_CMD_PFX=
|
|
|
|
endif
|
2018-12-24 15:22:55 +01:00
|
|
|
|
2019-04-07 22:37:02 +02:00
|
|
|
.PHONY: all clean test
|
2018-12-24 15:22:55 +01:00
|
|
|
|
2021-05-11 08:33:31 +02:00
|
|
|
all:
|
2019-08-26 13:38:21 +02:00
|
|
|
make $(TARGET)
|
2017-03-13 20:47:49 +01:00
|
|
|
|
2018-12-22 00:32:04 +01:00
|
|
|
%.d: %.cc
|
2021-05-03 11:36:52 +02:00
|
|
|
$(CXX) -MM $(CXXFLAGS) $(CPPFLAGS) $< \
|
|
|
|
| sed -e 's,\($*\)\.o[ :]*,\1.o $@: ,g' > $@
|
2018-12-03 12:26:02 +01:00
|
|
|
|
2019-11-14 16:47:46 +01:00
|
|
|
$(TARGET): $(OBJS)
|
2021-05-03 11:36:52 +02:00
|
|
|
${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS} -L${PREFIX}/lib -o $@ $^ \
|
|
|
|
-lpEpEngine -lgtest -lgtest_main -lsequoia_openpgp_ffi $(LDLIBS)
|
2018-12-22 00:32:04 +01:00
|
|
|
|
2018-05-01 14:40:18 +02:00
|
|
|
|
|
|
|
test: all
|
2019-11-14 16:47:46 +01:00
|
|
|
$(RM) -rf ./pEp_test_home/*
|
2021-05-03 11:36:52 +02:00
|
|
|
$(TEST_CMD_PFX) $(TEST_DEBUGGER) GTEST_COLOR=no python3 $(GTEST_PL) \
|
|
|
|
--gtest_color=no ./$(TARGET)
|
|
|
|
|
2014-06-25 18:48:18 +02:00
|
|
|
clean:
|
2021-05-03 11:36:52 +02:00
|
|
|
$(RM) $(TARGET) $(TARGET).o $(TARGET).d $(OBJS) \
|
2021-05-11 08:33:31 +02:00
|
|
|
$(notdir $(basename $(OBJS))) $(DEPS)
|
2019-09-17 16:21:57 +02:00
|
|
|
$(RM) -rf ./pEp_test_home/*
|
2021-05-03 11:36:52 +02:00
|
|
|
|
|
|
|
# If only the target 'clean' is given, do not generate and include the
|
|
|
|
# '%.d' files.¬
|
2018-12-22 00:32:04 +01:00
|
|
|
ifneq ($(MAKECMDGOALS),clean)
|
|
|
|
-include $(DEPS)
|
|
|
|
endif
|