src/Makefile
author Krista Bennett <krista@pep-project.org>
Wed, 15 Mar 2017 18:02:46 +0100
changeset 1674 5639f969866a
parent 1664 9263048febb8
child 1676 4184ee019f65
permissions -rw-r--r--
Added pgp_encrypt_only stubs for NetPGP
vb@1
     1
include ../Makefile.conf
vb@1
     2
krista@1050
     3
OPENPGP?=GPG
Edouard@168
     4
vb@1
     5
ifeq ($(BUILD_ON),Darwin)
vb@1
     6
ifeq ($(BUILD_FOR),Darwin)
vb@1
     7
vb@1089
     8
TARGET?=libpEpEngine.dylib
vb@1
     9
MACOSX_VERSION_MIN=10.6
vb@1
    10
GPGME_IN=$(HOME)
vb@1425
    11
LIBGPGME?=libgpgme.dylib
vb@66
    12
CC?=clang -std=c99 -pthread
vb@66
    13
LD?=clang
vb@76
    14
CFLAGS?=-I$(GPGME_IN)/include -I$(HOME)/include -I/opt/local/include $(OPTIMIZE) -pedantic \
krista@1664
    15
	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\" -DNDEBUG -I../asn.1 $(EXTRAMACROS)
vb@66
    16
LDFLAGS?=-lc -shared -arch x86_64 \
dirk@821
    17
	-L$(HOME)/lib -L/usr/lib -L/opt/local/lib -letpan -lsqlite3 -L../asn.1 -lasn1 -lz -liconv
vb@1
    18
vb@1
    19
else
vb@1
    20
$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
vb@1
    21
endif
vb@1
    22
vb@1
    23
else ifeq ($(BUILD_ON),Linux)
vb@1
    24
ifeq ($(BUILD_FOR),Linux)
vb@1
    25
vb@1
    26
TARGET=libpEpEngine.so
vb@1
    27
GPGME_IN=$(HOME)
vb@1
    28
LIBGPGME=libgpgme.so.11
Edouard@188
    29
CC=gcc -std=c99
vb@66
    30
CFLAGS?=-I$(GPGME_IN)/include $(OPTIMIZE) -fPIC -pedantic \
Edouard@70
    31
	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\" \
krista@1664
    32
	-DSQLITE_THREADSAFE=1 -D_GNU_SOURCE -DNDEBUG -I../asn.1 $(EXTRAMACROS)
edouard@1620
    33
LDFLAGS?=-L$(GPGME_IN)/lib -shared -lc -ldl -letpan -lpthread -L../asn.1 -lasn1 -luuid
vb@1
    34
vb@1
    35
else
vb@1
    36
$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
vb@1
    37
endif
vb@1
    38
vb@1
    39
else
vb@1
    40
$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
vb@1
    41
endif
vb@1
    42
Edouard@168
    43
ifeq ("$(OPENPGP)","GPG")
Edouard@168
    44
	NO_SOURCE=pgp_netpgp.c
Edouard@168
    45
	CFLAGS+= -DUSE_GPG
vb@1422
    46
	LDFLAGS+= -lgpgme
Edouard@168
    47
else ifeq ("$(OPENPGP)","NETPGP")
Edouard@168
    48
	NO_SOURCE=pgp_gpg.c
Edouard@168
    49
	CFLAGS+= -DUSE_NETPGP
Edouard@263
    50
	LDFLAGS+= -lnetpgp -lcurl
Edouard@168
    51
else
Edouard@168
    52
	$(error Unknown OpenPGP library : $(OPENPGP))
Edouard@168
    53
endif
Edouard@168
    54
vb@609
    55
ALL_SOURCE=$(subst $(NO_SOURCE),,$(wildcard *.c))
vb@609
    56
vb@1
    57
DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
vb@1
    58
ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
vb@1
    59
vb@1
    60
all: $(TARGET)
vb@1
    61
vb@811
    62
include Makefile.protocols
vb@606
    63
vb@1
    64
%.d: %.c
vb@1
    65
	@set -e; rm -f $@; \
vb@3
    66
	$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
vb@1
    67
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
vb@1
    68
	rm -f $@.$$$$
vb@1
    69
vb@1
    70
-include $(DEPENDS)
vb@1
    71
vb@46
    72
#platform_windows.o: platform_windows.cpp
vb@46
    73
#	$(CXX) $(CXX_FLAGS) -o $@ -c $<
vb@1
    74
vb@1
    75
$(TARGET): libpEpEngine.a
vb@1
    76
	$(LD) $(ALL_OBJECTS) $(LDFLAGS) -o $@
vb@1
    77
vb@1
    78
objects: $(ALL_OBJECTS)
vb@1
    79
vb@1
    80
libpEpEngine.a: $(ALL_OBJECTS)
vb@1
    81
	ar -r $@ $(ALL_OBJECTS)
vb@1
    82
vb@1
    83
.PHONY: clean
vb@1
    84
vb@1
    85
clean:
vb@1
    86
	rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
vb@1
    87
vb@1
    88
install: $(TARGET)
vb@1
    89
	cp $< $(PREFIX)/lib/
vb@171
    90
	mkdir -p $(PREFIX)/include/pEp
vb@1360
    91
	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 blacklist.h openpgp_compat.h $(PREFIX)/include/pEp/
vb@1
    92
vb@1
    93
uninstall:
vb@1
    94
	rm -f $(PREFIX)/lib/$(TARGET)
vb@1
    95