From 45363122153c198b5f3a0e276eaf9a74b83cd154 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Fri, 20 Nov 2009 15:47:46 +0100 Subject: [PATCH] two builds in makefile --- Makefile | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index d41bc2b..43e8cb4 100644 --- a/Makefile +++ b/Makefile @@ -1,30 +1,31 @@ -OPT=-O0 -g -Wall -Wextra -Werror -#OPT=-O3 -DHTTP_PARSER_STRICT=0 +OPT_DEBUG=-O0 -g -Wall -Wextra -Werror +OPT_FAST=-O3 -DHTTP_PARSER_STRICT=0 -test: http_parser.o test.c - gcc $(OPT) http_parser.o test.c -o $@ -test-run: test - ./test +http_parser_g.o: http_parser.c http_parser.h Makefile + gcc $(OPT_DEBUG) -c http_parser.c + +test_g: http_parser_g.o test.c + gcc $(OPT_DEBUG) http_parser.o test.c -o $@ + +test-run: test_g + ./test_g -test-run-timed: test - time ./test > /dev/null http_parser.o: http_parser.c http_parser.h Makefile - gcc $(OPT) -c http_parser.c + gcc $(OPT_FAST) -c http_parser.c + +test: http_parser.o test.c + gcc $(OPT_FAST) http_parser.o test.c -o $@ + +test-run-timed: test + while(true) do time ./test > /dev/null; done + tags: http_parser.c http_parser.h test.c ctags $^ clean: - rm -f *.o http_parser.c test http_parser.tar - -package: http_parser.c - @rm -rf /tmp/http_parser && mkdir /tmp/http_parser && \ - cp LICENSE README.md Makefile http_parser.c \ - http_parser.h test.c /tmp/http_parser && \ - cd /tmp && \ - tar -cf http_parser.tar http_parser/ - @echo /tmp/http_parser.tar + rm -f *.o http_parser.c test test_g http_parser.tar .PHONY: clean package test-run test-run-timed