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.

149 lines
4.1 KiB

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