src/Makefile
changeset 1 06e02338bdd8
child 3 bd4014e15899
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/Makefile	Wed Jun 25 18:46:19 2014 +0200
     1.3 @@ -0,0 +1,123 @@
     1.4 +include ../Makefile.conf
     1.5 +
     1.6 +ifeq ($(BUILD_ON),Darwin)
     1.7 +ifeq ($(BUILD_FOR),Darwin)
     1.8 +
     1.9 +TARGET=libpEpEngine.dylib
    1.10 +MACOSX_VERSION_MIN=10.6
    1.11 +GPGME_IN=$(HOME)
    1.12 +LIBGPGME=libgpgme-pthread.dylib
    1.13 +CC=gcc -std=c99
    1.14 +CFLAGS=-I$(GPGME_IN)/include -I/opt/local/include $(OPTIMIZE) -pedantic \
    1.15 +	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\"  -DSQLITE_THREADSAFE=1
    1.16 +LDFLAGS=-lc -macosx_version_min $(MACOSX_VERSION_MIN) -dylib -arch x86_64
    1.17 +
    1.18 +else ifeq ($(BUILD_FOR),Windoze)
    1.19 +
    1.20 +TARGET=pEpEngine.dll
    1.21 +GPGME_IN=$(HOME)
    1.22 +LIBGPGME=libgpgme-11.dll
    1.23 +CC=i686-w64-mingw32-gcc -std=c99
    1.24 +CXX=i686-w64-mingw32-g++
    1.25 +LD=i686-w64-mingw32-gcc
    1.26 +CFLAGS=-I$(HOME)/i686-w64-mingw32/include -I$(GPGME_IN)/include $(OPTIMIZE) -pedantic \
    1.27 +	-DLIBGPGME=\"$(LIBGPGME)\" -DWIN32 -DSQLITE_THREADSAFE=1
    1.28 +LDFLAGS=-shared -L$(HOME)/i686-w64-mingw32/lib -llibstdc++ \
    1.29 +	-Wl,--output-def,pEpEngine.def,--out-implib,libpEpEngine.a
    1.30 +
    1.31 +else
    1.32 +$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    1.33 +endif
    1.34 +
    1.35 +else ifeq ($(BUILD_ON),Linux)
    1.36 +ifeq ($(BUILD_FOR),Linux)
    1.37 +
    1.38 +TARGET=libpEpEngine.so
    1.39 +GPGME_IN=$(HOME)
    1.40 +LIBGPGME=libgpgme.so.11
    1.41 +CC=gcc -std=c99
    1.42 +CFLAGS=-I$(GPGME_IN)/include $(OPTIMIZE) -fPIC -pedantic \
    1.43 +	-DSYSTEM_DB=\"$(SYSTEM_DB)\" -DLIBGPGME=\"$(LIBGPGME)\" -DSQLITE_THREADSAFE=1
    1.44 +LDFLAGS=-L$(GPGME_IN) -shared -lc -ldl
    1.45 +
    1.46 +else ifeq ($(BUILD_FOR),Windoze)
    1.47 +
    1.48 +TARGET=pEpEngine.dll
    1.49 +GPGME_IN=$(HOME)
    1.50 +LIBGPGME=libgpgme-11.dll
    1.51 +CC=i686-w64-mingw32-gcc -std=c99
    1.52 +CXX=i686-w64-mingw32-g++
    1.53 +LD=i686-w64-mingw32-gcc
    1.54 +CFLAGS=-I/usr/i686-w64-mingw32/include -I$(GPGME_IN)/include $(OPTIMIZE) -pedantic \
    1.55 +	-DLIBGPGME=\"$(LIBGPGME)\" -DWIN32 -DSQLITE_THREADSAFE=1
    1.56 +LDFLAGS=-shared -L/usr/i686-w64-mingw32/lib -llibstdc++ \
    1.57 +	-Wl,--output-def,pEpEngine.def,--out-implib,libpEpEngine.a
    1.58 +
    1.59 +else
    1.60 +$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    1.61 +endif
    1.62 +
    1.63 +else ifeq ($(BUILD_ON),MINGW32_NT-6.1)
    1.64 +
    1.65 +TARGET=pEpEngine.dll
    1.66 +GPGME_IN=/c/Program\ Files/GNU/GnuPG
    1.67 +LIBGPGME=libgpgme-11.dll
    1.68 +CC=gcc -std=gnu99
    1.69 +CFLAGS=-I$(GPGME_IN)/include $(OPTIMIZE) -pedantic -DWIN32 -DSQLITE_THREADSAFE=1
    1.70 +LD=gcc
    1.71 +LDFLAGS=-shared -llibstdc++ -Wl,--output-def,pEpEngine.def,--out-implib,libpEpEngine.a
    1.72 +
    1.73 +else
    1.74 +$(error don't know how to make for $(BUILD_FOR) on $(BUILD_ON))
    1.75 +endif
    1.76 +
    1.77 +ifeq ($(BUILD_FOR),Windoze)
    1.78 +ALL_SOURCE=$(filter-out platform_unix.c,$(wildcard *.c))
    1.79 +else ifeq ($(BUILD_FOR),MINGW32_NT-6.1)
    1.80 +ALL_SOURCE=$(filter-out platform_unix.c,$(wildcard *.c))
    1.81 +else
    1.82 +ALL_SOURCE=$(wildcard *.c)
    1.83 +endif
    1.84 +
    1.85 +DEPENDS=$(subst .c,.d,$(ALL_SOURCE))
    1.86 +
    1.87 +ifeq ($(BUILD_FOR),Windoze)
    1.88 +ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE)) platform_windows.o
    1.89 +else ifeq ($(BUILD_FOR),MINGW32_NT-6.1)
    1.90 +ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE)) platform_windows.o
    1.91 +else
    1.92 +ALL_OBJECTS=$(subst .c,.o,$(ALL_SOURCE))
    1.93 +endif
    1.94 +
    1.95 +all: $(TARGET)
    1.96 +
    1.97 +%.d: %.c
    1.98 +	@set -e; rm -f $@; \
    1.99 +	$(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
   1.100 +	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
   1.101 +	rm -f $@.$$$$
   1.102 +
   1.103 +-include $(DEPENDS)
   1.104 +
   1.105 +platform_windows.o: platform_windows.cpp
   1.106 +	$(CXX) $(CXX_FLAGS) -o $@ -c $<
   1.107 +
   1.108 +$(TARGET): libpEpEngine.a
   1.109 +	$(LD) $(ALL_OBJECTS) $(LDFLAGS) -o $@
   1.110 +
   1.111 +objects: $(ALL_OBJECTS)
   1.112 +
   1.113 +libpEpEngine.a: $(ALL_OBJECTS)
   1.114 +	ar -r $@ $(ALL_OBJECTS)
   1.115 +
   1.116 +.PHONY: clean
   1.117 +
   1.118 +clean:
   1.119 +	rm -f *.d *.o *.a $(TARGET) *.dll *.so *.zip *.d.* *.def *~
   1.120 +
   1.121 +install: $(TARGET)
   1.122 +	cp $< $(PREFIX)/lib/
   1.123 +
   1.124 +uninstall:
   1.125 +	rm -f $(PREFIX)/lib/$(TARGET)
   1.126 +