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