diff --git a/libc3/Makefile b/libc3/Makefile
index 098c476..aa0490d 100644
--- a/libc3/Makefile
+++ b/libc3/Makefile
@@ -17,7 +17,7 @@ CLEANFILES_COV = *.css *.gcda *.html .libs/*.gcda
CLEANFILES += ${CLEANFILES_COV}
-DISTCLEANFILES = ${CLEANFILES} config.mk
+DISTCLEANFILES = ${CLEANFILES} config.h config.mk
build: libc3.la libc3.a
@@ -45,80 +45,9 @@ distclean:
gcovr:
gcovr --gcov-executable ${GCOV} --html-details libc3.html
-GENERATED_FILES = \
- set__fact.c set__fact.h \
- set__tag.c set__tag.h \
- set_cursor__fact.c set_cursor__fact.h \
- set_cursor__tag.c set_cursor__tag.h \
- set_item__fact.c set_item__fact.h \
- set_item__tag.c set_item__tag.h \
- skiplist__fact.c skiplist__fact.h \
- skiplist_node__fact.c skiplist_node__fact.h
-
+include gen.mk
CLEANFILES += ${GENERATED_FILES}
-gen: ${GENERATED_FILES}
-
-SED_FACT = sed \
- -e 's/_NAME[$$]/fact/g' \
- -e 's/_TYPE[$$]/s_fact/g'
-
-set_cursor__fact.h: set_cursor.h.in Makefile
- ${SED_FACT} < set_cursor.h.in > set_cursor__fact.h
-
-set_cursor__fact.c: set_cursor.c.in Makefile
- ${SED_FACT} < set_cursor.c.in > set_cursor__fact.c
-
-set__fact.h: set.h.in Makefile
- ${SED_FACT} < set.h.in > set__fact.h
-
-set__fact.c: set.c.in Makefile
- ${SED_FACT} < set.c.in > set__fact.c
-
-set_item__fact.h: set_item.h.in Makefile
- ${SED_FACT} < set_item.h.in > set_item__fact.h
-
-set_item__fact.c: set_item.c.in Makefile
- ${SED_FACT} < set_item.c.in > set_item__fact.c
-
-SED_FACT_P = sed \
- -e 's/_NAME[$$]/fact/g' \
- -e 's/_TYPE[$$]/s_fact */g'
-
-skiplist__fact.h: skiplist.h.in Makefile
- ${SED_FACT_P} < skiplist.h.in > skiplist__fact.h
-
-skiplist__fact.c: skiplist.c.in Makefile
- ${SED_FACT_P} < skiplist.c.in > skiplist__fact.c
-
-skiplist_node__fact.h: skiplist_node.h.in Makefile
- ${SED_FACT_P} < skiplist_node.h.in > skiplist_node__fact.h
-
-skiplist_node__fact.c: skiplist_node.c.in Makefile
- ${SED_FACT_P} < skiplist_node.c.in > skiplist_node__fact.c
-
-SED_TAG = sed \
- -e 's/_NAME[$$]/tag/g' \
- -e 's/_TYPE[$$]/s_tag/g'
-
-set_cursor__tag.h: set_cursor.h.in Makefile
- ${SED_TAG} < set_cursor.h.in > set_cursor__tag.h
-
-set_cursor__tag.c: set_cursor.c.in Makefile
- ${SED_TAG} < set_cursor.c.in > set_cursor__tag.c
-
-set_item__tag.h: set_item.h.in Makefile
- ${SED_TAG} < set_item.h.in > set_item__tag.h
-
-set_item__tag.c: set_item.c.in Makefile
- ${SED_TAG} < set_item.c.in > set_item__tag.c
-
-set__tag.h: set.h.in Makefile
- ${SED_TAG} < set.h.in > set__tag.h
-
-set__tag.c: set.c.in Makefile
- ${SED_TAG} < set.c.in > set__tag.c
-
install:
${INSTALL} -o ${OWNER} -g ${GROUP} -m 0755 -d ${prefix}/include/c3
${LIBTOOL} --tag=CC --mode=install ${INSTALL} -o ${OWNER} -g ${GROUP} -m 0644 ${HEADERS} ${prefix}/include/c3
diff --git a/libc3/configure b/libc3/configure
index b587afa..8fb70d6 100755
--- a/libc3/configure
+++ b/libc3/configure
@@ -47,6 +47,7 @@ pkg_config libffi
pkg_config libmd
config_include sha_h sys/types.h sha.h HAVE_SHA_H
config_include sha1_h sys/types.h sha1.h HAVE_SHA1_H
+update_config_h
# Address Sanitizer config
CFLAGS_ASAN="$CFLAGS -fsanitize=address -O1 -fno-omit-frame-pointer -g"
@@ -130,5 +131,4 @@ for SRC in $SOURCES; do
echo " ${LIBTOOL} --tag=CC --mode=compile \${CC} \${CPPFLAGS} \${CFLAGS_DEBUG} -c $SRC -o $SRC_DEBUG_LO" >> ${CONFIG_MK}
done
-update_config_h
update_config_mk
diff --git a/libc3/gen.mk b/libc3/gen.mk
new file mode 100644
index 0000000..970cb3e
--- /dev/null
+++ b/libc3/gen.mk
@@ -0,0 +1,86 @@
+## c3
+## Copyright 2022,2023 kmx.io <contact@kmx.io>
+##
+## Permission is hereby granted to use this software excepted
+## on Apple computers granted the above copyright notice and
+## this permission paragraph are included in all copies and
+## substantial portions of this software.
+##
+## THIS SOFTWARE IS PROVIDED "AS-IS" WITHOUT ANY GUARANTEE OF
+## PURPOSE AND PERFORMANCE. IN NO EVENT WHATSOEVER SHALL THE
+## AUTHOR BE CONSIDERED LIABLE FOR THE USE AND PERFORMANCE OF
+## THIS SOFTWARE.
+
+GENERATED_FILES = \
+ set__fact.c set__fact.h \
+ set__tag.c set__tag.h \
+ set_cursor__fact.c set_cursor__fact.h \
+ set_cursor__tag.c set_cursor__tag.h \
+ set_item__fact.c set_item__fact.h \
+ set_item__tag.c set_item__tag.h \
+ skiplist__fact.c skiplist__fact.h \
+ skiplist_node__fact.c skiplist_node__fact.h
+
+gen: ${GENERATED_FILES}
+
+SED_FACT = sed \
+ -e 's/_NAME[$$]/fact/g' \
+ -e 's/_TYPE[$$]/s_fact/g'
+
+set_cursor__fact.h: set_cursor.h.in Makefile
+ ${SED_FACT} < set_cursor.h.in > set_cursor__fact.h
+
+set_cursor__fact.c: set_cursor.c.in Makefile
+ ${SED_FACT} < set_cursor.c.in > set_cursor__fact.c
+
+set__fact.h: set.h.in Makefile
+ ${SED_FACT} < set.h.in > set__fact.h
+
+set__fact.c: set.c.in Makefile
+ ${SED_FACT} < set.c.in > set__fact.c
+
+set_item__fact.h: set_item.h.in Makefile
+ ${SED_FACT} < set_item.h.in > set_item__fact.h
+
+set_item__fact.c: set_item.c.in Makefile
+ ${SED_FACT} < set_item.c.in > set_item__fact.c
+
+SED_FACT_P = sed \
+ -e 's/_NAME[$$]/fact/g' \
+ -e 's/_TYPE[$$]/s_fact */g'
+
+skiplist__fact.h: skiplist.h.in Makefile
+ ${SED_FACT_P} < skiplist.h.in > skiplist__fact.h
+
+skiplist__fact.c: skiplist.c.in Makefile
+ ${SED_FACT_P} < skiplist.c.in > skiplist__fact.c
+
+skiplist_node__fact.h: skiplist_node.h.in Makefile
+ ${SED_FACT_P} < skiplist_node.h.in > skiplist_node__fact.h
+
+skiplist_node__fact.c: skiplist_node.c.in Makefile
+ ${SED_FACT_P} < skiplist_node.c.in > skiplist_node__fact.c
+
+SED_TAG = sed \
+ -e 's/_NAME[$$]/tag/g' \
+ -e 's/_TYPE[$$]/s_tag/g'
+
+set_cursor__tag.h: set_cursor.h.in Makefile
+ ${SED_TAG} < set_cursor.h.in > set_cursor__tag.h
+
+set_cursor__tag.c: set_cursor.c.in Makefile
+ ${SED_TAG} < set_cursor.c.in > set_cursor__tag.c
+
+set_item__tag.h: set_item.h.in Makefile
+ ${SED_TAG} < set_item.h.in > set_item__tag.h
+
+set_item__tag.c: set_item.c.in Makefile
+ ${SED_TAG} < set_item.c.in > set_item__tag.c
+
+set__tag.h: set.h.in Makefile
+ ${SED_TAG} < set.h.in > set__tag.h
+
+set__tag.c: set.c.in Makefile
+ ${SED_TAG} < set.c.in > set__tag.c
+
+include sources.mk
diff --git a/sources.mk b/sources.mk
index 17cf555..831d324 100644
--- a/sources.mk
+++ b/sources.mk
@@ -1,4 +1,4 @@
# sources.mk generated by update_sources
C3_CONFIGURES = c3c/configure c3s/configure c3s/update_sources ic3/configure ic3/update_sources libc3/configure libc3/update_sources test/configure test/update_sources ucd2c/configure libtommath/configure
-C3_MAKEFILES = c3c/Makefile c3s/Makefile ic3/Makefile libc3/Makefile test/Makefile ucd2c/Makefile libtommath/Makefile
-C3_C_SOURCES = c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/ic3.c ic3/linenoise.c libc3/arg.c libc3/arg.h libc3/binding.c libc3/binding.h libc3/bool.c libc3/bool.h libc3/buf.c libc3/buf.h libc3/buf_file.c libc3/buf_file.h libc3/buf_inspect.c libc3/buf_inspect.h libc3/buf_parse.c libc3/buf_parse.h libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/log.h libc3/compare.c libc3/compare.h libc3/buf_save.h libc3/c3.c libc3/c3.h libc3/c_types.h libc3/call.c libc3/call.h libc3/character.c libc3/debug.c libc3/debug.h libc3/env.c libc3/env.h libc3/log.c libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/fact.h libc3/set__fact.c libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/set_item__tag.h libc3/facts.c libc3/facts.h libc3/facts_cursor.c libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/facts_spec_cursor.h libc3/character.h libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/facts_with_cursor.h libc3/fn.c libc3/fn.h libc3/frame.c libc3/frame.h libc3/hash.c libc3/hash.h libc3/ident.c libc3/ident.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/integer.c libc3/integer.h libc3/list.c libc3/list.h libc3/module.h libc3/quote.c libc3/quote.h libc3/types.h libc3/set.c.in libc3/set.h.in libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/str.c libc3/set_item.c.in libc3/set_item.h.in libc3/fact.c libc3/skiplist.c.in libc3/skiplist.h.in libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/sym.c libc3/sym.h libc3/tag.c libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/tag.h test/bool_test.c test/buf_file_test.c test/buf_inspect_test.c test/buf_parse_test.c test/buf_test.c test/call_test.c test/character_test.c test/hash_test.c test/fact_test.c test/fact_test.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/ident_test.c test/libc3_test.c test/tuple_test.c test/list_test.c test/set__fact_test.c test/set__tag_test.c test/compare_test.h test/skiplist__fact_test.c test/str_test.c test/sym_test.c test/tag_test.c test/tag_test.h test/test.c test/test.h test/types_test.c test/compare_test.c ucd2c/ucd.h ucd2c/ucd2c.c
+C3_MAKEFILES = c3c/Makefile c3s/Makefile ic3/Makefile libc3/Makefile libc3/gen.mk test/Makefile ucd2c/Makefile libtommath/Makefile
+C3_C_SOURCES = c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/ic3.c ic3/linenoise.c libc3/arg.c libc3/arg.h libc3/binding.c libc3/binding.h libc3/bool.c libc3/bool.h libc3/set__fact.c libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/buf.c libc3/buf.h libc3/buf_file.c libc3/buf_file.h libc3/buf_inspect.c libc3/buf_inspect.h libc3/buf_parse.c libc3/buf_parse.h libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/log.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/compare.c libc3/compare.h libc3/buf_save.h libc3/c3.c libc3/c3.h libc3/c_types.h libc3/call.c libc3/call.h libc3/character.c libc3/debug.c libc3/debug.h libc3/env.c libc3/env.h libc3/log.c libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/fact.h libc3/facts.c libc3/facts.h libc3/facts_cursor.c libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/facts_spec_cursor.h libc3/character.h libc3/set_item__tag.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/facts_with_cursor.h libc3/fn.c libc3/fn.h libc3/frame.c libc3/frame.h libc3/hash.c libc3/hash.h libc3/ident.c libc3/ident.h libc3/integer.c libc3/integer.h libc3/list.c libc3/list.h libc3/module.h libc3/quote.c libc3/quote.h libc3/types.h libc3/set.c.in libc3/set.h.in libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/str.c libc3/set_item.c.in libc3/set_item.h.in libc3/fact.c libc3/skiplist.c.in libc3/skiplist.h.in libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/sym.c libc3/sym.h libc3/tag.c libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/tag.h test/bool_test.c test/buf_file_test.c test/buf_inspect_test.c test/buf_parse_test.c test/buf_test.c test/call_test.c test/character_test.c test/hash_test.c test/fact_test.c test/fact_test.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/ident_test.c test/libc3_test.c test/tuple_test.c test/list_test.c test/set__fact_test.c test/set__tag_test.c test/compare_test.h test/skiplist__fact_test.c test/str_test.c test/sym_test.c test/tag_test.c test/tag_test.h test/test.c test/test.h test/types_test.c test/compare_test.c ucd2c/ucd.h ucd2c/ucd2c.c
diff --git a/sources.sh b/sources.sh
index f6f6941..9c2bf3a 100644
--- a/sources.sh
+++ b/sources.sh
@@ -1,4 +1,4 @@
# sources.sh generated by update_sources
C3_CONFIGURES='c3c/configure c3s/configure c3s/update_sources ic3/configure ic3/update_sources libc3/configure libc3/update_sources test/configure test/update_sources ucd2c/configure libtommath/configure'
-C3_MAKEFILES='c3c/Makefile c3s/Makefile ic3/Makefile libc3/Makefile test/Makefile ucd2c/Makefile libtommath/Makefile'
-C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/ic3.c ic3/linenoise.c libc3/arg.c libc3/arg.h libc3/binding.c libc3/binding.h libc3/bool.c libc3/bool.h libc3/buf.c libc3/buf.h libc3/buf_file.c libc3/buf_file.h libc3/buf_inspect.c libc3/buf_inspect.h libc3/buf_parse.c libc3/buf_parse.h libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/log.h libc3/compare.c libc3/compare.h libc3/buf_save.h libc3/c3.c libc3/c3.h libc3/c_types.h libc3/call.c libc3/call.h libc3/character.c libc3/debug.c libc3/debug.h libc3/env.c libc3/env.h libc3/log.c libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/fact.h libc3/set__fact.c libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/set_item__tag.h libc3/facts.c libc3/facts.h libc3/facts_cursor.c libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/facts_spec_cursor.h libc3/character.h libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/facts_with_cursor.h libc3/fn.c libc3/fn.h libc3/frame.c libc3/frame.h libc3/hash.c libc3/hash.h libc3/ident.c libc3/ident.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/integer.c libc3/integer.h libc3/list.c libc3/list.h libc3/module.h libc3/quote.c libc3/quote.h libc3/types.h libc3/set.c.in libc3/set.h.in libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/str.c libc3/set_item.c.in libc3/set_item.h.in libc3/fact.c libc3/skiplist.c.in libc3/skiplist.h.in libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/sym.c libc3/sym.h libc3/tag.c libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/tag.h test/bool_test.c test/buf_file_test.c test/buf_inspect_test.c test/buf_parse_test.c test/buf_test.c test/call_test.c test/character_test.c test/hash_test.c test/fact_test.c test/fact_test.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/ident_test.c test/libc3_test.c test/tuple_test.c test/list_test.c test/set__fact_test.c test/set__tag_test.c test/compare_test.h test/skiplist__fact_test.c test/str_test.c test/sym_test.c test/tag_test.c test/tag_test.h test/test.c test/test.h test/types_test.c test/compare_test.c ucd2c/ucd.h ucd2c/ucd2c.c'
+C3_MAKEFILES='c3c/Makefile c3s/Makefile ic3/Makefile libc3/Makefile libc3/gen.mk test/Makefile ucd2c/Makefile libtommath/Makefile'
+C3_C_SOURCES='c3c/c3c.c c3s/buf_readline.c c3s/c3s.c c3s/buf_readline.h ic3/buf_linenoise.c ic3/buf_linenoise.h ic3/ic3.c ic3/linenoise.c libc3/arg.c libc3/arg.h libc3/binding.c libc3/binding.h libc3/bool.c libc3/bool.h libc3/set__fact.c libc3/set__fact.h libc3/set__tag.c libc3/set__tag.h libc3/buf.c libc3/buf.h libc3/buf_file.c libc3/buf_file.h libc3/buf_inspect.c libc3/buf_inspect.h libc3/buf_parse.c libc3/buf_parse.h libc3/buf_parse_c.c libc3/buf_parse_c.h libc3/buf_save.c libc3/log.h libc3/set_cursor__fact.c libc3/set_cursor__fact.h libc3/set_cursor__tag.c libc3/set_cursor__tag.h libc3/set_item__fact.c libc3/set_item__fact.h libc3/set_item__tag.c libc3/compare.c libc3/compare.h libc3/buf_save.h libc3/c3.c libc3/c3.h libc3/c_types.h libc3/call.c libc3/call.h libc3/character.c libc3/debug.c libc3/debug.h libc3/env.c libc3/env.h libc3/log.c libc3/error.c libc3/error.h libc3/error_handler.c libc3/error_handler.h libc3/eval.c libc3/eval.h libc3/fact.h libc3/facts.c libc3/facts.h libc3/facts_cursor.c libc3/facts_cursor.h libc3/facts_spec.c libc3/facts_spec.h libc3/facts_spec_cursor.c libc3/facts_spec_cursor.h libc3/character.h libc3/set_item__tag.h libc3/skiplist__fact.c libc3/skiplist__fact.h libc3/skiplist_node__fact.c libc3/skiplist_node__fact.h libc3/facts_with.c libc3/facts_with.h libc3/facts_with_cursor.c libc3/facts_with_cursor.h libc3/fn.c libc3/fn.h libc3/frame.c libc3/frame.h libc3/hash.c libc3/hash.h libc3/ident.c libc3/ident.h libc3/integer.c libc3/integer.h libc3/list.c libc3/list.h libc3/module.h libc3/quote.c libc3/quote.h libc3/types.h libc3/set.c.in libc3/set.h.in libc3/set_cursor.c.in libc3/set_cursor.h.in libc3/str.c libc3/set_item.c.in libc3/set_item.h.in libc3/fact.c libc3/skiplist.c.in libc3/skiplist.h.in libc3/skiplist_node.c.in libc3/skiplist_node.h.in libc3/str.h libc3/sym.c libc3/sym.h libc3/tag.c libc3/tuple.c libc3/tuple.h libc3/ucd.c libc3/ucd.h libc3/tag.h test/bool_test.c test/buf_file_test.c test/buf_inspect_test.c test/buf_parse_test.c test/buf_test.c test/call_test.c test/character_test.c test/hash_test.c test/fact_test.c test/fact_test.h test/facts_cursor_test.c test/facts_test.c test/facts_with_test.c test/ident_test.c test/libc3_test.c test/tuple_test.c test/list_test.c test/set__fact_test.c test/set__tag_test.c test/compare_test.h test/skiplist__fact_test.c test/str_test.c test/sym_test.c test/tag_test.c test/tag_test.h test/test.c test/test.h test/types_test.c test/compare_test.c ucd2c/ucd.h ucd2c/ucd2c.c'
diff --git a/update_sources b/update_sources
index 5a1284f..2218acb 100755
--- a/update_sources
+++ b/update_sources
@@ -12,7 +12,7 @@ C3_CONFIGURES="${C3_CONFIGURES} libtommath/configure"
echo "C3_CONFIGURES = $C3_CONFIGURES" >> ${SOURCES_MK}
echo "C3_CONFIGURES='$C3_CONFIGURES'" >> ${SOURCES_SH}
-C3_MAKEFILES="$(find c3c c3s ic3 libc3 test ucd2c -name Makefile)"
+C3_MAKEFILES="$(find c3c c3s ic3 libc3 test ucd2c -name Makefile -or -name gen.mk)"
C3_MAKEFILES="$(echo "${C3_MAKEFILES}" | tr '\n' ' ')"
C3_MAKEFILES="${C3_MAKEFILES} libtommath/Makefile"
echo "C3_MAKEFILES = $C3_MAKEFILES" >> ${SOURCES_MK}