Makefile 929 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. OPT_DEBUG=-O0 -g -Wall -Wextra -Werror -I.
  2. OPT_FAST=-O3 -DHTTP_PARSER_STRICT=0 -I.
  3. CC?=gcc
  4. test: test_g
  5. ./test_g
  6. test_g: http_parser_g.o test_g.o
  7. $(CC) $(OPT_DEBUG) http_parser_g.o test_g.o -o $@
  8. test_g.o: test.c http_parser.h Makefile
  9. $(CC) $(OPT_DEBUG) -c test.c -o $@
  10. test.o: test.c http_parser.h Makefile
  11. $(CC) $(OPT_FAST) -c test.c -o $@
  12. http_parser_g.o: http_parser.c http_parser.h Makefile
  13. $(CC) $(OPT_DEBUG) -c http_parser.c -o $@
  14. test-valgrind: test_g
  15. valgrind ./test_g
  16. http_parser.o: http_parser.c http_parser.h Makefile
  17. $(CC) $(OPT_FAST) -c http_parser.c
  18. test_fast: http_parser.o test.c http_parser.h
  19. $(CC) $(OPT_FAST) http_parser.o test.c -o $@
  20. test-run-timed: test_fast
  21. while(true) do time ./test_fast > /dev/null; done
  22. tags: http_parser.c http_parser.h test.c
  23. ctags $^
  24. clean:
  25. rm -f *.o test test_fast test_g http_parser.tar tags
  26. .PHONY: clean package test-run test-run-timed test-valgrind