| 1 |
O ?= 2 |
| 2 |
|
| 3 |
CXXFLAGS = -std=c++0x -pthread -W -Wall -Wno-unused -Wno-unused-parameter |
| 4 |
CXXFLAGS += -DDEBUG -g |
| 5 |
CXXSOFLAGS = $(CXXFLAGS) -shared |
| 6 |
CC = g++ |
| 7 |
DEPS = cffCompressor.h |
| 8 |
BIN = ../python/compreffor |
| 9 |
|
| 10 |
ifeq ($(OS),Windows_NT) |
| 11 |
uname_S := Windows |
| 12 |
else |
| 13 |
uname_S := $(shell uname -s) |
| 14 |
endif |
| 15 |
ifeq ($(uname_S), Windows) |
| 16 |
executable = cffCompressor.exe |
| 17 |
sharedlib = compreff.dll |
| 18 |
# statically link libgcc, libstdc++ and libwinpthread on mingw-w64 |
| 19 |
LDFLAGS ?= -static |
| 20 |
else |
| 21 |
executable = cffCompressor |
| 22 |
sharedlib = libcompreff.so |
| 23 |
endif |
| 24 |
|
| 25 |
all: $(executable) lib |
| 26 |
$(executable): cffCompressor.o |
| 27 |
$(CC) $(CXXFLAGS) -o $(BIN)/$@ $(LDFLAGS) $^ |
| 28 |
%.o: %.cc $(DEPS) |
| 29 |
$(CC) $(CXXFLAGS) -o $@ -c -O$(O) $< |
| 30 |
lib: $(sharedlib) |
| 31 |
$(sharedlib): cffCompressor.cc $(DEPS) |
| 32 |
$(CC) $(CXXSOFLAGS) -o $(BIN)/$@ -O$(O) -fPIC $(LDFLAGS) $< |
| 33 |
clean: |
| 34 |
rm -rf cffCompressor.o $(BIN)/$(executable) $(BIN)/$(sharedlib) $(BIN)/$(sharedlib).dSYM |
| 35 |
ALL: clean all |