Makefile
author Mahlon E. Smith <mahlon@martini.nu>
Fri, 04 May 2012 10:25:25 -0700
changeset 24 d3b6f9ccbe20
parent 22 822094314703
child 29 c5d00a24af56
permissions -rw-r--r--
Update the Makefile to play nice with platform specific wackiness.
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),
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    32
# FreeBSD 8.x and 9.x, and Ubuntu 11.10 and 12.04.
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
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    36
#  - lua is called 'lua5.1'
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
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    39
volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua5.1)
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    40
volta: LIBS   += $(shell pkg-config --libs-only-l lua5.1)
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    41
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
    42
debug: CFLAGS += $(CFLAGS_DEBUG)\
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    43
	$(shell pkg-config --cflags-only-I --libs-only-L lua5.1)
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    44
debug: LIBS   += $(shell pkg-config --libs-only-l lua5.1) -lprofiler
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    45
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    46
# FreeBSD
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    47
# - lua is called 'lua-5.1'
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    48
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
    49
volta: CFLAGS += -L/usr/local/lib -I/usr/local/include
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    50
volta: CFLAGS += $(shell pkg-config --cflags-only-I --libs-only-L lua-5.1)
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    51
volta: LIBS   += $(shell pkg-config --libs-only-l lua-5.1)
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    52
debug: CFLAGS += $(CFLAGS_DEBUG)\
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    53
    $(shell pkg-config --cflags-only-I --libs-only-L lua-5.1 $(DEPS_DEBUG))
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    54
debug: LIBS += $(shell pkg-config --libs-only-l lua-5.1 $(DEPS_DEBUG))
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    55
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    56
# 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
    57
# - 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
    58
else
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    59
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
    60
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
    61
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
    62
    $(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
    63
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
    64
endif
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    65
24
d3b6f9ccbe20 Update the Makefile to play nice with platform specific wackiness.
Mahlon E. Smith <mahlon@martini.nu>
parents: 22
diff changeset
    66
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    67
# 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
    68
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
    69
	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
    70
else
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
    71
	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
    72
endif
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    73
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    74
# 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
    75
# (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
    76
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
    77
	OBJS += parser.o
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    78
endif
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
########################################################################
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    82
### 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
    83
########################################################################
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    84
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    85
volta: $(OBJS)
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    86
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    87
	strip $@
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
    88
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    89
$(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
    90
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
    91
2
8c88756f81b0 Ensure that parsing can't be subverted by requests larger than the
Mahlon E. Smith <mahlon@martini.nu>
parents: 1
diff changeset
    92
# 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
    93
parser.c:
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
    94
	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
    95
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    96
debug: $(OBJS)
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
    97
	$(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
    98
1
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
    99
823d42546cea Dial in the Makefile and command line option parsing. Better debug
Mahlon E. Smith <mahlon@laika.com>
parents: 0
diff changeset
   100
########################################################################
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   101
### 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
   102
########################################################################
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   103
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
   104
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
   105
	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
   106
	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
   107
	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
   108
	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
   109
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
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
   111
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
   112
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
   113
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
   114
	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
   115
	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
   116
	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
   117
	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
   118
	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
   119
	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
   120
	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
   121
	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
   122
	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
   123
	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
   124
	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
   125
	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
   126
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="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
   128
# 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
   129
profile:
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 --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
   131
	pprof --text ./volta $(CPUPROFILE)
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   132
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   133
tags:
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   134
	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
   135
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   136
clobber: clean
16
e6a640ad2cc2 Ensure that all output is flushed immediately.
Mahlon E. Smith <mahlon@martini.nu>
parents: 14
diff changeset
   137
	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
   138
0
eac7211fe522 Initial commit of an experimental little Squid redirector.
Mahlon E. Smith <mahlon@martini.nu>
parents:
diff changeset
   139
clean:
13
23a242d7b7fa 1st iteration of volta actually doing something. Process the request,
Mahlon E. Smith <mahlon@laika.com>
parents: 11
diff changeset
   140
	-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
   141
11
9aa5114326e8 Carry the amalgamated sqlite3 around with volta, rather than requiring
Mahlon E. Smith <mahlon@martini.nu>
parents: 10
diff changeset
   142
# 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
   143
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
   144
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
   145
	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
   146
	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
   147
	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
   148