Add common archive files (LICENCE, README, etc) and a 'release' Makefile
target.
--- a/.hgignore Wed Sep 28 09:04:16 2011 -0700
+++ b/.hgignore Wed Sep 28 09:04:16 2011 -0700
@@ -1,6 +1,7 @@
^volta$
^volta.db$
^parser_graph.*
+^tags$
.*debug
.*.o
-
+^misc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/INSTALL Wed Sep 28 09:04:16 2011 -0700
@@ -0,0 +1,66 @@
+
+Building volta
+===============
+
+Volta should build with minimal effort. First, make sure you have
+dependencies installed.
+
+
+Dependencies
+------------
+
+Currently, volta requires the following to compile:
+
+Regular dependencies:
+
+ - GNU make (http://www.gnu.org/software/make/)
+ - sqlite3 (http://www.sqlite.org/)
+
+Development dependencies (optional):
+
+ - ragel (http://www.complang.org/ragel/)
+ - mercurial (http://mercurial.selenic.com/)
+ - google-perftools (http://code.google.com/p/google-perftools/)
+ - graphviz (http://www.graphviz.org/)
+ - ctags (http://ctags.sourceforge.net/)
+
+
+Compiling
+---------
+
+Just type 'make'. Depending on your platform, GNU make may have been
+installed as 'gmake' If you get any errors, try 'gmake' first.
+
+It should build without warnings.
+
+
+Installation
+------------
+
+Volta doesn't contain any installation targets. You can put the binary
+wherever makes sense on your system. Note that it should be in a
+directory that is writable to Squid, unless you plan to store the
+database separately. An example:
+
+ mv volta /usr/local/bin
+ mkdir -p /var/db/squid
+ chown squid:squid /var/db/squid
+ volta -f /var/db/squid/volta.db
+
+I usually just drop it into the squid configuration directory and run it
+from there.
+
+For usage information, see the README.
+
+
+Development
+-----------
+
+Volta source can be cloned via Mercurial. The repo is found at:
+
+ http://code.martini.nu/volta
+
+You can use the 'debug' make target to compile a (very noisy) binary
+that contains gdb symbols and perftool hooks. Set the CPUPROFILE
+environment variable to "cpu.prof" to generate a profile.
+
--- a/Makefile Wed Sep 28 09:04:16 2011 -0700
+++ b/Makefile Wed Sep 28 09:04:16 2011 -0700
@@ -1,11 +1,14 @@
+UNAME := $(shell uname)
DEPS = sqlite3
DEPS_DEBUG = sqlite3 libprofiler
CFLAGS = $(shell pkg-config --cflags-only-I --libs-only-L $(DEPS)) -O2
LIBS = $(shell pkg-config --libs-only-l $(DEPS))
#OBJS = $(patsubst %.c,%.o,$(wildcard *.c)) parser.o
-OBJS = accept_loop.o db.o main.o parser.o util.o
+OBJS = accept_loop.o db.o main.o parser.o process.o util.o
RAGEL_FLAGS = -LCe -G2
+.PHONY : parsegraph profile clean cleanall release
+
########################################################################
### P R O D U C T I O N
########################################################################
@@ -25,18 +28,27 @@
### D E B U G
########################################################################
+# proftools doesn't currently register a .pc file on Ubuntu, hence these
+# Makefile gymnastics
+ifeq ($(UNAME), Linux)
+debug: CFLAGS = -ggdb -Wall -DDEBUG -DPROG='"volta (debugmode)"'
+debug: LIBS = -lsqlite3 -lprofiler
+else
debug: CFLAGS = -ggdb -Wall -DDEBUG -DPROG='"volta (debugmode)"'\
$(shell pkg-config --cflags-only-I --libs-only-L $(DEPS_DEBUG))
debug: LIBS = $(shell pkg-config --libs-only-l $(DEPS_DEBUG))
-debug: volta-debug parser_graph.xml parser_graph.pdf parser_graph.dot
+endif
-volta-debug: $(OBJS)
+debug: RAGEL_FLAGS = -Ce -G2
+debug: $(OBJS)
+ ctags *.h *.c
$(CC) $(CFLAGS) $(LIBS) -o volta $(OBJS)
+parsegraph: parser_graph.xml parser_graph.pdf parser_graph.dot
parser_graph.xml parser_graph.pdf parser_graph.dot: parser.rl
-# ragel -Vp parser.rl > parser_graph.dot
-# ragel $(RAGEL_FLAGS) -x parser.rl -o parser_graph.xml
-# dot -Tpdf parser_graph.dot > parser_graph.pdf
+ ragel -Vp parser.rl > parser_graph.dot
+ ragel $(RAGEL_FLAGS) -x parser.rl -o parser_graph.xml
+ dot -Tpdf parser_graph.dot > parser_graph.pdf
# export CPUPROFILE="cpu.prof" before running volta for cpu profiling
# export CPUPROFILE_FREQUENCY=100 (default)
@@ -49,11 +61,15 @@
### U T I L
########################################################################
-.PHONY : clean cleanall
-
cleanall: clean
- rm -f parser.c volta.db
+ rm -f parser.c volta.db ChangeLog tags
clean:
-rm -f volta volta_debug* parser_graph.* *.o *.prof*
+release: VERSION = $(shell hg id -t | awk '{ print $$1 }')
+release: cleanall parser.c
+ hg log --style changelog > ChangeLog
+ tar -C .. --exclude misc --exclude .\* -s '/^volta/volta-$(VERSION)/' -czvf /tmp/volta-$(VERSION).tgz volta
+ mv /tmp/volta-$(VERSION).tgz .
+