-
Notifications
You must be signed in to change notification settings - Fork 43
/
Makefile
62 lines (44 loc) · 2.12 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
.SUFFIXES:
MAKEFLAGS+=-r
config?=release
BUILD=build/make-$(CXX)-$(config)
CCFLAGS=-c -g -Wall -Werror -fPIC -O2 -Iextern/lz4/lib -Iextern/re2
CXXFLAGS=-std=c++11
LDFLAGS=-lpthread
ifeq ($(shell uname -p),x86_64)
CCFLAGS+=-msse2 -DUSE_SSE2
endif
ifeq ($(shell uname -p),arm)
CCFLAGS+=-DUSE_NEON
endif
ifeq ($(shell uname),Darwin)
CCFLAGS+=-mmacosx-version-min=10.7
LDFLAGS+=-mmacosx-version-min=10.7
LDFLAGS+=-framework CoreFoundation -framework CoreServices
else
LDFLAGS+=-pie -Wl,--dynamic-list=src/qgrep.dynlist
endif
ifeq ($(config),sanitize)
CCFLAGS+=-fsanitize=address,undefined
LDFLAGS+=-fsanitize=address,undefined
endif
SOURCES=
SOURCES+=extern/re2/re2/bitmap256.cc extern/re2/re2/bitstate.cc extern/re2/re2/compile.cc extern/re2/re2/dfa.cc extern/re2/re2/filtered_re2.cc extern/re2/re2/mimics_pcre.cc extern/re2/re2/nfa.cc extern/re2/re2/onepass.cc extern/re2/re2/parse.cc extern/re2/re2/perl_groups.cc extern/re2/re2/prefilter.cc extern/re2/re2/prefilter_tree.cc extern/re2/re2/prog.cc extern/re2/re2/re2.cc extern/re2/re2/regexp.cc extern/re2/re2/set.cc extern/re2/re2/simplify.cc extern/re2/re2/stringpiece.cc extern/re2/re2/tostring.cc extern/re2/re2/unicode_casefold.cc extern/re2/re2/unicode_groups.cc
SOURCES+=extern/re2/util/pcre.cc extern/re2/util/rune.cc extern/re2/util/strutil.cc
SOURCES+=extern/lz4/lib/lz4.c extern/lz4/lib/lz4hc.c
SOURCES+=src/blockpool.cpp src/build.cpp src/changes.cpp src/compression.cpp src/encoding.cpp src/files.cpp src/filestream.cpp src/fileutil.cpp src/fileutil_posix.cpp src/fileutil_win.cpp src/filter.cpp src/filterutil.cpp src/fuzzymatch.cpp src/highlight.cpp src/info.cpp src/init.cpp src/main.cpp src/orderedoutput.cpp src/project.cpp src/regex.cpp src/search.cpp src/stringutil.cpp src/update.cpp src/watch.cpp src/workqueue.cpp
OBJECTS=$(SOURCES:%=$(BUILD)/%.o)
EXECUTABLE=qgrep
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(CXX) $(OBJECTS) $(LDFLAGS) -o $@
clean:
rm -rf $(BUILD)
$(BUILD)/%.c.o: %.c
@mkdir -p $(dir $@)
$(CC) $(CCFLAGS) -MMD -MP $< -o $@
$(BUILD)/%.o: %
@mkdir -p $(dir $@)
$(CXX) $(CCFLAGS) $(CXXFLAGS) -MMD -MP $< -o $@
-include $(OBJECTS:.o=.d)
.PHONY: all clean