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