src/Makefile
author Damiano Boppart <damiano@pep-security.net>
Mon, 14 Aug 2017 02:26:09 +0200
branchENGINE-228
changeset 1958 433df9ee336d
parent 1955 8ec0b81a659f
child 1959 fe4d994a1105
permissions -rw-r--r--
More Makefile cleanup
     1 # Copyright 2017, pEp Security SA
     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 
     6 include ../Makefile.conf
     7 
     8 CFLAGS+= $(ETPAN_INC) -I../asn.1 -DSYSTEM_DB=\"$(SYSTEM_DB)\" $(EXTRA_MACROS)
     9 LDFLAGS+= $(ETPAN_LIB) -L../asn.1 -shared
    10 LDLIBS+= -lc -lasn1 -letpan 
    11 
    12 ifeq ($(BUILD_ON),Darwin)
    13     ifeq ($(BUILD_FOR),Darwin)
    14         #CFLAGS+= -I/opt/local/include
    15         #LDFLAGS+= -L/opt/local/lib
    16         LDLIBS+= -lsqlite3 -lz -liconv
    17     else
    18         $(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    19     endif
    20 else ifeq ($(BUILD_ON),Linux)
    21     ifeq ($(BUILD_FOR),Linux)
    22         # FIXME Find out if SQLITE_THREADSAFE is needed for both platform.
    23         CFLAGS+= -DSQLITE_THREADSAFE=1 -D_GNU_SOURCE
    24         LDLIBS+= -ldl -luuid
    25     else
    26         $(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    27     endif
    28 else
    29     $(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    30 endif
    31 
    32 
    33 ifeq ($(OPENPGP),GPG)
    34     NO_SOURCE=pgp_netpgp.c
    35     CFLAGS+= -DUSE_GPG $(GPGME_INC) -DLIBGPGME=\"$(LIBGPGME)\"
    36     # FIXME Why was -lgpgme commented out?
    37     LDFLAGS+= $(GPGME_LIB)
    38 else ifeq ($(OPENPGP),NETPGP)
    39     NO_SOURCE=pgp_gpg.c
    40     CFLAGS+= -DUSE_NETPGP $(NETGPG_INC)
    41     LDFLAGS+= $(NETGPG_LIB)
    42     LDLIBS+= -lnetpgp -lcurl
    43 else
    44     $(error Unknown OpenPGP library: $(OPENPGP))
    45 endif
    46 
    47 ALL_SOURCE=$(subst $(NO_SOURCE),,$(wildcard *.c))
    48 DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
    49 ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
    50 
    51 .PHONY: all
    52 all: $(TARGET)
    53 
    54 # FIXME What is this?
    55 include Makefile.protocols
    56 
    57 %.d: %.c
    58 	@set -e; rm -f $@; \
    59 	$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
    60 	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
    61 	rm -f $@.$$$$
    62 
    63 -include $(DEPENDS)
    64 
    65 $(TARGET): libpEpEngine.a
    66 	$(LD) $(ALL_OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@
    67 
    68 .PHONY: object
    69 objects: $(ALL_OBJECTS)
    70 
    71 libpEpEngine.a: $(ALL_OBJECTS)
    72 	ar -rc $@ $^
    73 
    74 .PHONY: clean
    75 clean:
    76 	rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
    77 
    78 .PHONY: install
    79 install: $(TARGET)
    80 	cp $< $(PREFIX)/lib/
    81 	mkdir -p $(PREFIX)/include/pEp
    82 	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/
    83 
    84 .PHONY: uninstall
    85 uninstall:
    86 	rm -f $(PREFIX)/lib/$(TARGET)
    87 	rm -rf $(PREFIX)/include/pEp
    88