浏览代码

Fix makefiles using debug flags; adjust documentation.

scossu 1 天之前
父节点
当前提交
b3bed9c9a2
共有 5 个文件被更改,包括 52 次插入50 次删除
  1. 17 7
      Makefile
  2. 8 7
      README.md
  3. 23 32
      docs/dev/deps.dot
  4. 二进制
      docs/dev/deps.pdf
  5. 4 4
      src/codec/Makefile

+ 17 - 7
Makefile

@@ -23,8 +23,8 @@ MASSIF_DUMP = /tmp/lsup_massif.out
 INCLUDE_BASE := . -Iinclude -Iext/tpl/src -Iext/hashmap -Iext/log/src
 INCLUDE := -I$(INCLUDE_BASE)
 _CFLAGS := -std=gnu11 -Wall -fPIC $(INCLUDE)
-CFLAGS = $(_CFLAGS) -O3
-DBG_CFLAGS = $(_CFLAGS) -Itest -O0 -ggdb -DDEBUG
+DBG_CFLAGS := $(_CFLAGS) -Itest -O0 -ggdb -DDEBUG
+CFLAGS := $(_CFLAGS) -O3
 #$(info CFLAGS: $(CFLAGS))
 #$(info DBG_CFLAGS: $(DBG_CFLAGS))
 # NOTE: -luuid is a Linux system library. Other OS's might need a different
@@ -70,6 +70,9 @@ DYN_DBG_LIB = $(DYN_LIB:.so=_dbg.so)
 LIBS = $(STATIC_LIB) $(DYN_LIB)
 DBG_LIBS = $(STATIC_DBG_LIB) $(DYN_DBG_LIB)
 
+#$(info LIBS: $(LIBS))
+#$(info DBG_LIBS: $(DBG_LIBS))
+
 # LDD for Linux, otool -L for OSX.
 ifeq (, $(shell which ldd))
 LDD := otool -L
@@ -81,7 +84,6 @@ endif
 DEPS := $(shell echo "${INCLUDE_BASE}" | sed -e 's/ -I/,/g'),include/codec
 DOCS = docs
 
-
 ## Environment.
 
 # Tests need the freshly compiled libs.
@@ -132,7 +134,7 @@ $(DYN_DBG_LIB): $(DBG_OBJ)
 
 # Standard objects.
 $(BUILDDIR)/%.o: src/%.c
-	$(CC) $(DBG_CFLAGS) -c $^ -o $@
+	$(CC) $(CFLAGS) -c $^ -o $@
 
 
 # Debug objects.
@@ -244,10 +246,18 @@ perftest: bin/perftest ## Run a performance test by creating, inserting and look
 
 
 .PHONY: profile
-profile: bin/profile ## Run a profiling session. Output can be inspected with KCachegrind.
+profile: bin/profile ## Run a profiling session on a limited set of high-volume commands.
 	LSUP_MDB_MAPSIZE=800000 valgrind --tool=callgrind \
 		--callgrind-out-file="$(CALLGRIND_DUMP)" bin/profile 1000
-	@echo "Profile dump written at $(CALLGRIND_DUMP). Open it with "\
+	@echo "Profile dump written at $(CALLGRIND_DUMP) . Open it with "\
+		"qcachegrind, kcachegrind, etc."
+
+
+.PHONY: test_profile
+test_profile: bin/test ## Run profiling on the standard test suite.
+	LSUP_MDB_MAPSIZE=800000 valgrind --tool=callgrind \
+		--callgrind-out-file="$(CALLGRIND_DUMP)" bin/test
+	@echo "Profile dump written at $(CALLGRIND_DUMP) . Open it with "\
 		"qcachegrind, kcachegrind, etc."
 
 
@@ -260,7 +270,7 @@ footprint: bin/perftest ## Measure memory footprint by generating and storing 10
 
 
 # Requires cinclude2dot (https://www.flourish.org/cinclude2dot) and Graphviz.
