Makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. CODEC_DIR=src/codec
  2. CC=gcc
  3. CFLAGS+= -Wall
  4. INCLUDE=-I. -Iinclude -Iext/xxHash -Iext/openldap/libraries/liblmdb \
  5. -Iext/uthash/src
  6. LIB=-luuid -lpthread
  7. SRC=ext/xxHash/xxhash.c ext/openldap/libraries/liblmdb/mdb.c \
  8. ext/openldap/libraries/liblmdb/midl.c src/*.c src/codec/*_grammar.c \
  9. src/codec/*_parser.c
  10. .PHONY: build_parsers lint profile
  11. default: test
  12. build: build_parsers
  13. $(CC) \
  14. $(CFLAGS) -Werror
  15. $(INCLUDE) \
  16. $(LIB) \
  17. $(SRC) \
  18. -o bin/lsup_rdf.so
  19. lint:
  20. splint \
  21. $(INCLUDE) -Itest \
  22. -DUINT_MAX=0xFFFFFFFFUL \
  23. -nullpass \
  24. -posix-lib \
  25. test.c
  26. test: build_parsers
  27. $(CC) \
  28. $(CFLAGS) -g3 -DDEBUG \
  29. $(INCLUDE) -Itest \
  30. $(LIB) \
  31. $(SRC) test.c \
  32. -o bin/test
  33. test_lexer:
  34. cd src/codec && \
  35. lemon -T/usr/share/lemon/lempar.c nt_grammar.y && \
  36. re2c nt_lexer.re -o nt_codec.c -T --case-ranges && \
  37. cd ../../
  38. $(CC) \
  39. $(CFLAGS) -g3 -DDEBUG \
  40. $(INCLUDE) -I. \
  41. $(LIB) \
  42. $(SRC) src/codec/nt_codec.c src/codec/nt_grammar.c \
  43. -o bin/test_lexer
  44. valgrind:
  45. valgrind \
  46. --leak-check=full --show-leak-kinds=all --track-origins=yes \
  47. ./bin/test
  48. memcheck: test valgrind
  49. profile: build_parsers
  50. $(CC) \
  51. $(CFLAGS) \
  52. $(INCLUDE) \
  53. $(LIB) \
  54. $(SRC) profile.c \
  55. -o bin/profile
  56. build_parsers:; $(MAKE) -C $(CODEC_DIR)