p≡p engine
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.

127 lines
3.5 KiB

2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  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
  4. # see LICENSE.txt
  5. include ../Makefile.conf
  6. ifdef PER_USER_DIRECTORY
  7. EXTRA_MACROS+= -DPER_USER_DIRECTORY=$(PER_USER_DIRECTORY)
  8. endif
  9. ifdef PER_MACHINE_DIRECTORY
  10. EXTRA_MACROS+= -DPER_MACHINE_DIRECTORY=\"$(PER_MACHINE_DIRECTORY)\"
  11. endif
  12. NO_SOURCE=
  13. ifndef PEP_MIME
  14. CFLAGS+= $(ETPAN_INC)
  15. LDFLAGS+= $(ETPAN_LIB)
  16. LDLIBS+= -letpan
  17. else
  18. LDFLAGS+= -L../pEpMIME -shared
  19. LDLIBS+= -lpEpMIME
  20. NO_SOURCE+= etpan_mime.c
  21. endif
  22. CFLAGS+= -I../asn.1 $(EXTRA_MACROS)
  23. CPPFLAGS+= -DSQLITE_THREADSAFE=1
  24. LDFLAGS+= -L../asn.1 -shared
  25. LDLIBS+= -lc -lasn1
  26. ifeq ($(BUILD_ON),Darwin)
  27. ifeq ($(BUILD_FOR),Darwin)
  28. LDLIBS+= -lz -liconv -mmacosx-version-min=10.10
  29. else
  30. $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
  31. endif
  32. else ifeq ($(BUILD_ON),Linux)
  33. ifeq ($(BUILD_FOR),Linux)
  34. CPPFLAGS+= -D_GNU_SOURCE
  35. LDLIBS+= -ldl -luuid
  36. else
  37. $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
  38. endif
  39. else
  40. $(error I do not know how to make for $(BUILD_FOR) on $(BUILD_ON))
  41. endif
  42. ifdef SQLITE3_FROM_OS
  43. NO_SOURCE+= sqlite3.c
  44. CPPFLAGS+= -DSQLITE3_FROM_OS
  45. LDLIBS+= -lsqlite3
  46. endif
  47. ifeq ($(OPENPGP),SEQUOIA)
  48. CPPFLAGS+= -DUSE_SEQUOIA
  49. CFLAGS+= $(SEQUOIA_CFLAGS) $(SEQUOIA_INC)
  50. LDFLAGS+= $(SEQUOIA_LDFLAGS)
  51. LDLIBS+= $(SEQUOIA_LIB)
  52. else
  53. $(error Unknown OpenPGP library: $(OPENPGP))
  54. endif
  55. ALL_SOURCE=$(filter-out $(NO_SOURCE),$(wildcard *.c))
  56. DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
  57. ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
  58. all: $(TARGET)
  59. -include Makefile.protocols
  60. %.d: %.c
  61. @set -e; rm -f $@; \
  62. $(CC) -MM $(CFLAGS) $(CPPFLAGS) $< > $@.$$$$; \
  63. sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
  64. rm -f $@.$$$$
  65. # If only the goal 'clean' is given, do not generate and include the '%.d' files.
  66. ifneq ($(MAKECMDGOALS),clean)
  67. -include $(DEPENDS)
  68. endif
  69. $(TARGET): libpEpEngine.a
  70. $(CC) $(CFLAGS) $(CPPFLAGS) $(ALL_OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@
  71. .PHONY: objects clean install_headers install uninstall beinstall
  72. objects: $(ALL_OBJECTS)
  73. libpEpEngine.a: $(ALL_OBJECTS)
  74. $(AR) -rc $@ $^
  75. clean:
  76. rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
  77. rm -Rf $(TARGET).dSYM
  78. rm -f KeySync_fsm.* Sync_actions.c Sync_event.* Sync_func.* Sync_impl.* sync_codec.* distribution_codec.* storage_codec.*
  79. # CAVEAT:
  80. # install_headers is needed for building *STANDALONE* pEp MIME - it is NOT used for built-in functionality!!!
  81. install_headers: $(TARGET)
  82. mkdir -p $(DESTDIR)$(PREFIX)/include/pEp
  83. cp pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h \
  84. timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h group.h \
  85. cryptotech.h sync_api.h blacklist.h pEp_string.h openpgp_compat.h engine_sql.h \
  86. labeled_int_list.h key_reset.h base64.h sync_codec.h distribution_codec.h storage_codec.h \
  87. status_to_string.h aux_mime_msg.h keyreset_command.h platform.h platform_unix.h ../asn.1/*.h \
  88. $(DESTDIR)$(PREFIX)/include/pEp/
  89. # FIXME: Does anyone but Roker use install_headers? Otherwise, remove the dependency.
  90. install: $(TARGET) install_headers
  91. mkdir -p "$(DESTDIR)$(PREFIX)/lib/"
  92. cp -v $< $(DESTDIR)$(PREFIX)/lib/
  93. cp -v libpEpEngine.a $(DESTDIR)$(PREFIX)/lib/
  94. beinstall: install
  95. cp platform*.h $(DESTDIR)$(PREFIX)/include/pEp/
  96. uninstall:
  97. rm -f $(DESTDIR)$(PREFIX)/lib/$(TARGET)
  98. rm -rf $(DESTDIR)$(PREFIX)/include/pEp
  99. tags: $(wildcard *.c) $(wildcard *.h)
  100. ctags --sort=yes *.c *.h