-depgraph: $(LSUP_SRC) $(CODEC_SRC) include/* include/codec/* ## Build a visual dependency graph of the code.
+depgraph: $(LSUP_SRC) include/* include/lsup/* include/lsup/codec/* ## Build a visual dependency graph of the code.
 	cinclude2dot --merge=module --include=$(DEPS) \
 		--exclude='test|ext' >| $(DOCS)/dev/deps.dot
 	dot $(DOCS)/dev/deps.dot -Tpdf >| $(DOCS)/dev/deps.pdf

+ 8 - 7
README.md

@@ -66,9 +66,8 @@ of features as a standalone library:
 - ✓ Serialization and de-serialization to/from N-Triples and N-Quads
 - ✓ Serialization and de-serialization to/from Turtle and TriG
 - ✓ Compile-time configuration of max graph size (efficiency vs. capacity)
--  Lua bindings (on a [separate project](
+-  Lua bindings (on a [separate project](
         https://git.knowledgetx.com/scossu/lsup_lua))
-- ⛌ Python bindings (moved to separate project and temporarily on hold)
 - ⚒ Basic command line utilities
 - ✓ Store interface for custom back end implementations
 - ⚒ POSIX conformance
@@ -79,12 +78,14 @@ of features as a standalone library:
 - Binary protocol for synchronizing remote replicas
 - True plug-in architecture for 3rd-party store implementations
 
-### Likely Out of Scope
+### Out of Scope
 
-(Unless provided and maintained by external contributors)
-
-- JSON-LD de/serialization
-- SPARQL support
+- JSON-LD: overwhelmingly bloated and complicated to understand and implement.
+- SPARQL, SPARUL, GraphQL, etc: they might make sense as separate plug-ins, but
+  this project has a minimalist query approach based on combinations of set
+  operations supported by a scripting language.
+- Python bindings: an initial implementation has been built and then shelved in
+  favor of Lua, due to the complexity and slowness of the Python C API.
 
 ## Building
 

+ 23 - 32
docs/dev/deps.dot

@@ -5,45 +5,36 @@ digraph "source tree" {
     fontsize="16";
     fontname="Helvetica";
 	clusterrank="local";
+	"store_htable" -> "buffer"
+	"store_interface" -> "environment"
+	"graph" -> "store"
 	"environment" -> "bootstrap"
+	"namespace" -> "hashmap"
+	"store_htable" -> "hashmap"
 	"core" -> "log"
-	"parser_nt" -> "tokens_nt"
-	"store" -> "store_mdb"
 	"parser_ttl" -> "codec"
-	"term" -> "namespace"
+	"environment" -> "term"
+	"parser_nt" -> "tokens_nt"
+	"graph" -> "environment"
 	"store" -> "store_htable"
-	"namespace" -> "hashmap"
-	"py_lsup_rdf" -> "py_graph"
-	"lsup_rdf" -> "codec_nt"
-	"graph" -> "store"
-	"term" -> "buffer"
-	"py_term" -> "term"
-	"parser_ttl" -> "tokens_ttl"
-	"py_graph" -> "codec_ttl"
-	"store_htable" -> "hashmap"
-	"store_mdb" -> "store_interface"
-	"buffer" -> "core"
-	"py_term" -> "py_namespace"
-	"parser_nt" -> "codec"
-	"codec_nt" -> "parser_nt"
-	"graph" -> "term"
 	"profile" -> "lsup_rdf"
+	"grammar_ttl" -> "codec"
+	"store" -> "store_mdb"
+	"codec_ttl" -> "parser_ttl"
+	"parser_nt" -> "codec"
+	"term" -> "tpl"
+	"codec" -> "graph"
+	"buffer" -> "core"
+	"store_htable" -> "store_interface"
 	"grammar_nt" -> "codec"
-	"graph" -> "environment"
+	"parser_ttl" -> "tokens_ttl"
 	"lsup_rdf" -> "codec_ttl"
-	"py_graph" -> "graph"
-	"term" -> "tpl"
-	"codec_ttl" -> "parser_ttl"
+	"graph" -> "term"
+	"term" -> "namespace"
 	"namespace" -> "core"
-	"py_graph" -> "codec_nt"
-	"py_triple" -> "py_term"
-	"store_interface" -> "environment"
-	"py_namespace" -> "namespace"
-	"grammar_ttl" -> "codec"
-	"store_htable" -> "buffer"
-	"store_htable" -> "store_interface"
-	"py_graph" -> "py_triple"
-	"environment" -> "term"
+	"codec_nt" -> "parser_nt"
 	"store_mdb" -> "buffer"
-	"codec" -> "graph"
+	"store_mdb" -> "store_interface"
+	"lsup_rdf" -> "codec_nt"
+	"term" -> "buffer"
 }

二进制
docs/dev/deps.pdf


+ 4 - 4
src/codec/Makefile

@@ -23,8 +23,8 @@ DBG_OBJ = $(OBJ:%.o=%_dbg.o)
 
 INCLUDE := -I$(INCLUDE_DIR) -I../../ext/tpl/src -I../../ext/hashmap \
 	-I../../ext/log/src
-CFLAGS = -std=gnu11 -Wall -fPIC $(INCLUDE)
-DBG_CFLAGS = -I../../test -O0 -g3 -DDEBUG
+CFLAGS := -std=gnu11 -Wall -fPIC $(INCLUDE)
+DBG_CFLAGS := $(CFLAGS) -I../../test -O0 -g3 -DDEBUG
 
 .DEFAULT_GOAL := codec
 
@@ -38,10 +38,10 @@ debug: $(DBG_OBJ)
 parsers: $(PARSER_SRC)
 
 $(BUILDDIR)/%.o: %.c
-	$(CC) $(CFLAGS) $(DBG_CFLAGS) -c $^ -o $@
+	$(CC) $(CFLAGS) -c $^ -o $@
 
 $(BUILDDIR)/%_dbg.o: %.c
-	$(CC) $(CFLAGS) $(DBG_CFLAGS) -c $^ -o $@
+	$(CC) $(DBG_CFLAGS) -c $^ -o $@
 
 # Parser C sources.
 parser_%.c: lexer_%.re grammar_%.c ../codec.c