src/Makefile
author vb
Sat, 24 Jan 2015 15:26:40 +0100
changeset 46 7471e31bb278
parent 38 271bea5552dc
child 66 805bfae3cdc4
permissions -rw-r--r--
BUGFIX: init of transports wrong
     1 include ../Makefile.conf
     2 
     3 ifeq ($(BUILD_ON),Darwin)
     4 ifeq ($(BUILD_FOR),Darwin)
     5 
     6 TARGET=libpEpEngine.dylib
     7 MACOSX_VERSION_MIN=10.6
     8 GPGME_IN=$(HOME)
     9 LIBGPGME=libgpgme-pthread.dylib
    10 CC=clang -std=c99 -pthread
    11 LD=clang
    12 CFLAGS=-I$(GPGME_IN)/include -I/opt/local/include $(OPTIMIZE) -pedantic \
    13 	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\"
    14 LDFLAGS=-lc -shared -arch x86_64 \
    15 	-L/opt/local/lib -letpan -lgpgme-pthread -lsqlite3
    16 
    17 else
    18 $(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    19 endif
    20 
    21 else ifeq ($(BUILD_ON),Linux)
    22 ifeq ($(BUILD_FOR),Linux)
    23 
    24 TARGET=libpEpEngine.so
    25 GPGME_IN=$(HOME)
    26 LIBGPGME=libgpgme.so.11
    27 CC=gcc -std=c99
    28 CFLAGS=-I$(GPGME_IN)/include $(OPTIMIZE) -fPIC -pedantic \
    29 	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\" -DSQLITE_THREADSAFE=1
    30 LDFLAGS=-L$(GPGME_IN) -shared -lc -ldl -letpan -lgpgme-pthread -lsqlite3
    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 ALL_SOURCE=$(wildcard *.c)
    41 DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
    42 ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
    43 
    44 all: $(TARGET)
    45 
    46 %.d: %.c
    47 	@set -e; rm -f $@; \
    48 	$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
    49 	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
    50 	rm -f $@.$$$$
    51 
    52 -include $(DEPENDS)
    53 
    54 #platform_windows.o: platform_windows.cpp
    55 #	$(CXX) $(CXX_FLAGS) -o $@ -c $<
    56 
    57 $(TARGET): libpEpEngine.a
    58 	$(LD) $(ALL_OBJECTS) $(LDFLAGS) -o $@
    59 
    60 objects: $(ALL_OBJECTS)
    61 
    62 libpEpEngine.a: $(ALL_OBJECTS)
    63 	ar -r $@ $(ALL_OBJECTS)
    64 
    65 .PHONY: clean
    66 
    67 clean:
    68 	rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
    69 
    70 install: $(TARGET)
    71 	cp $< $(PREFIX)/lib/
    72 
    73 uninstall:
    74 	rm -f $(PREFIX)/lib/$(TARGET)
    75