-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
110 lines (95 loc) · 2.07 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# args
MT := 1
STATIC_CPP := 0
# used clang?
CL := 0
# build with -m32?
M32 := 0
# build for out min size
MINS := 0
ifeq ($(OS),Windows_NT) # mingw?
CC := gcc
endif
HDP_PATH := ../HDiffPatch
HDP_OBJ := \
$(HDP_PATH)/libHDiffPatch/HDiff/private_diff/libdivsufsort/divsufsort.o \
$(HDP_PATH)/libHDiffPatch/HPatch/patch.o \
$(HDP_PATH)/file_for_patch.o
ifeq ($(MT),0)
else
HDP_OBJ += \
$(HDP_PATH)/libParallel/parallel_import.o \
$(HDP_PATH)/libParallel/parallel_channel.o
endif
TINY_OBJ := \
decompress/tuz_dec.o \
compress/tuz_enc.o \
compress/tuz_enc_private/tuz_enc_clip.o \
compress/tuz_enc_private/tuz_enc_code.o \
compress/tuz_enc_private/tuz_enc_match.o \
compress/tuz_enc_private/tuz_sstring.o \
$(HDP_OBJ)
DEF_FLAGS := \
-O3 -DNDEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
ifeq ($(MT),0)
DEF_FLAGS += -D_IS_USED_MULTITHREAD=0
else
DEF_FLAGS += \
-D_IS_USED_MULTITHREAD=1 \
-D_IS_USED_CPP11THREAD=1
endif
ifeq ($(M32),0)
else
DEF_FLAGS += -m32
endif
ifeq ($(MINS),0)
else
DEF_FLAGS += \
-s \
-Wno-error=format-security \
-fvisibility=hidden \
-ffunction-sections -fdata-sections \
-ffat-lto-objects -flto
CXXFLAGS += -fvisibility-inlines-hidden
endif
TINY_LINK :=
ifeq ($(MT),0)
else
TINY_LINK += -lpthread # link pthread
endif
ifeq ($(M32),0)
else
TINY_LINK += -m32
endif
ifeq ($(MINS),0)
else
TINY_LINK += -Wl,--gc-sections,--as-needed
endif
ifeq ($(CL),1)
CXX := clang++
CC := clang
endif
ifeq ($(STATIC_CPP),0)
TINY_LINK += -lstdc++
else
TINY_LINK += -static-libstdc++
endif
CFLAGS += $(DEF_FLAGS)
CXXFLAGS += $(DEF_FLAGS) -std=c++11
.PHONY: all install clean
all: libtinyuz.a tinyuz mostlyclean
libtinyuz.a: $(TINY_OBJ)
$(AR) rcs $@ $^
tinyuz: libtinyuz.a
$(CXX) tinyuz_demo.cpp libtinyuz.a $(CXXFLAGS) $(TINY_LINK) -o tinyuz
ifeq ($(OS),Windows_NT) # mingw?
RM := del /Q /F
DEL_TINY_OBJ := $(subst /,\,$(TINY_OBJ))
else
RM := rm -f
DEL_TINY_OBJ := $(TINY_OBJ)
endif
mostlyclean: tinyuz
$(RM) $(DEL_TINY_OBJ)
clean:
$(RM) libtinyuz.a tinyuz $(DEL_TINY_OBJ)