Makefile
changeset 13 23a242d7b7fa
parent 11 9aa5114326e8
child 14 51eb85ae4de4
equal deleted inserted replaced
12:191b3c25974a 13:23a242d7b7fa
    31 
    31 
    32 # Fix parser line number display in debug mode
    32 # Fix parser line number display in debug mode
    33 ifeq (,$(findstring debug,$(MAKECMDGOALS)))
    33 ifeq (,$(findstring debug,$(MAKECMDGOALS)))
    34 	RAGEL_FLAGS = -LCe -G2
    34 	RAGEL_FLAGS = -LCe -G2
    35 else
    35 else
    36 	RAGEL_FLAGS = -Ce -G2
    36 	RAGEL_FLAGS = -Ces -G2
    37 endif
    37 endif
    38 
    38 
    39 # Ensure the parser is included in the objs list
    39 # Ensure the parser is included in the objs list
    40 # (patsubst wouldn't have found it if parser.c wasn't pre-generated.)
    40 # (patsubst wouldn't have found it if parser.c wasn't pre-generated.)
    41 ifneq (parser.o,$(findstring parser.o,$(OBJS)))
    41 ifneq (parser.o,$(findstring parser.o,$(OBJS)))
    50 volta: $(OBJS)
    50 volta: $(OBJS)
    51 	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
    51 	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
    52 	strip $@
    52 	strip $@
    53 
    53 
    54 $(OBJS): volta.h
    54 $(OBJS): volta.h
       
    55 db.o: db.h
    55 
    56 
    56 # don't actually depend on parser.rl, so distributions don't require ragel
    57 # don't actually depend on parser.rl, so distributions don't require ragel
    57 parser.c:
    58 parser.c:
    58 	ragel $(RAGEL_FLAGS) -s parser.rl -o $@
    59 	ragel $(RAGEL_FLAGS) parser.rl -o $@
    59 
    60 
    60 debug: $(OBJS)
    61 debug: $(OBJS)
    61 	$(CC) $(CFLAGS) -o volta $(OBJS) $(LIBS)
    62 	$(CC) $(CFLAGS) -o volta $(OBJS) $(LIBS)
    62 
    63 
    63 
    64 
    64 ########################################################################
    65 ########################################################################
    65 ### U T I L
    66 ### U T I L
    66 ########################################################################
    67 ########################################################################
    67 
    68 
    68 parsegraph: parser_graph.xml parser_graph.pdf parser_graph.dot
    69 parsegraph: squidline_graph.xml squidline_graph.pdf squidline_graph.dot tld_graph.xml tld_graph.pdf tld_graph.dot
    69 parser_graph.xml parser_graph.pdf parser_graph.dot: parser.rl
    70 squidline_graph.xml squidline_graph.pdf squidline_graph.dot tld_graph.xml tld_graph.pdf tld_graph.dot: parser.rl
    70 	ragel -Vp parser.rl > parser_graph.dot
    71 	ragel -Vp -S squidline_parser parser.rl > squidline_graph.dot
    71 	ragel $(RAGEL_FLAGS) -x parser.rl -o parser_graph.xml
    72 	ragel -Vp -S tld_parser parser.rl > tld_graph.dot
    72 	dot -Tpdf parser_graph.dot > parser_graph.pdf
    73 	ragel $(RAGEL_FLAGS) -S squidline_parser -x parser.rl -o squidline_graph.xml
       
    74 	ragel $(RAGEL_FLAGS) -S tld_parser -x parser.rl -o tld_graph.xml
       
    75 	dot -Tpdf squidline_graph.dot > squidline_graph.pdf
       
    76 	dot -Tpdf tld_graph.dot > tld_graph.pdf
    73 
    77 
    74 # export CPUPROFILE="cpu.prof" before running volta for cpu profiling
    78 # export CPUPROFILE="cpu.prof" before running volta for cpu profiling
    75 # export CPUPROFILE_FREQUENCY=100 (default)
    79 # export CPUPROFILE_FREQUENCY=100 (default)
    76 profile:
    80 profile:
    77 	pprof --dot ./volta $(CPUPROFILE) | dot -Tpng > $(CPUPROFILE).png
    81 	pprof --dot ./volta $(CPUPROFILE) | dot -Tpng > $(CPUPROFILE).png
    82 
    86 
    83 clobber: clean
    87 clobber: clean
    84 	rm -f parser.c volta.db ChangeLog tags
    88 	rm -f parser.c volta.db ChangeLog tags
    85 
    89 
    86 clean:
    90 clean:
    87 	-rm -f volta parser_graph.* *.o *.prof*
    91 	-rm -f volta *_graph.* *.o *.prof*
    88 
    92 
    89 # requires BSD tar
    93 # requires BSD tar
    90 release: VERSION = $(shell hg id -t | awk '{ print $$1 }')
    94 release: VERSION = $(shell hg id -t | awk '{ print $$1 }')
    91 release: cleanall parser.c
    95 release: clobber parser.c
    92 	hg log --style changelog > ChangeLog
    96 	hg log --style changelog > ChangeLog
    93 	tar -C .. --exclude misc --exclude .\*  -s '/^volta/volta-$(VERSION)/' -czvf /tmp/volta-$(VERSION).tgz volta
    97 	tar -C .. --exclude misc --exclude .\* --exclude \*.rl -s '/^volta/volta-$(VERSION)/' -czvf /tmp/volta-$(VERSION).tgz volta
    94 	mv /tmp/volta-$(VERSION).tgz .
    98 	mv /tmp/volta-$(VERSION).tgz .
    95 
    99