src/Makefile
author vb
Mon, 29 Dec 2014 20:48:30 +0100
changeset 38 271bea5552dc
parent 3 bd4014e15899
child 46 7471e31bb278
permissions -rw-r--r--
encrypt in pieces
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@1
    10
CC=gcc -std=c99
vb@1
    11
CFLAGS=-I$(GPGME_IN)/include -I/opt/local/include $(OPTIMIZE) -pedantic \
vb@1
    12
	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\"  -DSQLITE_THREADSAFE=1
vb@38
    13
LDFLAGS=-lc -macosx_version_min $(MACOSX_VERSION_MIN) -dylib -arch x86_64 \
vb@38
    14
	-L/opt/local/lib -letpan
vb@1
    15
vb@1
    16
else ifeq ($(BUILD_FOR),Windoze)
vb@1
    17
vb@1
    18
TARGET=pEpEngine.dll
vb@1
    19
GPGME_IN=$(HOME)
vb@1
    20
LIBGPGME=libgpgme-11.dll
vb@1
    21
CC=i686-w64-mingw32-gcc -std=c99
vb@1
    22
CXX=i686-w64-mingw32-g++
vb@1
    23
LD=i686-w64-mingw32-gcc
vb@1
    24
CFLAGS=-I$(HOME)/i686-w64-mingw32/include -I$(GPGME_IN)/include $(OPTIMIZE) -pedantic \
vb@1
    25
	-DLIBGPGME=\"$(LIBGPGME)\" -DWIN32 -DSQLITE_THREADSAFE=1
vb@1
    26
LDFLAGS=-shared -L$(HOME)/i686-w64-mingw32/lib -llibstdc++ \
vb@1
    27
	-Wl,--output-def,pEpEngine.def,--out-implib,libpEpEngine.a
vb@1
    28
vb@1
    29
else
vb@1
    30
$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
vb@1
    31
endif
vb@1
    32
vb@1
    33
else ifeq ($(BUILD_ON),Linux)
vb@1
    34
ifeq ($(BUILD_FOR),Linux)
vb@1
    35
vb@1
    36
TARGET=libpEpEngine.so
vb@1
    37
GPGME_IN=$(HOME)
vb@1
    38
LIBGPGME=libgpgme.so.11
vb@1
    39
CC=gcc -std=c99
vb@1
    40
CFLAGS=-I$(GPGME_IN)/include $(OPTIMIZE) -fPIC -pedantic \
vb@1
    41
	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\" -DSQLITE_THREADSAFE=1
vb@1
    42
LDFLAGS=-L$(GPGME_IN) -shared -lc -ldl
vb@1
    43
vb@1
    44
else ifeq ($(BUILD_FOR),Windoze)
vb@1
    45
vb@1
    46
TARGET=pEpEngine.dll
vb@1
    47
GPGME_IN=$(HOME)
vb@1
    48
LIBGPGME=libgpgme-11.dll
vb@1
    49
CC=i686-w64-mingw32-gcc -std=c99
vb@1
    50
CXX=i686-w64-mingw32-g++
vb@1
    51
LD=i686-w64-mingw32-gcc
vb@1
    52
CFLAGS=-I/usr/i686-w64-mingw32/include -I$(GPGME_IN)/include $(OPTIMIZE) -pedantic \
vb@1
    53
	-DLIBGPGME=\"$(LIBGPGME)\" -DWIN32 -DSQLITE_THREADSAFE=1
vb@1
    54
LDFLAGS=-shared -L/usr/i686-w64-mingw32/lib -llibstdc++ \
vb@1
    55
	-Wl,--output-def,pEpEngine.def,--out-implib,libpEpEngine.a
vb@1
    56
vb@1
    57
else
vb@1
    58
$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
vb@1
    59
endif
vb@1
    60
vb@1
    61
else ifeq ($(BUILD_ON),MINGW32_NT-6.1)
vb@1
    62
vb@1
    63
TARGET=pEpEngine.dll
vb@1
    64
GPGME_IN=/c/Program\ Files/GNU/GnuPG
vb@1
    65
LIBGPGME=libgpgme-11.dll
vb@1
    66
CC=gcc -std=gnu99
vb@1
    67
CFLAGS=-I$(GPGME_IN)/include $(OPTIMIZE) -pedantic -DWIN32 -DSQLITE_THREADSAFE=1
vb@1
    68
LD=gcc
vb@1
    69
LDFLAGS=-shared -llibstdc++ -Wl,--output-def,pEpEngine.def,--out-implib,libpEpEngine.a
vb@1
    70
vb@1
    71
else
vb@1
    72
$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
vb@1
    73
endif
vb@1
    74
vb@1
    75
ifeq ($(BUILD_FOR),Windoze)
vb@1
    76
ALL_SOURCE=$(filter-out platform_unix.c,$(wildcard *.c))
vb@1
    77
else ifeq ($(BUILD_FOR),MINGW32_NT-6.1)
vb@1
    78
ALL_SOURCE=$(filter-out platform_unix.c,$(wildcard *.c))
vb@1
    79
else
vb@1
    80
ALL_SOURCE=$(wildcard *.c)
vb@1
    81
endif
vb@1
    82
vb@1
    83
DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
vb@1
    84
vb@1
    85
ifeq ($(BUILD_FOR),Windoze)
vb@1
    86
ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE)) platform_windows.o
vb@1
    87
else ifeq ($(BUILD_FOR),MINGW32_NT-6.1)
vb@1
    88
ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE)) platform_windows.o
vb@1
    89
else
vb@1
    90
ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
vb@1
    91
endif
vb@1
    92
vb@1
    93
all: $(TARGET)
vb@1
    94
vb@1
    95
%.d: %.c
vb@1
    96
	@set -e; rm -f $@; \
vb@3
    97
	$(CC) -MM $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
vb@1
    98
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
vb@1
    99
	rm -f $@.$$$$
vb@1
   100
vb@1
   101
-include $(DEPENDS)
vb@1
   102
vb@1
   103
platform_windows.o: platform_windows.cpp
vb@1
   104
	$(CXX) $(CXX_FLAGS) -o $@ -c $<
vb@1
   105
vb@1
   106
$(TARGET): libpEpEngine.a
vb@1
   107
	$(LD) $(ALL_OBJECTS) $(LDFLAGS) -o $@
vb@1
   108
vb@1
   109
objects: $(ALL_OBJECTS)
vb@1
   110
vb@1
   111
libpEpEngine.a: $(ALL_OBJECTS)
vb@1
   112
	ar -r $@ $(ALL_OBJECTS)
vb@1
   113
vb@1
   114
.PHONY: clean
vb@1
   115
vb@1
   116
clean:
vb@1
   117
	rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
vb@1
   118
vb@1
   119
install: $(TARGET)
vb@1
   120
	cp $< $(PREFIX)/lib/
vb@1
   121
vb@1
   122
uninstall:
vb@1
   123
	rm -f $(PREFIX)/lib/$(TARGET)
vb@1
   124