-
Notifications
You must be signed in to change notification settings - Fork 30
/
Makefile
45 lines (34 loc) · 1.25 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
ifndef KEEP_ENV_VARS
LDFLAGS += -lre2 -lyaml-cpp
CXXFLAGS += -std=c++0x -Wall -Werror -g -fPIC -O3
endif
# wildcard object build target
%.o: %.cpp
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $*.cpp -o $*.o
@$(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $*.cpp > $*.d
uaparser_cpp: libuaparser_cpp.a
OBJECT_FILES = UaParser.o \
internal/Pattern.o \
internal/AlternativeExpander.o \
internal/SnippetIndex.o \
internal/ReplaceTemplate.o
libuaparser_cpp.a: $(OBJECT_FILES)
$(AR) rcs $@ $^
libuaparser_cpp.so: $(OBJECT_FILES)
$(CXX) $^ -shared $(LDFLAGS) -o $@
UaParserTest: libuaparser_cpp.a UaParserTest.o
$(CXX) $^ -o $@ libuaparser_cpp.a $(LDFLAGS) -lgtest -lpthread
test: UaParserTest libuaparser_cpp.a
./UaParserTest
UaParserBench: libuaparser_cpp.a benchmarks/UaParserBench.o
$(CXX) $^ -o $@ libuaparser_cpp.a $(LDFLAGS) -lpthread
bench: UaParserBench
time ./UaParserBench uap-core/regexes.yaml benchmarks/useragents.txt 1000
# clean everything generated
clean:
find . -name "*.o" -exec rm -rf {} \; # clean up object files
find . -name "*.d" -exec rm -rf {} \; # clean up dependencies
rm -f UaParserTest UaParserBench *.a *.so
# automatically include the generated *.d dependency make targets
# that are created from the wildcard %.o build target above
-include $(OBJS:.o=.d)