|
@@ -29,10 +29,13 @@ DBG_CFLAGS = -Itest -O0 -g3 -DDEBUG
|
|
LDFLAGS = -L. -L$(libdir) -llmdb -lxxhash -luuid
|
|
LDFLAGS = -L. -L$(libdir) -llmdb -lxxhash -luuid
|
|
|
|
|
|
CODEC_DIR = src/codec
|
|
CODEC_DIR = src/codec
|
|
-CODEC_SRC = $(wildcard src/codec/grammar_*.c) \
|
|
|
|
- $(wildcard src/codec/parser_*.c)
|
|
|
|
|
|
+CODEC_SRC = $(wildcard src/codec_*.c)
|
|
CODEC_OBJ = $(CODEC_SRC:.c=.o)
|
|
CODEC_OBJ = $(CODEC_SRC:.c=.o)
|
|
CODEC_DBG_OBJ = $(CODEC_SRC:.c=_dbg.o)
|
|
CODEC_DBG_OBJ = $(CODEC_SRC:.c=_dbg.o)
|
|
|
|
+PARSER_SRC = $(CODEC_SRC:src/codec_%=src/codec/parser_%)
|
|
|
|
+PARSER_OBJ = $(PARSER_SRC:.c=.o)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
# External sources compiled in core object.
|
|
# External sources compiled in core object.
|
|
EXT_SRC = $(wildcard ext/log/src/*.c) \
|
|
EXT_SRC = $(wildcard ext/log/src/*.c) \
|
|
@@ -48,9 +51,9 @@ LSUP_SRC = $(wildcard src/*.c)
|
|
SRC = $(EXT_SRC) $(LSUP_SRC)
|
|
SRC = $(EXT_SRC) $(LSUP_SRC)
|
|
TEST_SRC = $(wildcard test/*.c) test.c
|
|
TEST_SRC = $(wildcard test/*.c) test.c
|
|
|
|
|
|
-EXT_OBJ = $(EXT_SRC:.c=.o)
|
|
|
|
-OBJ = $(EXT_OBJ) $(CODEC_OBJ) $(LSUP_SRC:.c=.o)
|
|
|
|
-DBG_OBJ = $(EXT_OBJ) $(CODEC_DBG_OBJ) $(LSUP_SRC:.c=_dbg.o)
|
|
|
|
|
|
+EXT_OBJ = $(EXT_SRC:.c=.o)
|
|
|
|
+OBJ = $(EXT_OBJ) $(PARSER_OBJ) $(CODEC_OBJ) $(LSUP_SRC:.c=.o)
|
|
|
|
+DBG_OBJ = $(EXT_OBJ) $(PARSER_OBJ) $(CODEC_DBG_OBJ) $(LSUP_SRC:.c=_dbg.o)
|
|
|
|
|
|
DEPLIBS = libxxhash liblmdb
|
|
DEPLIBS = libxxhash liblmdb
|
|
LIBS = liblsuprdf.a liblsuprdf.so
|
|
LIBS = liblsuprdf.a liblsuprdf.so
|
|
@@ -71,7 +74,7 @@ export LD_LIBRARY_PATH = .:$(libdir)
|
|
|
|
|
|
.DEFAULT_GOAL := lib
|
|
.DEFAULT_GOAL := lib
|
|
|
|
|
|
-# Extract all rule comment into a help message.
|
|
|
|
|
|
+# Extract all rule comments into a help message.
|
|
.PHONY: help
|
|
.PHONY: help
|
|
help:
|
|
help:
|
|
@echo "Command overview:"; echo; \
|
|
@echo "Command overview:"; echo; \
|
|
@@ -111,18 +114,18 @@ liblsuprdf_dbg.so: $(DBG_OBJ)
|
|
$(CC) $(CFLAGS) $(DBG_CFLAGS) $(LDFLAGS) -c $^ -o $@
|
|
$(CC) $(CFLAGS) $(DBG_CFLAGS) $(LDFLAGS) -c $^ -o $@
|
|
|
|
|
|
|
|
|
|
-# Codecs.
|
|
|
|
-$(CODEC_OBJ): $(CODEC_SRC)
|
|
|
|
-
|
|
|
|
|
|
+.PHONY: parsers
|
|
|
|
+parsers: $(PARSER_SRC) ## Make intermediate parser sources for development.
|
|
|
|
|
|
|
|
+# Codecs.
|
|
# Parser C sources.
|
|
# Parser C sources.
|
|
-parser_%.c: lexer_%.re grammar_%.c
|
|
|
|
|
|
+$(CODEC_DIR)/parser_%.c: $(CODEC_DIR)/lexer_%.re $(CODEC_DIR)/grammar_%.c $(CODEC_DIR)/grammar_%.h
|
|
$(LEXER) $< -o $@ -T --case-ranges
|
|
$(LEXER) $< -o $@ -T --case-ranges
|
|
|
|
|
|
|
|
|
|
# Parser generators.
|
|
# Parser generators.
|
|
-grammar_%.c: grammar_%.y
|
|
|
|
- $(PARSER) $< -q -m -T$(CODEC_DIR)/lempar.c -d$(CODEC_DIR)
|
|
|
|
|
|
+$(CODEC_DIR)/grammar_%.c $(CODEC_DIR)/grammar_%.h: $(CODEC_DIR)/grammar_%.y
|
|
|
|
+ $(PARSER) $< -q -T$(CODEC_DIR)/lempar.c -d$(CODEC_DIR)
|
|
|
|
|
|
|
|
|
|
# Ext libraries.
|
|
# Ext libraries.
|
|
@@ -154,11 +157,13 @@ debug_install: install debug ## Install standard and debug libraries.
|
|
|
|
|
|
.PHONY: clean ## Clean up artifacts.
|
|
.PHONY: clean ## Clean up artifacts.
|
|
clean:
|
|
clean:
|
|
- rm -rf src/*.[aod] ./*[aod] src/codec/*[aod]
|
|
|
|
|
|
+ rm -f src/*.[aod] ./*[aod] src/codec/*[aod]
|
|
|
|
|
|
|
|
|
|
-.PHONY: deepclean ## Clean up artifacts in external libraries as well.
|
|
|
|
|
|
+.PHONY: deepclean ## Clean up external libraries and language parsers as well.
|
|
deepclean: clean
|
|
deepclean: clean
|
|
|
|
+ rm -f src/codec/grammar_*.{c,h}
|
|
|
|
+ rm -f src/codec/parser_*.c
|
|
cd $(MDB_DIR); make clean
|
|
cd $(MDB_DIR); make clean
|
|
cd $(XXHASH_DIR); make clean
|
|
cd $(XXHASH_DIR); make clean
|
|
|
|
|