3 ### S E T U P |
3 ### S E T U P |
4 ######################################################################## |
4 ######################################################################## |
5 |
5 |
6 UNAME := $(shell uname) |
6 UNAME := $(shell uname) |
7 DEPS_DEBUG = libprofiler |
7 DEPS_DEBUG = libprofiler |
8 CFLAGS = -O2 -DSQLITE_THREADSAFE=0 -DSQLITE_TEMP_STORE=2 |
8 CFLAGS = -O2 |
9 CFLAGS_DEBUG = -DSQLITE_DEBUG -DDEBUG -DPROG='"volta (debugmode)"' -ggdb -ansi -Wall |
9 CFLAGS_DEBUG = -DDEBUG -DPROG='"volta (debugmode)"' -ggdb -ansi -Wall |
10 LIBS = |
10 LIBS = -lcdb |
11 OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) |
11 OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) |
12 |
|
13 # not using pkg-config for sqlite3 anymore |
|
14 #DEPS = sqlite3 |
|
15 #CFLAGS = -O2 -ansi $(shell pkg-config --cflags-only-I --libs-only-L $(DEPS)) |
|
16 #LIBS = $(shell pkg-config --libs-only-l $(DEPS)) |
|
17 |
12 |
18 .PHONY : parsegraph profile clean clobber release |
13 .PHONY : parsegraph profile clean clobber release |
19 |
14 |
20 # Ubuntu: perftools doesn't currently register a .pc file, and |
15 # Ubuntu: perftools doesn't currently register a .pc file |
21 # sqlite amalgamated requires -ldl |
|
22 ifeq ($(UNAME), Linux) |
16 ifeq ($(UNAME), Linux) |
23 volta: LIBS += -ldl |
|
24 debug: CFLAGS += $(CFLAGS_DEBUG) |
17 debug: CFLAGS += $(CFLAGS_DEBUG) |
25 debug: LIBS = -lprofiler -ldl |
18 debug: LIBS += -lprofiler |
26 else |
19 else |
|
20 volta: CFLAGS += -L/opt/local/lib -I/opt/local/include |
27 debug: CFLAGS += $(CFLAGS_DEBUG)\ |
21 debug: CFLAGS += $(CFLAGS_DEBUG)\ |
28 $(shell pkg-config --cflags-only-I --libs-only-L $(DEPS_DEBUG)) |
22 $(shell pkg-config --cflags-only-I --libs-only-L $(DEPS_DEBUG)) |
29 debug: LIBS = $(shell pkg-config --libs-only-l $(DEPS_DEBUG)) |
23 debug: LIBS += $(shell pkg-config --libs-only-l $(DEPS_DEBUG)) |
30 endif |
24 endif |
31 |
25 |
32 # Fix parser line number display in debug mode |
26 # Fix parser line number display in debug mode |
33 ifeq (,$(findstring debug,$(MAKECMDGOALS))) |
27 ifeq (,$(findstring debug,$(MAKECMDGOALS))) |
34 RAGEL_FLAGS = -LCe -G2 |
28 RAGEL_FLAGS = -LCe -G2 |
64 |
58 |
65 ######################################################################## |
59 ######################################################################## |
66 ### U T I L |
60 ### U T I L |
67 ######################################################################## |
61 ######################################################################## |
68 |
62 |
69 parsegraph: squidline_graph.xml squidline_graph.pdf squidline_graph.dot tld_graph.xml tld_graph.pdf tld_graph.dot |
63 parsegraph: \ |
70 squidline_graph.xml squidline_graph.pdf squidline_graph.dot tld_graph.xml tld_graph.pdf tld_graph.dot: parser.rl |
64 request_graph.xml request_graph.pdf request_graph.dot \ |
71 ragel -Vp -S squidline_parser parser.rl > squidline_graph.dot |
65 rule_graph.xml rule_graph.pdf rule_graph.dot \ |
|
66 dbinput_graph.xml dbinput_graph.pdf dbinput_graph.dot \ |
|
67 tld_graph.xml tld_graph.pdf tld_graph.dot |
|
68 |
|
69 request_graph.xml request_graph.pdf request_graph.dot \ |
|
70 rule_graph.xml rule_graph.pdf rule_graph.dot \ |
|
71 dbinput_graph.xml dbinput_graph.pdf dbinput_graph.dot \ |
|
72 tld_graph.xml tld_graph.pdf tld_graph.dot: parser.rl |
|
73 ragel -Vp -S request_parser parser.rl > request_graph.dot |
|
74 ragel -Vp -S rule_parser parser.rl > rule_graph.dot |
|
75 ragel -Vp -S dbinput_parser parser.rl > dbinput_graph.dot |
72 ragel -Vp -S tld_parser parser.rl > tld_graph.dot |
76 ragel -Vp -S tld_parser parser.rl > tld_graph.dot |
73 ragel $(RAGEL_FLAGS) -S squidline_parser -x parser.rl -o squidline_graph.xml |
77 ragel $(RAGEL_FLAGS) -S request_parser -x parser.rl -o request_graph.xml |
|
78 ragel $(RAGEL_FLAGS) -S rule_parser -x parser.rl -o rule_graph.xml |
|
79 ragel $(RAGEL_FLAGS) -S dbinput_parser -x parser.rl -o dbinput_graph.xml |
74 ragel $(RAGEL_FLAGS) -S tld_parser -x parser.rl -o tld_graph.xml |
80 ragel $(RAGEL_FLAGS) -S tld_parser -x parser.rl -o tld_graph.xml |
75 dot -Tpdf squidline_graph.dot > squidline_graph.pdf |
81 dot -Tpdf request_graph.dot > request_graph.pdf |
|
82 dot -Tpdf rule_graph.dot > rule_graph.pdf |
|
83 dot -Tpdf dbinput_graph.dot > dbinput_graph.pdf |
76 dot -Tpdf tld_graph.dot > tld_graph.pdf |
84 dot -Tpdf tld_graph.dot > tld_graph.pdf |
77 |
85 |
78 # export CPUPROFILE="cpu.prof" before running volta for cpu profiling |
86 # export CPUPROFILE="cpu.prof" before running volta for cpu profiling |
79 # export CPUPROFILE_FREQUENCY=100 (default) |
87 # export CPUPROFILE_FREQUENCY=100 (default) |
80 profile: |
88 profile: |