|
@@ -29,11 +29,9 @@ 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_*.c)
|
|
|
|
|
|
+CODEC_SRC = $(wildcard src/codec/{codec,grammar,lexer}*.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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -52,8 +50,8 @@ 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)
|
|
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)
|
|
|
|
|
|
+OBJ = $(EXT_OBJ) $(CODEC_OBJ) $(LSUP_SRC:.c=.o)
|
|
|
|
+DBG_OBJ = $(EXT_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
|
|
@@ -106,6 +104,7 @@ liblsuprdf_dbg.a: $(DBG_OBJ)
|
|
|
|
|
|
# Dynamic debug library.
|
|
# Dynamic debug library.
|
|
liblsuprdf_dbg.so: $(DBG_OBJ)
|
|
liblsuprdf_dbg.so: $(DBG_OBJ)
|
|
|
|
+ $(warning Making $(DBG_OBJ))
|
|
$(CC) -shared $(LDFLAGS) -o $@ $^
|
|
$(CC) -shared $(LDFLAGS) -o $@ $^
|
|
|
|
|
|
|
|
|
|
@@ -119,14 +118,15 @@ parsers: $(PARSER_SRC) ## Make intermediate parser sources for development.
|
|
|
|
|
|
# Codecs.
|
|
# Codecs.
|
|
# Parser C sources.
|
|
# Parser C sources.
|
|
-$(CODEC_DIR)/parser_%.c: $(CODEC_DIR)/lexer_%.re $(CODEC_DIR)/grammar_%.c $(CODEC_DIR)/grammar_%.h src/codec.c
|
|
|
|
|
|
+$(CODEC_DIR)/parser_%.c: $(CODEC_DIR)/lexer_%.re $(CODEC_DIR)/grammar_%.c include/codec/tokens_%.h src/codec.c
|
|
$(LEXER) $< -o $@ -T --case-ranges
|
|
$(LEXER) $< -o $@ -T --case-ranges
|
|
|
|
|
|
|
|
|
|
-.SECONDARY: $(CODEC_DIR)/grammar_%.c
|
|
|
|
|
|
+.PRECIOUS: $(CODEC_DIR)/grammar_%.c include/codec/tokens_%.h
|
|
# Parser generators.
|
|
# Parser generators.
|
|
-$(CODEC_DIR)/grammar_%.c $(CODEC_DIR)/grammar_%.h: $(CODEC_DIR)/grammar_%.y
|
|
|
|
|
|
+$(CODEC_DIR)/grammar_%.c include/codec/grammar_%.h: $(CODEC_DIR)/grammar_%.y
|
|
$(PARSER) $< -q -T$(CODEC_DIR)/lempar.c -d$(CODEC_DIR)
|
|
$(PARSER) $< -q -T$(CODEC_DIR)/lempar.c -d$(CODEC_DIR)
|
|
|
|
+ mv $(CODEC_DIR)/grammar_*.h include/codec
|
|
|
|
|
|
|
|
|
|
# Ext libraries.
|
|
# Ext libraries.
|
|
@@ -156,15 +156,15 @@ debug_install: install debug ## Install standard and debug libraries.
|
|
cp liblsuprdf_dbg.{a,so} $(DESTDIR)$(libdir)
|
|
cp liblsuprdf_dbg.{a,so} $(DESTDIR)$(libdir)
|
|
|
|
|
|
|
|
|
|
-.PHONY: clean ## Clean up artifacts.
|
|
|
|
|
|
+.PHONY: clean ## Clean up artifacts, including language parsers.
|
|
clean:
|
|
clean:
|
|
rm -f src/*.[aod] ./*[aod] src/codec/*[aod]
|
|
rm -f src/*.[aod] ./*[aod] src/codec/*[aod]
|
|
|
|
+ rm -f include/codec/grammar_*.h
|
|
|
|
+ rm -f src/codec/{grammar,parser}_*.c
|
|
|
|
|
|
|
|
|
|
-.PHONY: deepclean ## Clean up external libraries and language parsers as well.
|
|
|
|
|
|
+.PHONY: deepclean ## Clean up external libraries.
|
|
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
|
|
|
|
|