@ -1,70 +1,57 @@
i n c l u d e . . / M a k e f i l e . c o n f
# Copyright 2017, pEp Security SA
# This file is part of pEpEngine
# This file may be used under the terms of the GNU General Public License version 3
# see LICENSE.txt
LD ?= $( CC)
i n c l u d e . . / M a k e f i l e . c o n f
ETPAN_IN ?= $( HOME)
CFLAGS += $( ETPAN_INC) -I../asn.1 -DSYSTEM_DB= \" $( SYSTEM_DB) \" $( EXTRA_MACROS)
LDFLAGS += $( ETPAN_LIB) -L../asn.1 -shared
LDLIBS += -lc -lasn1 -letpan
i f e q ( $( BUILD_ON ) , D a r w i n )
i f e q ( $( BUILD_FOR ) , D a r w i n )
TARGET ?= libpEpEngine.dylib
MACOSX_VERSION_MIN = 10.6
LIBGPGME ?= libgpgme.dylib
CC ?= clang -std= c99 -pthread
CFLAGS ?= -I$( ETPAN_IN) /include -I/opt/local/include -pedantic \
-DSYSTEM_DB= \" $( SYSTEM_DB) \" -I../asn.1 $( EXTRAMACROS)
LDFLAGS ?= -lc -shared -arch x86_64 \
-L$( ETPAN_IN) /lib -L/usr/lib -L/opt/local/lib -letpan -lsqlite3 -L../asn.1 -lasn1 -lz -liconv
e l s e
$( error don 't know how to make for $ ( BUILD_FOR ) on $ ( BUILD_ON ) )
e n d i f
ifeq ( $( BUILD_FOR) ,Darwin)
#CFLAGS+= -I/opt/local/include
#LDFLAGS+= -L/opt/local/lib
LDLIBS += -lsqlite3 -lz -liconv
else
$( error don' t know how to make for $( BUILD_FOR) on $( BUILD_ON) )
endif
e l s e i f e q ( $( BUILD_ON ) , L i n u x )
i f e q ( $( BUILD_FOR ) , L i n u x )
TARGET = libpEpEngine.so
LIBGPGME ?= libgpgme.so.11
CC = gcc -std= c99
CFLAGS ?= -I$( ETPAN_IN) /include -fPIC -pedantic -DSYSTEM_DB= \" $( SYSTEM_DB) \" \
-DSQLITE_THREADSAFE= 1 -D_GNU_SOURCE -I../asn.1 $( EXTRAMACROS)
LDFLAGS ?= -L$( ETPAN_IN) /lib -shared -lc -ldl -letpan -lpthread -L../asn.1 -lasn1 -luuid
e l s e
$( error don 't know how to make for $ ( BUILD_FOR ) on $ ( BUILD_ON ) )
e n d i f
ifeq ( $( BUILD_FOR) ,Linux)
# FIXME Find out if SQLITE_THREADSAFE is needed for both platform.
CFLAGS += -DSQLITE_THREADSAFE= 1 -D_GNU_SOURCE
LDLIBS += -ldl -luuid
else
$( error don' t know how to make for $( BUILD_FOR) on $( BUILD_ON) )
endif
e l s e
$( error don 't know how to make for $ ( BUILD_FOR ) on $ ( BUILD_ON ) )
$( error don' t know how to make for $( BUILD_FOR) on $( BUILD_ON) )
e n d i f
DEBUG ?= NO
i f e q ( "$(DEBUG)" , "NO" )
CFLAGS += -DNDEBUG
e n d i f
OPENPGP ?= GPG
i f e q ( "$(OPENPGP)" , "GPG" )
i f e q ( $( OPENPGP ) , G P G )
NO_SOURCE = pgp_netpgp.c
GPGME_IN?= $( HOME)
CFLAGS += -DUSE_GPG -I$( GPGME_IN) /include -DLIBGPGME= \" $( LIBGPGME) \"
#LDFLAGS+= -L$(GPGME_IN)/lib -lgpgme
e l s e i f e q ( "$(OPENPGP)" , "NETPGP" )
CFLAGS += -DUSE_GPG $( GPGME_INC) -DLIBGPGME= \" $( LIBGPGME) \"
# FIXME Why was -lgpgme commented out?
LDFLAGS += $( GPGME_LIB)
e l s e i f e q ( $( OPENPGP ) , N E T P G P )
NO_SOURCE = pgp_gpg.c
NETPGP_IN?= $( HOME )
CFLAGS += -DUSE_NETPGP -I$( NETPGP_IN) /include
LDFLAGS += -L$( NETPGP_IN) /lib -lnetpgp -lcurl
CFLAGS += -DUSE_NETPGP $( NETGPG_INC)
LDFLAGS += $( NETGPG_LIB)
LDLIBS += -lnetpgp -lcurl
e l s e
$( error Unknown OpenPGP library : $( OPENPGP) )
$( error Unknown OpenPGP library: $( OPENPGP) )
e n d i f
ALL_SOURCE = $( subst $( NO_SOURCE) ,,$( wildcard *.c) )
DEPENDS = $( subst .c,.d,$( ALL_SOURCE) )
ALL_OBJECTS = $( subst .c,.o,$( ALL_SOURCE) )
.PHONY : all
all : $( TARGET )
# FIXME What is this?
i n c l u d e M a k e f i l e . p r o t o c o l s
%.d : %.c
@ -75,27 +62,27 @@ include Makefile.protocols
- i n c l u d e $( DEPENDS )
#platform_windows.o: platform_windows.cpp
# $(CXX) $(CXX_FLAGS) -o $@ -c $<
$(TARGET) : libpEpEngine .a
$( LD) $( ALL_OBJECTS) $( LDFLAGS) -o $@
$( LD) $( ALL_OBJECTS) $( LDFLAGS) $( LDLIBS) -o $@
.PHONY : object
objects : $( ALL_OBJECTS )
libpEpEngine.a : $( ALL_OBJECTS )
ar -r $@ $( ALL_OBJECTS)
ar -rc $@ $^
.PHONY : clean
clean :
rm -f *.d *.o *.a $( TARGET) *.dll *.so *.zip *.d.* *.def *~
.PHONY : install
install : $( TARGET )
cp $< $( PREFIX) /lib/
mkdir -p $( PREFIX) /include/pEp
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/
.PHONY : uninstall
uninstall :
rm -f $( PREFIX) /lib/$( TARGET)
rm -rf $( PREFIX) /include/pEp