src/Makefile
author Krista Bennett <krista@pep-project.org>
Tue, 01 Aug 2017 16:40:24 +0200
branchmessage-2.0
changeset 1979 3d0a778d035a
parent 1789 c4d32b6525c7
child 1942 f734d5bd851a
permissions -rw-r--r--
Changed name to ENGINE-214 for JIRA tracking - please use that branch instead.
     1 include ../Makefile.conf
     2 
     3 ETPAN_IN?=$(HOME)
     4 
     5 ifeq ($(BUILD_ON),Darwin)
     6 ifeq ($(BUILD_FOR),Darwin)
     7 
     8 TARGET?=libpEpEngine.dylib
     9 MACOSX_VERSION_MIN=10.6
    10 LIBGPGME?=libgpgme.dylib
    11 CC?=clang -std=c99 -pthread
    12 LD?=clang
    13 CFLAGS?= -I$(ETPAN_IN)/include -I/opt/local/include $(OPTIMIZE) -pedantic \
    14 	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -I../asn.1 $(EXTRAMACROS)
    15 LDFLAGS?= -lc -shared -arch x86_64 \
    16 	-L$(ETPAN_IN)/lib -L/usr/lib -L/opt/local/lib -letpan -lsqlite3 -L../asn.1 -lasn1 -lz -liconv
    17 
    18 else
    19 $(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    20 endif
    21 
    22 else ifeq ($(BUILD_ON),Linux)
    23 ifeq ($(BUILD_FOR),Linux)
    24 
    25 TARGET=libpEpEngine.so
    26 LIBGPGME?=libgpgme.so.11
    27 CC=gcc -std=c99
    28 CFLAGS?= $(OPTIMIZE) -fPIC -pedantic -DSYSTEM_DB=\"$(SYSTEM_DB)\" \
    29 	-DSQLITE_THREADSAFE=1 -D_GNU_SOURCE -I../asn.1 $(EXTRAMACROS)
    30 LDFLAGS?= -L$(ETPAN_IN)/lib -shared -lc -ldl -letpan -lpthread -L../asn.1 -lasn1 -luuid
    31 
    32 else
    33 $(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    34 endif
    35 
    36 else
    37 $(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    38 endif
    39 
    40 DEBUG?=NO
    41 ifeq ("$(DEBUG)","NO")
    42     CFLAGS+= -DNDEBUG
    43 endif
    44 
    45 OPENPGP?=GPG
    46 ifeq ("$(OPENPGP)","GPG")
    47     NO_SOURCE=pgp_netpgp.c
    48     GPGME_IN?=$(HOME)
    49     CFLAGS+= -DUSE_GPG -I$(GPGME_IN)/include -DLIBGPGME=\"$(LIBGPGME)\"
    50     #LDFLAGS+= -L$(GPGME_IN)/lib -lgpgme
    51 else ifeq ("$(OPENPGP)","NETPGP")
    52     NO_SOURCE=pgp_gpg.c
    53     NETPGP_IN?=$(HOME)
    54     CFLAGS+= -DUSE_NETPGP -I$(NETPGP_IN)/include
    55     LDFLAGS+= -L$(NETPGP_IN)/lib -lnetpgp -lcurl
    56 else
    57 	$(error Unknown OpenPGP library : $(OPENPGP))
    58 endif
    59 
    60 ALL_SOURCE=$(subst $(NO_SOURCE),,$(wildcard *.c))
    61 
    62 DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
    63 ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
    64 
    65 all: $(TARGET)
    66 
    67 include Makefile.protocols
    68 
    69 %.d: %.c
    70 	@set -e; rm -f $@; \
    71 	$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
    72 	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
    73 	rm -f $@.$$$$
    74 
    75 -include $(DEPENDS)
    76 
    77 #platform_windows.o: platform_windows.cpp
    78 #	$(CXX) $(CXX_FLAGS) -o $@ -c $<
    79 
    80 $(TARGET): libpEpEngine.a
    81 	$(LD) $(ALL_OBJECTS) $(LDFLAGS) -o $@
    82 
    83 objects: $(ALL_OBJECTS)
    84 
    85 libpEpEngine.a: $(ALL_OBJECTS)
    86 	ar -r $@ $(ALL_OBJECTS)
    87 
    88 .PHONY: clean
    89 
    90 clean:
    91 	rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
    92 
    93 install: $(TARGET)
    94 	cp $< $(PREFIX)/lib/
    95 	mkdir -p $(PREFIX)/include/pEp
    96 	cp pEpEngine.h keymanagement.h message_api.h dynamic_api.h stringlist.h timestamp.h identity_list.h bloblist.h stringpair.h message.h mime.h cryptotech.h sync.h sync_fsm.h sync_app.h blacklist.h openpgp_compat.h $(PREFIX)/include/pEp/
    97 
    98 uninstall:
    99 	rm -f $(PREFIX)/lib/$(TARGET)
   100