Makefile
author Mahlon E. Smith <mahlon@martini.nu>
Tue, 09 Jun 2015 12:01:57 -0700
changeset 32 6dc2d52e4b13
parent 29 c5d00a24af56
permissions -rw-r--r--
Update to Lua 5.2.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
8d0f25ef038e Add common archive files (LICENCE, README, etc) and a 'release' Makefile
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
     1
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
     2
########################################################################
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
     3
### S E T U P
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
     4
########################################################################
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
     5
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
     6
UNAME       := $(shell uname)
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
     7
DEPS_DEBUG   = libprofiler
14
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
     8
CFLAGS       = -O2
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
     9
CFLAGS_DEBUG = -DDEBUG -DPROG='"volta (debugmode)"' -ggdb -ansi -Wall
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    10
LIBS         = -lcdb
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    11
OBJS         = $(patsubst %.c,%.o,$(wildcard *.c))
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    12
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    13
.PHONY : parsegraph profile clean clobber release
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    14
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    15
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    16
########################################################################
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    17
### P L A T F O R M  T A R G E T S
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    18
########################################################################
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    19
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    20
# I hate this.  Tools like pkg-config are supposed to make finding
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    21
# libraries easy across platforms.  They only work when everyone names
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    22
# the libraries the same thing, unfortunately.  (Why name the libs with
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    23
# the version number, when pkg-config supports built in versioning??)
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    24
# And no, I'm not going to use autoconf, which just takes your build
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    25
# problems and makes a whole bunch of new baby problems for you to
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    26
# deal with.  Gaaarrgghghh.
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    27
#
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    28
# If you have problems building volta, manually pass the correct CFLAGS
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    29
# and LIBS to the 'make' command line for your platform.
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    30
#
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    31
# The following works for OSX with macports or homebrew (10.6/10.7),
32
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    32
# FreeBSD 8.x through 10.x, and Ubuntu 11.10 through 14.04.
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    33
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    34
# Ubuntu
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    35
#  - perftools doesn't currently register a .pc file at all
32
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    36
#  - lua is called 'lua5.2'
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    37
ifeq ($(UNAME), Linux)
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    38
volta: CFLAGS += -L/usr/lib -I/usr/include
32
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    39
volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua5.2)
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    40
volta: LIBS   += $(shell pkg-config --libs-only-l lua5.2)
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    41
debug: CFLAGS += $(CFLAGS_DEBUG)\
32
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    42
	$(shell pkg-config --cflags-only-I --libs-only-L lua5.2)
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    43
debug: LIBS   += $(shell pkg-config --libs-only-l lua5.2) -lprofiler
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    44
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    45
# FreeBSD
32
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    46
# - lua is called 'lua-5.2'
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    47
else ifeq ($(UNAME), FreeBSD)
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    48
volta: CFLAGS += -L/usr/local/lib -I/usr/local/include
32
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    49
volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua-5.2)
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    50
volta: LIBS   += $(shell pkg-config --libs-only-l lua-5.2)
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    51
debug: CFLAGS += $(CFLAGS_DEBUG)\
32
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    52
    $(shell pkg-config --cflags-only-I --libs-only-L lua-5.2 $(DEPS_DEBUG))
6dc2d52e4b13 Update to Lua 5.2.
Mahlon E. Smith <mahlon@martini.nu>
parents: 29
diff changeset
    53
debug: LIBS += $(shell pkg-config --libs-only-l lua-5.2 $(DEPS_DEBUG))
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    54
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    55
# Darwin, everyone else (best guess?)
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    56
# - lua is called 'lua', hopefully!
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    57
else
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    58
volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua)
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    59
volta: LIBS   += $(shell pkg-config --libs-only-l lua) 
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    60
debug: CFLAGS += $(CFLAGS_DEBUG)\
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    61
    $(shell pkg-config --cflags-only-I --libs-only-L lua $(DEPS_DEBUG))
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    62
debug: LIBS += $(shell pkg-config --libs-only-l lua $(DEPS_DEBUG))
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    63
endif
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    64
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    65
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    66
# Fix parser line number display in debug mode
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    67
ifeq (,$(findstring debug,$(MAKECMDGOALS)))
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    68
	RAGEL_FLAGS = -LCe -G2
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    69
else
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
    70
	RAGEL_FLAGS = -Ces -G2
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    71
endif
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    72
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    73
# Ensure the parser is included in the objs list
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    74
# (patsubst wouldn't have found it if parser.c wasn't pre-generated.)
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    75
ifneq (parser.o,$(findstring parser.o,$(OBJS)))
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    76
	OBJS += parser.o
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    77
endif
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    78
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    79
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    80
########################################################################
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    81
### B U I L D
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    82
########################################################################
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    83
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    84
volta: $(OBJS)
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    85
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    86
	strip $@
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    87
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    88
$(OBJS): volta.h
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
    89
