forked from skandau/paq8sk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (58 loc) · 1.41 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
TARGET = paq8sk
CC ?= gcc
CFLAGS ?= -Wall
CXX ?= g++
CXXFLAGS ?= -Wall -msse2 -O3
LDFLAGS ?= -s
AR = ar
RM ?= rm -f
SRCS = src/$(TARGET).cpp
OBJS = $(SRCS:%.cpp=%.o)
BZIP2SRCS = src/bzip2/blocksort.c \
src/bzip2/bz2compress.c \
src/bzip2/bz2decompress.c \
src/bzip2/bzip2.c \
src/bzip2/bzip2recover.c \
src/bzip2/bzlib.c \
src/bzip2/crctable.c \
src/bzip2/dlltest.c \
src/bzip2/huffman.c \
src/bzip2/randtable.c \
src/bzip2/spewG.c \
src/bzip2/unzcrash.c
BZIP2OBJS = $(BZIP2SRCS:%.c=%.o)
ZLIBSRCS = src/zlib/adler32.c \
src/zlib/crc32.c \
src/zlib/deflate.c \
src/zlib/inffast.c \
src/zlib/inflate.c \
src/zlib/inftrees.c \
src/zlib/trees.c \
src/zlib/zutil.c
ZLIBOBJS = $(ZLIBSRCS:%.c=%.o)
ifeq ($(OS),Windows_NT)
CXXFLAGS += -DWINDOWS
else
CXXFLAGS += -DUNIX
endif
ifeq ($(STATIC), Y)
CXXFLAGS += -Isrc/bzip2 -Isrc/zlib
LDFLAGS += -static
OBJS += libz.a libbz2.a
else
CXXFLAGS += -DMT
LDLIBS = -lpthread -lz -lbz2
endif
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) $(LDLIBS) -o $@
libbz2.a: $(BZIP2OBJS)
$(AR) rcs $@ $^
libz.a: $(ZLIBOBJS)
$(AR) rcs $@ $^
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean:
$(RM) $(TARGET) $(OBJS) $(BZIP2OBJS) $(ZLIBOBJS)