p≡p MIME library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

98 lines
2.7 KiB

# This file is under GNU General Public License 3.0
# see LICENSE.txt
.PHONY: lib all clean install test
#CXX=c++
#CXXFLAGS+=-Wall -O0 -std=c++14 -g -fPIC -fstack-protector-all -DLOG_TO_STDERR -fsanitize=address
#LDFLAGS+=-fsanitize=address
PREFIX=/usr/local
# !FIXME!
GTEST_DIR=/opt/local/src/googletest
######### General #########
BUILD_ON:=$(shell uname)
# This variable specifies the platform that the engine should be cross-compiled for.
BUILD_FOR=$(BUILD_ON)
# Cross-compiling is currently not supported.
# Maybe you can hack something with `local.conf`.
ifneq ($(BUILD_ON),$(BUILD_FOR))
$(error I don't know how to build for $(BUILD_FOR) on $(BUILD_ON).)
endif
# MacOS needs -liconv, Linix don't.
ifeq ($(BUILD_FOR),Darwin)
LDLIBS+= -liconv
endif
# Filename of the shared library
ifeq ($(BUILD_FOR),Linux)
TARGET=libpEpMIME.so
else ifeq ($(BUILD_FOR),Darwin)
TARGET=libpEpMIME.dylib
endif
all: libpEpMIME.a unittests fuzz $(TARGET)
lib: libpEpMIME.a
-include local.conf
LIB_OBJ=pEpMIME.o pEpMIME_internal.o rules.o bodyparser.o \
attachment.o bodygenerator.o \
headerparser.o parse_timestamp.o parse_address.o nulllogger.o \
base64.o nfc.o mime_headers.o nfc_sets.o to_utf8.o quoted_printable.o \
header_generator.o message.o pEpEngine_mime.o
libpEpMIME.a: $(LIB_OBJ)
${AR} rcs $@ $^
$(TARGET): ${LIB_OBJ}
${CXX} ${LDFLAGS} ${LDLIBS} -shared $^ -o $@
unittests: unittest_mime.o unittest_nfc.o unittest_timestamp.o \
unittest_stringcase.o unittest_toutf8.o unittest_address.o \
unittest_rule.o unittest_subject.o unittest_base64.o \
unittest_qp.o print_message.o unittest_mime-12.o \
gtest-all.o gtest_main.o libpEpMIME.a
${CXX} ${LDFLAGS} -L${PREFIX}/lib -o $@ $^ -lpEpAdapter -lpEpEngine -lpthread $(LDLIBS)
gtest-all.o: $(GTEST_DIR)/src/gtest-all.cc
${CXX} ${CXXFLAGS} $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -isystem $(GTEST_DIR)/include -o $@ -c $<
gtest_main.o: $(GTEST_DIR)/src/gtest_main.cc
${CXX} ${CXXFLAGS} $(CPPFLAGS) -I$(GTEST_DIR) $(CXXFLAGS) -isystem $(GTEST_DIR)/include -o $@ -c $<
unittest_%.o : unittest_%.cc
${CXX} ${CXXFLAGS} -I${PREFIX}/include -isystem $(GTEST_DIR)/include -o $@ -c $<
fuzz: fuzz.o libpEpMIME.a
${CXX} ${LDFLAGS} -L${PREFIX}/lib -o $@ $^ -lpEpAdapter -lpEpEngine -lpthread $(LDLIBS)
fuzz.o: fuzz.cc
${CXX} ${CXXFLAGS} -I${PREFIX}/include -o $@ -c $^
%.o : %.cc %.hh
${CXX} ${CXXFLAGS} -I${PREFIX}/include -o $@ -c $<
%.o : %.cc
${CXX} ${CXXFLAGS} -I${PREFIX}/include -o $@ -c $<
test: unittests
./unittests
clean:
rm -vf *.o \
*.a \
unittests fuzz $(TARGET)
install: lib $(TARGET)
mkdir -p $(PREFIX)/include/pEp
cp -v pEpMIME.hh $(PREFIX)/include/pEp
mkdir -p $(PREFIX)/lib
cp -v $(TARGET) libpEpMIME.a $(PREFIX)/lib