Makefile 1.2 KB

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