db.o: db.h
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    90
2
8c88756f81b0 Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents: 1
diff changeset
    91
# 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
    92
parser.c:
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
    93
	ragel $(RAGEL_FLAGS) parser.rl -o $@
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    94
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    95
debug: $(OBJS)
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    96
	$(CC) $(CFLAGS) -o volta $(OBJS) $(LIBS)
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    97
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    98
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    99
########################################################################
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   100
### U T I L
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   101
########################################################################
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   102
14
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   103
parsegraph: \
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   104
	request_graph.xml request_graph.pdf request_graph.dot \
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   105
	rule_graph.xml rule_graph.pdf rule_graph.dot \
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   106
	dbinput_graph.xml dbinput_graph.pdf dbinput_graph.dot \
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   107
	tld_graph.xml tld_graph.pdf tld_graph.dot
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   108
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   109
request_graph.xml request_graph.pdf request_graph.dot \
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   110
rule_graph.xml rule_graph.pdf rule_graph.dot \
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   111
dbinput_graph.xml dbinput_graph.pdf dbinput_graph.dot \
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   112
tld_graph.xml tld_graph.pdf tld_graph.dot: parser.rl
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   113
	ragel -Vp -S request_parser parser.rl > request_graph.dot
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   114
	ragel -Vp -S rule_parser parser.rl > rule_graph.dot
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   115
	ragel -Vp -S dbinput_parser parser.rl > dbinput_graph.dot
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   116
	ragel -Vp -S tld_parser parser.rl > tld_graph.dot
14
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   117
	ragel $(RAGEL_FLAGS) -S request_parser -x parser.rl -o request_graph.xml
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   118
	ragel $(RAGEL_FLAGS) -S rule_parser -x parser.rl -o rule_graph.xml
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   119
	ragel $(RAGEL_FLAGS) -S dbinput_parser -x parser.rl -o dbinput_graph.xml
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   120
	ragel $(RAGEL_FLAGS) -S tld_parser -x parser.rl -o tld_graph.xml
14
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   121
	dot -Tpdf request_graph.dot > request_graph.pdf
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   122
	dot -Tpdf rule_graph.dot > rule_graph.pdf
51eb85ae4de4 There isn't a fast way to look up ( value exists or null ) for every
Mahlon E. Smith <mahlon@martini.nu>
parents: 13
diff changeset
   123
	dot -Tpdf dbinput_graph.dot > dbinput_graph.pdf
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   124
	dot -Tpdf tld_graph.dot > tld_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
   125
8c88756f81b0 Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents: 1
diff changeset
   126
# 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
   127
# 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
   128
profile:
8c88756f81b0 Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents: 1
diff changeset
   129
	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
   130
	pprof --text ./volta $(CPUPROFILE)
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   131
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   132
tags:
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   133
	ctags *.h *.c
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   134
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   135
clobber: clean
16
e6a640ad2cc2 Ensure that all output is flushed immediately.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
   136
	rm -f parser.c volta.db ChangeLog tags
2
8c88756f81b0 Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents: 1
diff changeset
   137
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   138
clean:
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   139
	-rm -f volta *_graph.* *.o *.prof*
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   140
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   141
# requires BSD tar
8
8d0f25ef038e Add common archive files (LICENCE, README, etc) and a 'release' Makefile
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   142
release: VERSION = $(shell hg id -t | awk '{ print $$1 }')
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   143
release: clobber parser.c
8
8d0f25ef038e Add common archive files (LICENCE, README, etc) and a 'release' Makefile
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   144
	hg log --style changelog > ChangeLog
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   145
	tar -C .. --exclude misc --exclude .\* --exclude \*.rl -s '/^volta/volta-$(VERSION)/' -czvf /tmp/volta-$(VERSION).tgz volta
8
8d0f25ef038e Add common archive files (LICENCE, README, etc) and a 'release' Makefile
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   146
	mv /tmp/volta-$(VERSION).tgz .
8d0f25ef038e Add common archive files (LICENCE, README, etc) and a 'release' Makefile
Mahlon E. Smith <mahlon@martini.nu>
parents: 6
diff changeset
   147