...
1 # Copyright 2017, pEp Foundation
2 # This file is part of pEpEngine
3 # This file may be used under the terms of the GNU General Public License version 3
6 include ../Makefile.conf
8 CFLAGS+= $(ETPAN_INC) $(PEP_MIME_INC) -I../asn.1 -DSYSTEM_DB=\"$(SYSTEM_DB)\" $(EXTRA_MACROS)
9 LDFLAGS+= $(ETPAN_LIB) $(PEP_MIME_LIB) -L../asn.1 -shared
17 NO_SOURCE+= etpan_mime.c
20 ifeq ($(BUILD_ON),Darwin)
21 ifeq ($(BUILD_FOR),Darwin)
22 CFLAGS+= -DSQLITE_THREADSAFE=1
25 $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
27 else ifeq ($(BUILD_ON),Linux)
28 ifeq ($(BUILD_FOR),Linux)
29 CFLAGS+= -DSQLITE_THREADSAFE=1 -D_GNU_SOURCE
32 $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
35 $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
40 CFLAGS+= -DSQLITE3_FROM_OS
45 NO_SOURCE+= pgp_netpgp.c pgp_sequoia.c
46 CFLAGS+= -DUSE_GPG $(GPGME_INC) -DLIBGPGME=\"$(LIBGPGME)\"
47 LDFLAGS+= $(GPGME_LIB)
48 # No extra LDLIBS are needed here, because GPGME is dynamically loaded
49 else ifeq ($(OPENPGP),NETPGP)
50 NO_SOURCE+= pgp_gpg.c pgp_sequoia.c
51 CFLAGS+= -DUSE_NETPGP $(NETGPG_INC)
52 LDFLAGS+= $(NETGPG_LIB)
53 LDLIBS+= -lnetpgp -lcurl
54 else ifeq ($(OPENPGP),SEQUOIA)
55 NO_SOURCE+= pgp_gpg.c pgp_netpgp.c
56 CFLAGS+= -DUSE_SEQUOIA $(SEQUOIA_CFLAGS) $(SEQUOIA_INC)
57 LDFLAGS+= $(SEQUOIA_LDFLAGS)
58 LDLIBS+= $(SEQUOIA_LIB)
60 $(error Unknown OpenPGP library: $(OPENPGP))
63 ALL_SOURCE=$(filter-out $(NO_SOURCE),$(wildcard *.c))
64 DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
65 ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
69 -include Makefile.protocols
73 $(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
74 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
77 # If only the goal 'clean' is given, do not generate and include the '%.d' files.
78 ifneq ($(MAKECMDGOALS),clean)
82 $(TARGET): libpEpEngine.a
83 $(CC) $(CFLAGS) $(ALL_OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@
85 .PHONY: objects clean install_headers install uninstall
87 objects: $(ALL_OBJECTS)
89 libpEpEngine.a: $(ALL_OBJECTS)
93 rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
95 rm -f KeySync_fsm.* Sync_actions.c Sync_event.* Sync_func.* Sync_impl.* sync_codec.*
98 # install_headers is needed for building pEp MIME
101 mkdir -p $(PREFIX)/include/pEp
102 cp pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h \
103 timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h \
104 cryptotech.h sync_api.h blacklist.h pEp_string.h openpgp_compat.h \
105 labeled_int_list.h key_reset.h base64.h sync_codec.h status_to_string.h\
106 aux_mime_msg.h ../asn.1/*.h $(PREFIX)/include/pEp/
108 install: $(TARGET) install_headers
109 mkdir -p "$(PREFIX)/lib/"
113 rm -f $(PREFIX)/lib/$(TARGET)
114 rm -rf $(PREFIX)/include/pEp
116 tags: $(wildcard *.c) $(wildcard *.h)