-
Notifications
You must be signed in to change notification settings - Fork 36
/
Makefile
155 lines (124 loc) · 7.33 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#
# *****************************************************************
# * String Toolkit Library *
# * *
# * Author: Arash Partow (2002-2020) *
# * URL: http://www.partow.net/programming/strtk/index.html *
# * *
# * Copyright notice: *
# * Free use of the String Toolkit Library is permitted under the *
# * guidelines and in accordance with the most current version of *
# * the MIT License. *
# * http://www.opensource.org/licenses/MIT *
# * *
# *****************************************************************
#
COMPILER = -c++
#COMPILER = -clang++
OPTIMIZATION_OPT = -O2
NO_EXTRA_LIBS = -Dstrtk_no_tr1_or_boost
BASE_OPTIONS = -ansi -pedantic-errors -Wall -Wextra -Werror -Wno-long-long
OPTIONS = $(BASE_OPTIONS) $(OPTIMIZATION_OPT) -o
REGEX = -lboost_regex
PTHREAD = -lpthread
LINKER_OPT = -lstdc++ -lm
BUILD_LIST+=strtk_examples
BUILD_LIST+=strtk_tokenizer_test
BUILD_LIST+=strtk_bloom_filter_example
BUILD_LIST+=strtk_combinations
BUILD_LIST+=strtk_combinator_example
BUILD_LIST+=strtk_converters_example
BUILD_LIST+=strtk_glober
BUILD_LIST+=strtk_hexview
BUILD_LIST+=strtk_ipv4_parser
BUILD_LIST+=strtk_keyvalue_example
BUILD_LIST+=strtk_nth_combination_example
BUILD_LIST+=strtk_numstats
BUILD_LIST+=strtk_parse_test
BUILD_LIST+=strtk_period_parser
BUILD_LIST+=strtk_randomizer
BUILD_LIST+=strtk_random_line
BUILD_LIST+=strtk_search_trie_example
BUILD_LIST+=strtk_serializer_example
BUILD_LIST+=strtk_text_parser_example01
BUILD_LIST+=strtk_text_parser_example02
BUILD_LIST+=strtk_tokengrid_example
BUILD_LIST+=strtk_tokenizer_cmp
BUILD_LIST+=strtk_wordfreq
all: $(BUILD_LIST)
strtk_tokenizer_cmp: strtk_tokenizer_cmp.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_tokenizer_cmp strtk_tokenizer_cmp.cpp $(LINKER_OPT)
strtk_examples: strtk_examples.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_examples strtk_examples.cpp $(LINKER_OPT) $(REGEX)
strtk_keyvalue_example: strtk_keyvalue_example.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_keyvalue_example strtk_keyvalue_example.cpp $(LINKER_OPT)
strtk_text_parser_example01: strtk_text_parser_example01.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_text_parser_example01 strtk_text_parser_example01.cpp $(LINKER_OPT)
strtk_text_parser_example02: strtk_text_parser_example02.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_text_parser_example02 strtk_text_parser_example02.cpp $(LINKER_OPT)
strtk_tokenizer_test: strtk_tokenizer_test.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_tokenizer_test strtk_tokenizer_test.cpp $(LINKER_OPT)
strtk_parse_test: strtk_parse_test.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_parse_test strtk_parse_test.cpp $(LINKER_OPT)
strtk_period_parser: strtk_period_parser.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_period_parser strtk_period_parser.cpp $(LINKER_OPT)
strtk_ipv4_parser: strtk_ipv4_parser.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_ipv4_parser strtk_ipv4_parser.cpp $(LINKER_OPT)
strtk_hexview: strtk_hexview.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_hexview strtk_hexview.cpp $(LINKER_OPT)
strtk_bloom_filter_example: strtk_bloom_filter_example.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_bloom_filter_example strtk_bloom_filter_example.cpp $(LINKER_OPT)
strtk_converters_example: strtk_converters_example.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_converters_example strtk_converters_example.cpp $(LINKER_OPT)
strtk_combinations: strtk_combinations.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_combinations strtk_combinations.cpp $(LINKER_OPT)
strtk_combinator_example: strtk_combinator_example.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_combinator_example strtk_combinator_example.cpp $(LINKER_OPT)
strtk_nth_combination_example: strtk_nth_combination_example.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_nth_combination_example strtk_nth_combination_example.cpp $(LINKER_OPT)
strtk_glober: strtk_glober.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_glober strtk_glober.cpp $(LINKER_OPT)
strtk_tokengrid_example: strtk_tokengrid_example.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_tokengrid_example strtk_tokengrid_example.cpp $(LINKER_OPT)
strtk_search_trie_example: strtk_search_trie_example.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_search_trie_example strtk_search_trie_example.cpp $(LINKER_OPT)
strtk_serializer_example: strtk_serializer_example.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_serializer_example strtk_serializer_example.cpp $(LINKER_OPT)
strtk_randomizer: strtk_randomizer.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_randomizer strtk_randomizer.cpp $(LINKER_OPT)
strtk_random_line: strtk_random_line.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_random_line strtk_random_line.cpp $(LINKER_OPT)
strtk_numstats: strtk_numstats.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_numstats strtk_numstats.cpp $(LINKER_OPT)
strtk_wordfreq: strtk_wordfreq.cpp strtk.hpp
$(COMPILER) $(OPTIONS) strtk_wordfreq strtk_wordfreq.cpp $(LINKER_OPT)
pgo: strtk_parse_test.cpp strtk_tokenizer_cmp.cpp strtk.hpp
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-generate -DUSE_SPIRIT -o strtk_tokenizer_cmp strtk_tokenizer_cmp.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-generate -o strtk_parse_test strtk_parse_test.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-generate -o strtk_serializer_example strtk_serializer_example.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-generate -o strtk_search_trie_example strtk_search_trie_example.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-generate -o strtk_converters_example strtk_converters_example.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-generate -o strtk_bloom_filter_example strtk_bloom_filter_example.cpp $(LINKER_OPT)
./strtk_tokenizer_cmp
./strtk_parse_test
./strtk_serializer_example
./strtk_search_trie_example
./strtk_converters_example
./strtk_bloom_filter_example
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-use -DUSE_SPIRIT -o strtk_tokenizer_cmp strtk_tokenizer_cmp.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-use -o strtk_parse_test strtk_parse_test.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-use -o strtk_serializer_example strtk_serializer_example.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-use -o strtk_search_trie_example strtk_search_trie_example.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-use -o strtk_converters_example strtk_converters_example.cpp $(LINKER_OPT)
$(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-use -o strtk_bloom_filter_example strtk_bloom_filter_example.cpp $(LINKER_OPT)
strip_bin :
@for f in $(BUILD_LIST); do if [ -f $$f ]; then strip -s $$f; echo $$f; fi done;
valgrind :
@for f in $(BUILD_LIST); do \
if [ -f $$f ]; then \
cmd="valgrind --leak-check=full --show-reachable=yes --track-origins=yes --log-file=$$f.log -v ./$$f"; \
echo $$cmd; \
$$cmd; \
fi done;
clean:
rm -f core.* *~ *.o *.bak *stackdump gmon.out *.gcda *.gcno *.gcnor *.gch