author | Mahlon E. Smith <mahlon@martini.nu> |
Wed, 28 Sep 2011 09:04:16 -0700 | |
changeset 7 | e4f1a551d45c |
parent 6 | 85718bc3ff47 |
child 8 | 8d0f25ef038e |
permissions | -rw-r--r-- |
6
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
1 |
DEPS = sqlite3 |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
2 |
DEPS_DEBUG = sqlite3 libprofiler |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
3 |
CFLAGS = $(shell pkg-config --cflags-only-I --libs-only-L $(DEPS)) -O2 |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
4 |
LIBS = $(shell pkg-config --libs-only-l $(DEPS)) |
1
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
5 |
#OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) parser.o |
4
5701b7859a31
Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
2
diff
changeset
|
6 |
OBJS = accept_loop.o db.o main.o parser.o util.o |
6
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
7 |
RAGEL_FLAGS = -LCe -G2 |
0
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
8 |
|
1
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
9 |
######################################################################## |
2
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
10 |
### P R O D U C T I O N |
1
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
11 |
######################################################################## |
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
12 |
|
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
13 |
volta: $(OBJS) |
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
14 |
$(CC) $(CFLAGS) $(LIBS) -o $@ $(OBJS) |
0
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
15 |
strip $@ |
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
16 |
|
1
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
17 |
$(OBJS): volta.h |
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
18 |
|
2
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
19 |
# don't actually depend on parser.rl, so distributions don't require ragel |
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
20 |
parser.c: |
6
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
21 |
ragel $(RAGEL_FLAGS) -s parser.rl -o $@ |
0
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
22 |
|
1
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
23 |
|
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
24 |
######################################################################## |
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
25 |
### D E B U G |
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
26 |
######################################################################## |
0
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
27 |
|
6
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
28 |
debug: CFLAGS = -ggdb -Wall -DDEBUG -DPROG='"volta (debugmode)"'\ |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
29 |
$(shell pkg-config --cflags-only-I --libs-only-L $(DEPS_DEBUG)) |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
30 |
debug: LIBS = $(shell pkg-config --libs-only-l $(DEPS_DEBUG)) |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
31 |
debug: volta-debug parser_graph.xml parser_graph.pdf parser_graph.dot |
2
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
32 |
|
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
33 |
volta-debug: $(OBJS) |
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
34 |
$(CC) $(CFLAGS) $(LIBS) -o volta $(OBJS) |
0
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
35 |
|
6
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
36 |
parser_graph.xml parser_graph.pdf parser_graph.dot: parser.rl |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
37 |
# ragel -Vp parser.rl > parser_graph.dot |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
38 |
# ragel $(RAGEL_FLAGS) -x parser.rl -o parser_graph.xml |
85718bc3ff47
Use pkg-config to find dependency locations, add gdb debug flags.
Mahlon E. Smith <mahlon@martini.nu>
parents:
4
diff
changeset
|
39 |
# dot -Tpdf parser_graph.dot > parser_graph.pdf |
2
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
40 |
|
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
41 |
# export CPUPROFILE="cpu.prof" before running volta for cpu profiling |
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
42 |
# export CPUPROFILE_FREQUENCY=100 (default) |
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
43 |
profile: |
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
44 |
pprof --dot ./volta $(CPUPROFILE) | dot -Tpng > $(CPUPROFILE).png |
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
45 |
pprof --text ./volta $(CPUPROFILE) |
0
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
46 |
|
1
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
47 |
|
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
48 |
######################################################################## |
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
49 |
### U T I L |
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
50 |
######################################################################## |
823d42546cea
Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents:
0
diff
changeset
|
51 |
|
2
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
52 |
.PHONY : clean cleanall |
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
53 |
|
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
54 |
cleanall: clean |
4
5701b7859a31
Groundwork for automatic database initialization and schema upgrades.
Mahlon E. Smith <mahlon@laika.com>
parents:
2
diff
changeset
|
55 |
rm -f parser.c volta.db |
2
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
56 |
|
0
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
57 |
clean: |
2
8c88756f81b0
Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents:
1
diff
changeset
|
58 |
-rm -f volta volta_debug* parser_graph.* *.o *.prof* |
0
eac7211fe522
Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff
changeset
|
59 |