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