From 18d03456d96f7a086a2ccc82ce97fcf056848d90 Mon Sep 17 00:00:00 2001 From: Olivier Matz Date: Mon, 11 Feb 2019 15:39:07 +0100 Subject: [PATCH] add meson support --- Makefile | 87 ----------- examples/meson.build | 5 + examples/parse-yaml/meson.build | 15 ++ examples/{yaml => parse-yaml}/parse-yaml.c | 0 examples/{yaml => parse-yaml}/test.yaml | 0 examples/readline/meson.build | 19 +++ {libecoli => include}/ecoli_assert.h | 0 {libecoli => include}/ecoli_complete.h | 0 {libecoli => include}/ecoli_config.h | 0 .../ecoli_editline.h | 0 {libecoli => include}/ecoli_init.h | 0 {libecoli => include}/ecoli_keyval.h | 0 {libecoli => include}/ecoli_log.h | 0 {libecoli => include}/ecoli_malloc.h | 0 {libecoli => include}/ecoli_murmurhash.h | 0 {libecoli => include}/ecoli_node.h | 0 {libecoli => include}/ecoli_node_any.h | 0 {libecoli => include}/ecoli_node_cmd.h | 0 {libecoli => include}/ecoli_node_dynamic.h | 0 {libecoli => include}/ecoli_node_empty.h | 0 {libecoli => include}/ecoli_node_expr.h | 0 {libecoli => include}/ecoli_node_file.h | 0 {libecoli => include}/ecoli_node_helper.h | 0 {libecoli => include}/ecoli_node_int.h | 0 {libecoli => include}/ecoli_node_many.h | 0 {libecoli => include}/ecoli_node_none.h | 0 {libecoli => include}/ecoli_node_once.h | 0 {libecoli => include}/ecoli_node_option.h | 0 {libecoli => include}/ecoli_node_or.h | 0 {libecoli => include}/ecoli_node_re.h | 0 {libecoli => include}/ecoli_node_re_lex.h | 0 {libecoli => include}/ecoli_node_seq.h | 0 {libecoli => include}/ecoli_node_sh_lex.h | 0 {libecoli => include}/ecoli_node_space.h | 0 {libecoli => include}/ecoli_node_str.h | 0 {libecoli => include}/ecoli_node_subset.h | 0 {libecoli => include}/ecoli_parse.h | 0 {libecoli => include}/ecoli_string.h | 0 {libecoli => include}/ecoli_strvec.h | 0 {libecoli => include}/ecoli_test.h | 0 {libecoli => include}/ecoli_utils.h | 0 {libecoli => include}/ecoli_vec.h | 0 {libecoli_yaml => include}/ecoli_yaml.h | 0 include/meson.build | 41 ++++++ meson.build | 27 ++++ mk/ecoli-ar-rules.mk | 31 ---- mk/ecoli-ar-vars.mk | 51 ------- mk/ecoli-clean-rules.mk | 9 -- mk/ecoli-clean-vars.mk | 13 -- mk/ecoli-copy-rules.mk | 31 ---- mk/ecoli-copy-vars.mk | 50 ------- mk/ecoli-exe-rules.mk | 31 ---- mk/ecoli-exe-vars.mk | 55 ------- mk/ecoli-obj-rules.mk | 59 -------- mk/ecoli-obj-vars.mk | 100 ------------- mk/ecoli-objcopy-rules.mk | 50 ------- mk/ecoli-objcopy-vars.mk | 65 --------- mk/ecoli-post.mk | 84 ----------- mk/ecoli-pre.mk | 18 --- mk/ecoli-shlib-rules.mk | 31 ---- mk/ecoli-shlib-vars.mk | 52 ------- mk/ecoli-slink-rules.mk | 31 ---- mk/ecoli-slink-vars.mk | 50 ------- mk/ecoli-subdir-rules.mk | 6 - mk/ecoli-subdir-vars.mk | 9 -- mk/ecoli-tools.mk | 135 ------------------ mk/ecoli-vars.mk | 23 --- {libecoli => src}/ecoli_assert.c | 0 {libecoli => src}/ecoli_complete.c | 0 {libecoli => src}/ecoli_config.c | 0 {libecoli_editline => src}/ecoli_editline.c | 0 {libecoli => src}/ecoli_init.c | 0 {libecoli => src}/ecoli_keyval.c | 0 {libecoli => src}/ecoli_log.c | 0 {libecoli => src}/ecoli_malloc.c | 0 {libecoli => src}/ecoli_murmurhash.c | 0 {libecoli => src}/ecoli_node.c | 0 {libecoli => src}/ecoli_node_any.c | 0 {libecoli => src}/ecoli_node_cmd.c | 0 {libecoli => src}/ecoli_node_dynamic.c | 0 {libecoli => src}/ecoli_node_empty.c | 0 {libecoli => src}/ecoli_node_expr.c | 0 {libecoli => src}/ecoli_node_expr_test.c | 0 {libecoli => src}/ecoli_node_file.c | 0 {libecoli => src}/ecoli_node_helper.c | 0 {libecoli => src}/ecoli_node_int.c | 0 {libecoli => src}/ecoli_node_many.c | 0 {libecoli => src}/ecoli_node_none.c | 0 {libecoli => src}/ecoli_node_once.c | 0 {libecoli => src}/ecoli_node_option.c | 0 {libecoli => src}/ecoli_node_or.c | 0 {libecoli => src}/ecoli_node_re.c | 0 {libecoli => src}/ecoli_node_re_lex.c | 0 {libecoli => src}/ecoli_node_seq.c | 0 {libecoli => src}/ecoli_node_sh_lex.c | 0 {libecoli => src}/ecoli_node_space.c | 0 {libecoli => src}/ecoli_node_str.c | 0 {libecoli => src}/ecoli_node_subset.c | 0 {libecoli => src}/ecoli_parse.c | 0 {libecoli => src}/ecoli_string.c | 0 {libecoli => src}/ecoli_strvec.c | 0 {libecoli => src}/ecoli_test.c | 0 {libecoli => src}/ecoli_vec.c | 0 {libecoli_yaml => src}/ecoli_yaml.c | 0 {libecoli_editline => src}/editline.c | 0 src/meson.build | 50 +++++++ test/meson.build | 15 ++ todo.txt | 16 +++ 108 files changed, 188 insertions(+), 1071 deletions(-) delete mode 100644 Makefile create mode 100644 examples/meson.build create mode 100644 examples/parse-yaml/meson.build rename examples/{yaml => parse-yaml}/parse-yaml.c (100%) rename examples/{yaml => parse-yaml}/test.yaml (100%) create mode 100644 examples/readline/meson.build rename {libecoli => include}/ecoli_assert.h (100%) rename {libecoli => include}/ecoli_complete.h (100%) rename {libecoli => include}/ecoli_config.h (100%) rename {libecoli_editline => include}/ecoli_editline.h (100%) rename {libecoli => include}/ecoli_init.h (100%) rename {libecoli => include}/ecoli_keyval.h (100%) rename {libecoli => include}/ecoli_log.h (100%) rename {libecoli => include}/ecoli_malloc.h (100%) rename {libecoli => include}/ecoli_murmurhash.h (100%) rename {libecoli => include}/ecoli_node.h (100%) rename {libecoli => include}/ecoli_node_any.h (100%) rename {libecoli => include}/ecoli_node_cmd.h (100%) rename {libecoli => include}/ecoli_node_dynamic.h (100%) rename {libecoli => include}/ecoli_node_empty.h (100%) rename {libecoli => include}/ecoli_node_expr.h (100%) rename {libecoli => include}/ecoli_node_file.h (100%) rename {libecoli => include}/ecoli_node_helper.h (100%) rename {libecoli => include}/ecoli_node_int.h (100%) rename {libecoli => include}/ecoli_node_many.h (100%) rename {libecoli => include}/ecoli_node_none.h (100%) rename {libecoli => include}/ecoli_node_once.h (100%) rename {libecoli => include}/ecoli_node_option.h (100%) rename {libecoli => include}/ecoli_node_or.h (100%) rename {libecoli => include}/ecoli_node_re.h (100%) rename {libecoli => include}/ecoli_node_re_lex.h (100%) rename {libecoli => include}/ecoli_node_seq.h (100%) rename {libecoli => include}/ecoli_node_sh_lex.h (100%) rename {libecoli => include}/ecoli_node_space.h (100%) rename {libecoli => include}/ecoli_node_str.h (100%) rename {libecoli => include}/ecoli_node_subset.h (100%) rename {libecoli => include}/ecoli_parse.h (100%) rename {libecoli => include}/ecoli_string.h (100%) rename {libecoli => include}/ecoli_strvec.h (100%) rename {libecoli => include}/ecoli_test.h (100%) rename {libecoli => include}/ecoli_utils.h (100%) rename {libecoli => include}/ecoli_vec.h (100%) rename {libecoli_yaml => include}/ecoli_yaml.h (100%) create mode 100644 include/meson.build create mode 100644 meson.build delete mode 100644 mk/ecoli-ar-rules.mk delete mode 100644 mk/ecoli-ar-vars.mk delete mode 100644 mk/ecoli-clean-rules.mk delete mode 100644 mk/ecoli-clean-vars.mk delete mode 100644 mk/ecoli-copy-rules.mk delete mode 100644 mk/ecoli-copy-vars.mk delete mode 100644 mk/ecoli-exe-rules.mk delete mode 100644 mk/ecoli-exe-vars.mk delete mode 100644 mk/ecoli-obj-rules.mk delete mode 100644 mk/ecoli-obj-vars.mk delete mode 100644 mk/ecoli-objcopy-rules.mk delete mode 100644 mk/ecoli-objcopy-vars.mk delete mode 100644 mk/ecoli-post.mk delete mode 100644 mk/ecoli-pre.mk delete mode 100644 mk/ecoli-shlib-rules.mk delete mode 100644 mk/ecoli-shlib-vars.mk delete mode 100644 mk/ecoli-slink-rules.mk delete mode 100644 mk/ecoli-slink-vars.mk delete mode 100644 mk/ecoli-subdir-rules.mk delete mode 100644 mk/ecoli-subdir-vars.mk delete mode 100644 mk/ecoli-tools.mk delete mode 100644 mk/ecoli-vars.mk rename {libecoli => src}/ecoli_assert.c (100%) rename {libecoli => src}/ecoli_complete.c (100%) rename {libecoli => src}/ecoli_config.c (100%) rename {libecoli_editline => src}/ecoli_editline.c (100%) rename {libecoli => src}/ecoli_init.c (100%) rename {libecoli => src}/ecoli_keyval.c (100%) rename {libecoli => src}/ecoli_log.c (100%) rename {libecoli => src}/ecoli_malloc.c (100%) rename {libecoli => src}/ecoli_murmurhash.c (100%) rename {libecoli => src}/ecoli_node.c (100%) rename {libecoli => src}/ecoli_node_any.c (100%) rename {libecoli => src}/ecoli_node_cmd.c (100%) rename {libecoli => src}/ecoli_node_dynamic.c (100%) rename {libecoli => src}/ecoli_node_empty.c (100%) rename {libecoli => src}/ecoli_node_expr.c (100%) rename {libecoli => src}/ecoli_node_expr_test.c (100%) rename {libecoli => src}/ecoli_node_file.c (100%) rename {libecoli => src}/ecoli_node_helper.c (100%) rename {libecoli => src}/ecoli_node_int.c (100%) rename {libecoli => src}/ecoli_node_many.c (100%) rename {libecoli => src}/ecoli_node_none.c (100%) rename {libecoli => src}/ecoli_node_once.c (100%) rename {libecoli => src}/ecoli_node_option.c (100%) rename {libecoli => src}/ecoli_node_or.c (100%) rename {libecoli => src}/ecoli_node_re.c (100%) rename {libecoli => src}/ecoli_node_re_lex.c (100%) rename {libecoli => src}/ecoli_node_seq.c (100%) rename {libecoli => src}/ecoli_node_sh_lex.c (100%) rename {libecoli => src}/ecoli_node_space.c (100%) rename {libecoli => src}/ecoli_node_str.c (100%) rename {libecoli => src}/ecoli_node_subset.c (100%) rename {libecoli => src}/ecoli_parse.c (100%) rename {libecoli => src}/ecoli_string.c (100%) rename {libecoli => src}/ecoli_strvec.c (100%) rename {libecoli => src}/ecoli_test.c (100%) rename {libecoli => src}/ecoli_vec.c (100%) rename {libecoli_yaml => src}/ecoli_yaml.c (100%) rename {libecoli_editline => src}/editline.c (100%) create mode 100644 src/meson.build create mode 100644 test/meson.build diff --git a/Makefile b/Makefile deleted file mode 100644 index 8ccd7e2..0000000 --- a/Makefile +++ /dev/null @@ -1,87 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2016, Olivier MATZ - -ECOLI ?= $(abspath .) -include $(ECOLI)/mk/ecoli-pre.mk - -# output path with trailing slash -O ?= build/ - -# XXX -O0 -CFLAGS = -g -O0 -Wall -Werror -W -Wextra -fPIC -Wmissing-prototypes -CFLAGS += -Ilibecoli -Ilibecoli_yaml -Ilibecoli_editline - -# XXX coverage -CFLAGS += --coverage -LDFLAGS += --coverage -# rm -rf build; rm -rf result; make && ./build/test -# lcov -d build -c -t build/test -o test.info && genhtml -o result test.info - - -srcs := -srcs += ecoli_assert.c -srcs += ecoli_complete.c -srcs += ecoli_config.c -srcs += ecoli_keyval.c -srcs += ecoli_init.c -srcs += ecoli_log.c -srcs += ecoli_malloc.c -srcs += ecoli_murmurhash.c -srcs += ecoli_strvec.c -srcs += ecoli_test.c -srcs += ecoli_node.c -srcs += ecoli_node_any.c -srcs += ecoli_node_cmd.c -srcs += ecoli_node_empty.c -srcs += ecoli_node_expr.c -srcs += ecoli_node_expr_test.c -srcs += ecoli_node_dynamic.c -srcs += ecoli_node_file.c -srcs += ecoli_node_helper.c -srcs += ecoli_node_int.c -srcs += ecoli_node_many.c -srcs += ecoli_node_none.c -srcs += ecoli_node_once.c -srcs += ecoli_node_option.c -srcs += ecoli_node_or.c -srcs += ecoli_node_re.c -srcs += ecoli_node_re_lex.c -srcs += ecoli_node_seq.c -srcs += ecoli_node_sh_lex.c -srcs += ecoli_node_space.c -srcs += ecoli_node_str.c -srcs += ecoli_node_subset.c -srcs += ecoli_parse.c -srcs += ecoli_string.c -srcs += ecoli_vec.c - -# libs -shlib-y-$(O)libecoli.so := $(addprefix libecoli/,$(srcs)) - -cflags-$(O)libecoli_yaml.so = -Ilibecoli_yaml -shlib-y-$(O)libecoli_yaml.so := libecoli_yaml/ecoli_yaml.c - -cflags-$(O)libecoli_editline.so = -Ilibecoli_editline -shlib-y-$(O)libecoli_editline.so := libecoli_editline/ecoli_editline.c - -# tests -ldflags-$(O)test = -rdynamic -exe-y-$(O)test = $(addprefix libecoli/,$(srcs)) test/test.c - -# examples -ldflags-$(O)readline = -lreadline -ltermcap -exe-y-$(O)readline = $(addprefix libecoli/,$(srcs)) \ - examples/readline/main.c - -ldflags-$(O)parse-yaml = -lyaml -ledit -exe-y-$(O)parse-yaml = $(addprefix libecoli/,$(srcs)) \ - libecoli_yaml/ecoli_yaml.c libecoli_editline/ecoli_editline.c\ - examples/yaml/parse-yaml.c - -include $(ECOLI)/mk/ecoli-post.mk - -all: _ecoli_all - -clean: _ecoli_clean - -.PHONY: clean all diff --git a/examples/meson.build b/examples/meson.build new file mode 100644 index 0000000..1435bfe --- /dev/null +++ b/examples/meson.build @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018, Olivier MATZ + +subdir('readline') +subdir('parse-yaml') diff --git a/examples/parse-yaml/meson.build b/examples/parse-yaml/meson.build new file mode 100644 index 0000000..118fdc3 --- /dev/null +++ b/examples/parse-yaml/meson.build @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018, Olivier MATZ + +inc = include_directories('../../include') + +parse_yaml_sources = [ + 'parse-yaml.c', +] + +ecoli_parse_yaml = executable( + 'ecoli-parse-yaml', + parse_yaml_sources, + include_directories : inc, + link_with : libecoli, + dependencies: [yaml_dep, edit_dep]) diff --git a/examples/yaml/parse-yaml.c b/examples/parse-yaml/parse-yaml.c similarity index 100% rename from examples/yaml/parse-yaml.c rename to examples/parse-yaml/parse-yaml.c diff --git a/examples/yaml/test.yaml b/examples/parse-yaml/test.yaml similarity index 100% rename from examples/yaml/test.yaml rename to examples/parse-yaml/test.yaml diff --git a/examples/readline/meson.build b/examples/readline/meson.build new file mode 100644 index 0000000..513c85c --- /dev/null +++ b/examples/readline/meson.build @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018, Olivier MATZ + +inc = include_directories('../../include') + +readline_sources = [ + 'main.c', +] + +c_compiler = meson.get_compiler('c') +readline = c_compiler.find_library('readline', required: false) +if readline.found() + ecoli_readline = executable( + 'ecoli-readline', + readline_sources, + include_directories : inc, + link_with : libecoli, + dependencies: readline) +endif diff --git a/libecoli/ecoli_assert.h b/include/ecoli_assert.h similarity index 100% rename from libecoli/ecoli_assert.h rename to include/ecoli_assert.h diff --git a/libecoli/ecoli_complete.h b/include/ecoli_complete.h similarity index 100% rename from libecoli/ecoli_complete.h rename to include/ecoli_complete.h diff --git a/libecoli/ecoli_config.h b/include/ecoli_config.h similarity index 100% rename from libecoli/ecoli_config.h rename to include/ecoli_config.h diff --git a/libecoli_editline/ecoli_editline.h b/include/ecoli_editline.h similarity index 100% rename from libecoli_editline/ecoli_editline.h rename to include/ecoli_editline.h diff --git a/libecoli/ecoli_init.h b/include/ecoli_init.h similarity index 100% rename from libecoli/ecoli_init.h rename to include/ecoli_init.h diff --git a/libecoli/ecoli_keyval.h b/include/ecoli_keyval.h similarity index 100% rename from libecoli/ecoli_keyval.h rename to include/ecoli_keyval.h diff --git a/libecoli/ecoli_log.h b/include/ecoli_log.h similarity index 100% rename from libecoli/ecoli_log.h rename to include/ecoli_log.h diff --git a/libecoli/ecoli_malloc.h b/include/ecoli_malloc.h similarity index 100% rename from libecoli/ecoli_malloc.h rename to include/ecoli_malloc.h diff --git a/libecoli/ecoli_murmurhash.h b/include/ecoli_murmurhash.h similarity index 100% rename from libecoli/ecoli_murmurhash.h rename to include/ecoli_murmurhash.h diff --git a/libecoli/ecoli_node.h b/include/ecoli_node.h similarity index 100% rename from libecoli/ecoli_node.h rename to include/ecoli_node.h diff --git a/libecoli/ecoli_node_any.h b/include/ecoli_node_any.h similarity index 100% rename from libecoli/ecoli_node_any.h rename to include/ecoli_node_any.h diff --git a/libecoli/ecoli_node_cmd.h b/include/ecoli_node_cmd.h similarity index 100% rename from libecoli/ecoli_node_cmd.h rename to include/ecoli_node_cmd.h diff --git a/libecoli/ecoli_node_dynamic.h b/include/ecoli_node_dynamic.h similarity index 100% rename from libecoli/ecoli_node_dynamic.h rename to include/ecoli_node_dynamic.h diff --git a/libecoli/ecoli_node_empty.h b/include/ecoli_node_empty.h similarity index 100% rename from libecoli/ecoli_node_empty.h rename to include/ecoli_node_empty.h diff --git a/libecoli/ecoli_node_expr.h b/include/ecoli_node_expr.h similarity index 100% rename from libecoli/ecoli_node_expr.h rename to include/ecoli_node_expr.h diff --git a/libecoli/ecoli_node_file.h b/include/ecoli_node_file.h similarity index 100% rename from libecoli/ecoli_node_file.h rename to include/ecoli_node_file.h diff --git a/libecoli/ecoli_node_helper.h b/include/ecoli_node_helper.h similarity index 100% rename from libecoli/ecoli_node_helper.h rename to include/ecoli_node_helper.h diff --git a/libecoli/ecoli_node_int.h b/include/ecoli_node_int.h similarity index 100% rename from libecoli/ecoli_node_int.h rename to include/ecoli_node_int.h diff --git a/libecoli/ecoli_node_many.h b/include/ecoli_node_many.h similarity index 100% rename from libecoli/ecoli_node_many.h rename to include/ecoli_node_many.h diff --git a/libecoli/ecoli_node_none.h b/include/ecoli_node_none.h similarity index 100% rename from libecoli/ecoli_node_none.h rename to include/ecoli_node_none.h diff --git a/libecoli/ecoli_node_once.h b/include/ecoli_node_once.h similarity index 100% rename from libecoli/ecoli_node_once.h rename to include/ecoli_node_once.h diff --git a/libecoli/ecoli_node_option.h b/include/ecoli_node_option.h similarity index 100% rename from libecoli/ecoli_node_option.h rename to include/ecoli_node_option.h diff --git a/libecoli/ecoli_node_or.h b/include/ecoli_node_or.h similarity index 100% rename from libecoli/ecoli_node_or.h rename to include/ecoli_node_or.h diff --git a/libecoli/ecoli_node_re.h b/include/ecoli_node_re.h similarity index 100% rename from libecoli/ecoli_node_re.h rename to include/ecoli_node_re.h diff --git a/libecoli/ecoli_node_re_lex.h b/include/ecoli_node_re_lex.h similarity index 100% rename from libecoli/ecoli_node_re_lex.h rename to include/ecoli_node_re_lex.h diff --git a/libecoli/ecoli_node_seq.h b/include/ecoli_node_seq.h similarity index 100% rename from libecoli/ecoli_node_seq.h rename to include/ecoli_node_seq.h diff --git a/libecoli/ecoli_node_sh_lex.h b/include/ecoli_node_sh_lex.h similarity index 100% rename from libecoli/ecoli_node_sh_lex.h rename to include/ecoli_node_sh_lex.h diff --git a/libecoli/ecoli_node_space.h b/include/ecoli_node_space.h similarity index 100% rename from libecoli/ecoli_node_space.h rename to include/ecoli_node_space.h diff --git a/libecoli/ecoli_node_str.h b/include/ecoli_node_str.h similarity index 100% rename from libecoli/ecoli_node_str.h rename to include/ecoli_node_str.h diff --git a/libecoli/ecoli_node_subset.h b/include/ecoli_node_subset.h similarity index 100% rename from libecoli/ecoli_node_subset.h rename to include/ecoli_node_subset.h diff --git a/libecoli/ecoli_parse.h b/include/ecoli_parse.h similarity index 100% rename from libecoli/ecoli_parse.h rename to include/ecoli_parse.h diff --git a/libecoli/ecoli_string.h b/include/ecoli_string.h similarity index 100% rename from libecoli/ecoli_string.h rename to include/ecoli_string.h diff --git a/libecoli/ecoli_strvec.h b/include/ecoli_strvec.h similarity index 100% rename from libecoli/ecoli_strvec.h rename to include/ecoli_strvec.h diff --git a/libecoli/ecoli_test.h b/include/ecoli_test.h similarity index 100% rename from libecoli/ecoli_test.h rename to include/ecoli_test.h diff --git a/libecoli/ecoli_utils.h b/include/ecoli_utils.h similarity index 100% rename from libecoli/ecoli_utils.h rename to include/ecoli_utils.h diff --git a/libecoli/ecoli_vec.h b/include/ecoli_vec.h similarity index 100% rename from libecoli/ecoli_vec.h rename to include/ecoli_vec.h diff --git a/libecoli_yaml/ecoli_yaml.h b/include/ecoli_yaml.h similarity index 100% rename from libecoli_yaml/ecoli_yaml.h rename to include/ecoli_yaml.h diff --git a/include/meson.build b/include/meson.build new file mode 100644 index 0000000..ea33eb4 --- /dev/null +++ b/include/meson.build @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018, Olivier MATZ + +libecoli_headers = [ + 'ecoli_assert.h', + 'ecoli_complete.h', + 'ecoli_config.h', + 'ecoli_init.h', + 'ecoli_keyval.h', + 'ecoli_log.h', + 'ecoli_malloc.h', + 'ecoli_murmurhash.h', + 'ecoli_node_any.h', + 'ecoli_node_cmd.h', + 'ecoli_node_dynamic.h', + 'ecoli_node_empty.h', + 'ecoli_node_expr.h', + 'ecoli_node_file.h', + 'ecoli_node.h', + 'ecoli_node_helper.h', + 'ecoli_node_int.h', + 'ecoli_node_many.h', + 'ecoli_node_none.h', + 'ecoli_node_once.h', + 'ecoli_node_option.h', + 'ecoli_node_or.h', + 'ecoli_node_re.h', + 'ecoli_node_re_lex.h', + 'ecoli_node_seq.h', + 'ecoli_node_sh_lex.h', + 'ecoli_node_space.h', + 'ecoli_node_str.h', + 'ecoli_node_subset.h', + 'ecoli_parse.h', + 'ecoli_string.h', + 'ecoli_strvec.h', + 'ecoli_test.h', + 'ecoli_utils.h', + 'ecoli_vec.h', +] +install_headers(libecoli_headers) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..dee9cb6 --- /dev/null +++ b/meson.build @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018, Olivier MATZ + +project('libecoli', + 'c', + version : '0.1', + license : 'BSD-3-clause') + +# if debug +add_global_arguments('-Wall', language : 'c') +add_global_arguments('-Werror', language : 'c') +add_global_arguments('-W', language : 'c') +add_global_arguments('-Wextra', language : 'c') + +edit_dep = dependency('libedit', method: 'pkg-config') +yaml_dep = dependency('yaml-0.1', method: 'pkg-config') + +subdir('src') +subdir('test') +subdir('examples') + +pkg_mod = import('pkgconfig') +pkg_mod.generate(libraries : libecoli, + version: '0.1', + name : 'libecoli', + filebase : 'libecoli', + description : 'Extensible command line library.') diff --git a/mk/ecoli-ar-rules.mk b/mk/ecoli-ar-rules.mk deleted file mode 100644 index 9121d4f..0000000 --- a/mk/ecoli-ar-rules.mk +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# dump some infos if debug is enabled -ifeq ($(D),1) -$(call disp_list,------ all-ar,$(all-ar)) -$(foreach ar,$(all-ar),\ - $(info,out-$(ar): $(out-$(ar))) \ - $(call disp_list,pre-$(ar),$(pre-$(ar))) \ -) -endif - -# include dependencies and commands files if they exist -$(foreach ar,$(all-ar),\ - $(eval -include $(call depfile,$(ar))) \ - $(eval -include $(call cmdfile,$(ar))) \ -) - -# remove duplicates -filtered-all-ar := $(sort $(all-ar)) - -# link several objects files into one shared object -$(filtered-all-ar): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,\ - $(call ar_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call ar_cmd,$(pre-$(@)),$@),$?),\ - $(call ar_print_cmd,$(pre-$(@)),$@) && \ - $(call ar_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call ar_cmd,$(pre-$(@)),$@),$@) && \ - $(call create_empty_depfile,$@)) diff --git a/mk/ecoli-ar-vars.mk b/mk/ecoli-ar-vars.mk deleted file mode 100644 index 0a06b26..0000000 --- a/mk/ecoli-ar-vars.mk +++ /dev/null @@ -1,51 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# ar-y-$(ar) is provided by the user -# $(ar) is the path of the static library, and the variable contains -# the list of sources. Several ar-y-$(ar) can be present. - -# list all ar builds requested by user -all-ar := $(patsubst ar-y-%,%,$(filter ar-y-%,$(.VARIABLES))) - -# add them to the list of targets -all-targets += $(all-ar) - -# for each ar, create the following variables: -# out-$(ar) = output path of the arcutable -# pre-$(ar) = list of prerequisites for this arcutable -# Some source files need intermediate objects, we define these variables -# for them too, and add them in a list: $(all-iobj). -# Last, we add the generated files in $(all-clean-file). -$(foreach ar,$(all-ar),\ - $(eval out-$(ar) := $(dir $(ar))) \ - $(eval pre-$(ar) := ) \ - $(foreach src,$(ar-y-$(ar)), \ - $(if $(call is_cc_source,$(src)), \ - $(eval iobj := $(call src2iobj,$(src),$(out-$(ar)))) \ - $(eval pre-$(iobj) := $(src)) \ - $(eval all-iobj += $(iobj)) \ - $(eval all-clean-file += $(iobj)) \ - $(eval pre-$(ar) += $(iobj)) \ - , \ - $(if $(call is_obj_source,$(src)),\ - $(eval pre-$(ar) += $(src)) \ - , \ - $(error "unsupported source format: $(src)"))) \ - )\ - $(eval all-clean-file += $(ar)) \ -) - -# link several *.o files into a static libary -# $1: sources (*.o) -# $2: dst (xyz.a) -ar_cmd = ar crsD $(2) $(1) - -# print line used to ar object files -ifeq ($(V),1) -ar_print_cmd = echo $(call protect_quote,$(call ar_cmd,$1,$2)) -else -ar_print_cmd = echo " AR $(2)" -endif - -all-clean-file += $(all-ar) diff --git a/mk/ecoli-clean-rules.mk b/mk/ecoli-clean-rules.mk deleted file mode 100644 index 6cdf02b..0000000 --- a/mk/ecoli-clean-rules.mk +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -.PHONY: _ecoli_clean -_ecoli_clean: $(all-clean-target) FORCE - @$(call clean_print_cmd,$(all-clean-file) $(call depfile,$(all-clean-file)) \ - $(call cmdfile,$(all-clean-file))) && \ - $(call clean_cmd,$(all-clean-file) $(call depfile,$(all-clean-file)) \ - $(call cmdfile,$(all-clean-file))) diff --git a/mk/ecoli-clean-vars.mk b/mk/ecoli-clean-vars.mk deleted file mode 100644 index 6b47154..0000000 --- a/mk/ecoli-clean-vars.mk +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# remove files -# $1: files -clean_cmd = rm -rf $(1) - -# print line used to clean files -ifeq ($(V),1) -clean_print_cmd = echo $(call protect_quote,$(call clean_cmd,$1)) -else -clean_print_cmd = echo " CLEAN $(CURDIR)" -endif diff --git a/mk/ecoli-copy-rules.mk b/mk/ecoli-copy-rules.mk deleted file mode 100644 index 3c3c43b..0000000 --- a/mk/ecoli-copy-rules.mk +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# dump some infos if debug is enabled -ifeq ($(D),1) -$(call disp_list,------ all-copy,$(all-copy)) -$(foreach copy,$(all-copy),\ - $(info,out-$(copy): $(out-$(copy))) \ - $(call disp_list,pre-$(copy),$(pre-$(copy))) \ -) -endif - -# include dependencies and commands files if they exist -$(foreach copy,$(all-copy),\ - $(eval -include $(call depfile,$(copy))) \ - $(eval -include $(call cmdfile,$(copy))) \ -) - -# remove duplicates -filtered-all-copy := $(sort $(all-copy)) - -# convert format of executable -$(filtered-all-copy): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,\ - $(call copy_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call copy_cmd,$(pre-$(@)),$@),$?),\ - $(call copy_print_cmd,$(pre-$(@)),$@) && \ - $(call copy_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call copy_cmd,$(pre-$(@)),$@),$@) && \ - $(call create_empty_depfile,$@)) diff --git a/mk/ecoli-copy-vars.mk b/mk/ecoli-copy-vars.mk deleted file mode 100644 index d6230d7..0000000 --- a/mk/ecoli-copy-vars.mk +++ /dev/null @@ -1,50 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# copy a file -# copy-y-$(copy) is provided by the user -# $(copy) is the path of the directory containing the destination -# files, and the variable contains the path of the files to copy. Several -# copy-y-$(copy) can be present. - -# list all path requested by user -_all-copy := $(patsubst copy-y-%,%,$(filter copy-y-%,$(.VARIABLES))) -all-copy := - -# for each copy, create the following variables: -# out-$(copy) = output path of the executable -# pre-$(copy) = list of prerequisites for this executable -# We also add the files in $(all-copy). -$(foreach copy,$(_all-copy),\ - $(if $(notdir $(copy)), \ - $(if $(call compare,$(words $(copy-y-$(copy))),1), \ - $(error "only one source file is allowed in copy-y-$(copy)")) \ - $(eval dst := $(dir $(copy))$(notdir $(copy-y-$(copy)))) \ - $(eval out-$(copy) := $(dir $(copy))) \ - $(eval pre-$(copy) := $(copy-y-$(copy))) \ - $(eval all-copy += $(dst)) \ - , \ - $(foreach src,$(copy-y-$(copy)),\ - $(eval dst := $(copy)$(notdir $(src))) \ - $(eval out-$(copy) := $(copy)) \ - $(eval pre-$(dst) := $(src)) \ - $(eval all-copy += $(dst)) \ - ) \ - ) \ -) - -# add them to the list of targets and clean -all-targets += $(all-copy) -all-clean-file += $(all-copy) - -# convert format of executable from elf to ihex -# $1: source executable (elf) -# $2: destination file -copy_cmd = $(CP) $(1) $(2) - -# print line used to convert executable format -ifeq ($(V),1) -copy_print_cmd = echo $(call protect_quote,$(call copy_cmd,$1,$2)) -else -copy_print_cmd = echo " COPY $(2)" -endif diff --git a/mk/ecoli-exe-rules.mk b/mk/ecoli-exe-rules.mk deleted file mode 100644 index 71b7ed1..0000000 --- a/mk/ecoli-exe-rules.mk +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# dump some infos if debug is enabled -ifeq ($(D),1) -$(call disp_list,------ all-exe,$(all-exe)) -$(foreach exe,$(all-exe),\ - $(info,out-$(exe): $(out-$(exe))) \ - $(call disp_list,pre-$(exe),$(pre-$(exe))) \ -) -endif - -# include dependencies and commands files if they exist -$(foreach exe,$(all-exe),\ - $(eval -include $(call depfile,$(exe))) \ - $(eval -include $(call cmdfile,$(exe))) \ -) - -# remove duplicates -filtered-all-exe := $(sort $(all-exe)) - -# link several objects files into one executable -$(filtered-all-exe): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,\ - $(call link_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call link_cmd,$(pre-$(@)),$@),$?),\ - $(call link_print_cmd,$(pre-$(@)),$@) && \ - $(call link_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call link_cmd,$(pre-$(@)),$@),$@) && \ - $(call create_empty_depfile,$@)) diff --git a/mk/ecoli-exe-vars.mk b/mk/ecoli-exe-vars.mk deleted file mode 100644 index 1e5ae16..0000000 --- a/mk/ecoli-exe-vars.mk +++ /dev/null @@ -1,55 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# exe-y-$(exe) is provided by the user -# $(exe) is the path of the binary, and the variable contains -# the list of sources. Several exe-y-$(exe) can be present. - -# list all exe builds requested by user -all-exe := $(patsubst exe-y-%,%,$(filter exe-y-%,$(.VARIABLES))) - -# add them to the list of targets -all-targets += $(all-exe) - -# for each exe, create the following variables: -# out-$(exe) = output path of the executable -# pre-$(exe) = list of prerequisites for this executable -# Some source files need intermediate objects, we define these variables -# for them too, and add them in a list: $(all-iobj). -# Last, we add the generated files in $(all-clean-file). -$(foreach exe,$(all-exe),\ - $(eval out-$(exe) := $(dir $(exe))) \ - $(eval pre-$(exe) := ) \ - $(foreach src,$(exe-y-$(exe)), \ - $(if $(call is_cc_source,$(src)), \ - $(eval iobj := $(call src2iobj,$(src),$(out-$(exe)))) \ - $(eval pre-$(iobj) := $(src)) \ - $(eval all-iobj += $(iobj)) \ - $(eval all-clean-file += $(iobj)) \ - $(eval pre-$(exe) += $(iobj)) \ - , \ - $(if $(call is_obj_source,$(src)),\ - $(eval pre-$(exe) += $(src)) \ - , \ - $(if $(call is_alib_source,$(src)),\ - $(eval pre-$(exe) += $(src)) \ - , \ - $(error "unsupported source format: $(src)")))) \ - )\ - $(eval all-clean-file += $(exe)) \ -) - -# link several *.o files into a exeary -# $1: sources (*.o) (*.a) -# $2: dst (xyz.o too) -link_cmd = $(CC) $(LDFLAGS) $(ldflags-$(2)) -o $(2) $(filter %.o,$(1)) \ - $(filter %.a,$(1)) $(LDLIBS) $(ldlibs-$(2)) - -# print line used to link object files -ifeq ($(V),1) -link_print_cmd = echo $(call protect_quote,$(call link_cmd,$1,$2)) -else -link_print_cmd = echo " EXE $(2)" -endif - -all-clean-file += $(all-exe) diff --git a/mk/ecoli-obj-rules.mk b/mk/ecoli-obj-rules.mk deleted file mode 100644 index 24c606f..0000000 --- a/mk/ecoli-obj-rules.mk +++ /dev/null @@ -1,59 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# dump some infos if debug is enabled -ifeq ($(D),1) -$(call disp_list,------ all-obj,$(all-obj)) -$(foreach obj,$(all-obj),\ - $(info,out-$(obj): $(out-$(obj))) \ - $(call disp_list,pre-$(obj),$(pre-$(obj))) \ -) -$(call disp_list,------ all-iobj,$(all-iobj)) -$(foreach iobj,$(all-iobj),\ - $(call disp_list,pre-$(iobj),$(pre-$(iobj))) \ -) -endif - -# if a generated file has the same name than a user target, -# generate an error -conflicts := $(filter $(all-iobj),$(all-targets)) -$(if $(conflicts), \ - $(error Intermediate file has the same names than user targets:\ - $(conflicts))) - -# include dependencies and commands files if they exist -$(foreach obj,$(all-obj),\ - $(eval -include $(call depfile,$(obj))) \ - $(eval -include $(call cmdfile,$(obj))) \ -) -$(foreach iobj,$(all-iobj),\ - $(eval -include $(call depfile,$(iobj))) \ - $(eval -include $(call cmdfile,$(iobj))) \ -) - -# remove duplicates -filtered-all-iobj := $(sort $(all-iobj)) - -# convert source files to intermediate object file -$(filtered-all-iobj): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,$(call compile_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call compile_cmd,$(pre-$(@)),$@),$?),\ - $(call compile_print_cmd,$(pre-$(@)),$@) && \ - $(call compile_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call compile_cmd,$(pre-$(@)),$@),$@) && \ - $(call obj-fixdep,$@)) - -# remove duplicates -filtered-all-obj := $(sort $(all-obj)) - -# combine several objects files to one -$(filtered-all-obj): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,\ - $(call combine_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call combine_cmd,$(pre-$(@)),$@),$?),\ - $(call combine_print_cmd,$(pre-$(@)),$@) && \ - $(call combine_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call combine_cmd,$(pre-$(@)),$@),$@) && \ - $(call create_empty_depfile,$@)) diff --git a/mk/ecoli-obj-vars.mk b/mk/ecoli-obj-vars.mk deleted file mode 100644 index b6fe847..0000000 --- a/mk/ecoli-obj-vars.mk +++ /dev/null @@ -1,100 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# obj-y-$(obj) is provided by the user -# $(obj) is the path of the object, and the variable contains -# the list of sources. Several obj-y-$(obj) can be present. - -# list all object builds requested by user -all-obj := $(patsubst obj-y-%,%,$(filter obj-y-%,$(.VARIABLES))) - -# add them to the list of targets -all-targets += $(all-obj) - -# convert source path to intermediate object path, and filter -# objects from sources -# $1: list of source paths -# $2: output directory (including trailing slash) -# return: list of intermediate object paths -src2iobj = $(addprefix $(filter-out ./,$(2)),$(notdir $(strip \ - $(patsubst %.c,%.o,\ - $(patsubst %.s,%.o,\ - $(filter-out %.o,$(1))))))) - -# return the file if it matches a extension that is built with cc -# $1: source file -is_cc_source = $(filter %.c %.s %S,$(1)) - -# return the file if it's already an object file: in this case no -# intermediate object is needed -# $1: source file -is_obj_source = $(filter %.o,$(1)) - -# return the file if it's a static library -# $1: source file -is_alib_source = $(filter %.a,$(1)) - -# for each obj, create the following variables: -# out-$(obj) = output path of the object -# pre-$(obj) = list of prerequisites for this object -# Some source files need intermediate objects, we define these variables -# for them too, and add them in a list: $(all-iobj). -# Last, we add the generated files in $(all-clean-file). -$(foreach obj,$(all-obj),\ - $(eval out-$(obj) := $(dir $(obj))) \ - $(eval pre-$(obj) := ) \ - $(foreach src,$(obj-y-$(obj)), \ - $(if $(call is_cc_source,$(src)), \ - $(eval iobj := $(call src2iobj,$(src),$(out-$(obj)))) \ - $(eval pre-$(iobj) := $(src)) \ - $(eval all-iobj += $(iobj)) \ - $(eval all-clean-file += $(iobj)) \ - $(eval pre-$(obj) += $(iobj)) \ - , \ - $(if $(call is_obj_source,$(src)),\ - $(eval pre-$(obj) += $(src)) \ - , \ - $(error "unsupported source format: $(src)"))) \ - )\ - $(eval all-clean-file += $(obj)) \ -) - -# fix the format of .o.d.tmp (generated by gcc) to a .o.d that defines -# dependencies as makefile variables -# $1: object file (.o) -obj-fixdep = if [ -f $(call file2tmpdep,$(1)) ]; then\ - echo -n "dep-$(1) = " > $(call depfile,$(1)) && \ - sed 's,^[^ ][^:]*: ,,' $(call file2tmpdep,$(1)) >> $(call depfile,$(1)) && \ - rm -f $(call file2tmpdep,$(1)); \ - else \ - $(call create_empty_depfile,$(1)); \ - fi - -# compile a file -# $1: sources -# $2: dst -compile_cmd = $(CC) -Wp,-MD,$(call file2tmpdep,$(2)) \ - $(CPPFLAGS) $(cppflags-$(2)) \ - $(CFLAGS) $(cflags-$(2)) \ - -c -o $2 $1 - -# print line used to compile a file -ifeq ($(V),1) -compile_print_cmd = echo $(call protect_quote,$(call compile_cmd,$1,$2)) -else -compile_print_cmd = echo " CC $(2)" -endif - -# combine several *.o files into one -# $1: sources (*.o) -# $2: dst (xyz.o too) -combine_cmd = $(LD) -r $(1) -o $(2) - -# print line used to combine object files -ifeq ($(V),1) -combine_print_cmd = echo $(call protect_quote,$(call combine_cmd,$1,$2)) -else -combine_print_cmd = echo " LD $(2)" -endif - -all-clean-file += $(all-obj) diff --git a/mk/ecoli-objcopy-rules.mk b/mk/ecoli-objcopy-rules.mk deleted file mode 100644 index ebe9306..0000000 --- a/mk/ecoli-objcopy-rules.mk +++ /dev/null @@ -1,50 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# dump some infos if debug is enabled -ifeq ($(D),1) -$(call disp_list,------ all-objcopy-hex,$(all-objcopy-hex)) -$(foreach objcopy,$(all-objcopy-hex),\ - $(info,out-$(objcopy): $(out-$(objcopy))) \ - $(call disp_list,pre-$(objcopy),$(pre-$(objcopy))) \ -) -$(call disp_list,------ all-objcopy-bin,$(all-objcopy-bin)) -$(foreach objcopy,$(all-objcopy-bin),\ - $(info,out-$(objcopy): $(out-$(objcopy))) \ - $(call disp_list,pre-$(objcopy),$(pre-$(objcopy))) \ -) -endif - -# include dependencies and commands files if they exist -$(foreach objcopy,$(all-objcopy-hex) $(all-objcopy-bin),\ - $(eval -include $(call depfile,$(objcopy))) \ - $(eval -include $(call cmdfile,$(objcopy))) \ -) - -# remove duplicates -filtered-all-objcopy-hex := $(sort $(all-objcopy-hex)) - -# convert format of executable -$(filtered-all-objcopy-hex): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,\ - $(call objcopy_hex_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call objcopy_hex_cmd,$(pre-$(@)),$@),$?),\ - $(call objcopy_print_cmd,$(pre-$(@)),$@) && \ - $(call objcopy_hex_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call objcopy_hex_cmd,$(pre-$(@)),$@),$@) && \ - $(call create_empty_depfile,$@)) - -# remove duplicates -filtered-all-objcopy-bin := $(sort $(all-objcopy-bin)) - -# convert format of executable -$(filtered-all-objcopy-bin): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,\ - $(call objcopy_bin_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call objcopy_bin_cmd,$(pre-$(@)),$@),$?),\ - $(call objcopy_print_cmd,$(pre-$(@)),$@) && \ - $(call objcopy_bin_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call objcopy_bin_cmd,$(pre-$(@)),$@),$@) && \ - $(call create_empty_depfile,$@)) diff --git a/mk/ecoli-objcopy-vars.mk b/mk/ecoli-objcopy-vars.mk deleted file mode 100644 index 0a4b486..0000000 --- a/mk/ecoli-objcopy-vars.mk +++ /dev/null @@ -1,65 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# objcopy changes the format of a binary -# objcopy-hex-y-$(objcopy), objcopy-bin-y-$(objcopy) are provided by the user -# $(objcopy) is the path of the binary, and the variable contains -# the path to the elf. Several objcopy-y-$(objcopy) can be present. - -# list all executable builds requested by user -all-objcopy-hex := $(patsubst objcopy-hex-y-%,%,$(filter objcopy-hex-y-%,$(.VARIABLES))) -all-objcopy-bin := $(patsubst objcopy-bin-y-%,%,$(filter objcopy-bin-y-%,$(.VARIABLES))) - -# add them to the list of targets -all-targets += $(all-objcopy-hex) $(all-objcopy-bin) - -# for each objcopy, create the following variables: -# out-$(objcopy) = output path of the executable -# pre-$(objcopy) = list of prerequisites for this executable -# We also add the generated files in $(all-clean-file). -$(foreach objcopy,$(all-objcopy-hex),\ - $(if $(call compare,$(words $(objcopy-hex-y-$(objcopy))),1),\ - $(error "only one source file is allowed in objcopy-hex-y-$(objcopy)")) \ - $(eval out-$(objcopy) := $(dir $(objcopy))) \ - $(eval pre-$(objcopy) := $(objcopy-hex-y-$(objcopy))) \ - $(eval all-clean-file += $(objcopy)) \ -) - -# for each objcopy, create the following variables: -# out-$(objcopy) = output path of the executable -# pre-$(objcopy) = list of prerequisites for this executable -# We also add the generated files in $(all-clean-file). -$(foreach objcopy,$(all-objcopy-bin),\ - $(if $(call compare,$(words $(objcopy-bin-y-$(objcopy))),1),\ - $(error "only one source file is allowed in objcopy-bin-y-$(objcopy)")) \ - $(eval out-$(objcopy) := $(dir $(objcopy))) \ - $(eval pre-$(objcopy) := $(objcopy-bin-y-$(objcopy))) \ - $(eval all-clean-file += $(objcopy)) \ -) - -# convert format of executable from elf to ihex -# $1: source executable (elf) -# $2: destination file -objcopy_hex_cmd = $(OBJCOPY) -O ihex $(1) $(2) - -# print line used to convert executable format -ifeq ($(V),1) -objcopy_print_cmd = echo $(call protect_quote,$(call objcopy_hex_cmd,$1,$2)) -else -objcopy_print_cmd = echo " OBJCOPY $(2)" -endif - -# convert format of executable from elf to binary -# $1: source executable (elf) -# $2: destination file -objcopy_bin_cmd = $(OBJCOPY) -O binary $(1) $(2) - -# print line used to convert executable format -ifeq ($(V),1) -objcopy_print_cmd = echo $(call protect_quote,$(call objcopy_bin_cmd,$1,$2)) -else -objcopy_print_cmd = echo " OBJCOPY $(2)" -endif - -# XXX dup ? -all-clean-file += $(all-objcopy-hex) $(all-objcopy-bin) diff --git a/mk/ecoli-post.mk b/mk/ecoli-post.mk deleted file mode 100644 index 7430673..0000000 --- a/mk/ecoli-post.mk +++ /dev/null @@ -1,84 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# ---- variables that must be defined: -# -# ECOLI: path to ecoli root -# -# ---- variable that can be defined anywhere -# -# CROSS: prefix of the toolchain -# CP, LN, GAWK, GREP: coreutils tools -# CC, CPP, AR, LD, OBJCOPY, OBJDUMP, STRIP: compilers/binutils -# -# ---- variable that can be defined by Makefile: -# -# obj-y-$(path) -# exe-y-$(path) -# ar-y-$(path) -# shlib-y-$(path) -# copy-y-$(path) -# slink-y-$(path) -# objcopy-y-$(path) -# subdir-y -# -# CPPFLAGS, CFLAGS, LDFLAGS, LDLIBS: global flags -# cflags-$(path), cppflags-$(path), ldflags-$(path), ldlibs-$(path): per -# file flags -# mkflags-$(path): flags for subdirectories -# -# ---- variables that can be defined on the command line: -# -# EXTRA_CPPFLAGS, EXTRA_CFLAGS, EXTRA_LDFLAGS, EXTRA_LDLIBS: global -# extra flags -# extra-cflags-$(path), extra-cppflags-$(path): per object extra flags - -ifeq ($(ECOLI),) -$(error ECOLI environment variable is not defined) -endif - -# list of targets asked by user -all-targets := -# list of files generated -all-clean-file := - -# usual internal variables: -# out-$(file) = output path of a generated file -# pre-$(file) = list of files needed to generate $(file) -# all-type = list of targets for this type - -include $(ECOLI)/mk/ecoli-obj-vars.mk -include $(ECOLI)/mk/ecoli-exe-vars.mk -include $(ECOLI)/mk/ecoli-ar-vars.mk -include $(ECOLI)/mk/ecoli-shlib-vars.mk -include $(ECOLI)/mk/ecoli-copy-vars.mk -include $(ECOLI)/mk/ecoli-slink-vars.mk -include $(ECOLI)/mk/ecoli-objcopy-vars.mk -include $(ECOLI)/mk/ecoli-subdir-vars.mk -# must stay at the end -include $(ECOLI)/mk/ecoli-clean-vars.mk - -# dump the list of targets -ifeq ($(D),1) -$(call disp_list,------ all-targets,$(all-targets)) -endif - -# first rule (default) -.PHONY: _ecoli_all -_ecoli_all: $(all-targets) - -# the includes below require second expansion -.SECONDEXPANSION: - -include $(ECOLI)/mk/ecoli-obj-rules.mk -include $(ECOLI)/mk/ecoli-exe-rules.mk -include $(ECOLI)/mk/ecoli-ar-rules.mk -include $(ECOLI)/mk/ecoli-shlib-rules.mk -include $(ECOLI)/mk/ecoli-copy-rules.mk -include $(ECOLI)/mk/ecoli-slink-rules.mk -include $(ECOLI)/mk/ecoli-objcopy-rules.mk -include $(ECOLI)/mk/ecoli-subdir-rules.mk -include $(ECOLI)/mk/ecoli-clean-rules.mk - -.PHONY: FORCE -FORCE: diff --git a/mk/ecoli-pre.mk b/mk/ecoli-pre.mk deleted file mode 100644 index 1d56ec2..0000000 --- a/mk/ecoli-pre.mk +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# ---- variables that must be defined: -# -# ECOLI: path to ecoli root -# - -ifeq ($(ECOLI),) -$(error ECOLI environment variable is not defined) -endif - -MAKEFLAGS += --no-print-directory - -include $(ECOLI)/mk/ecoli-tools.mk - -include $(ECOLI)/mk/ecoli-vars.mk - diff --git a/mk/ecoli-shlib-rules.mk b/mk/ecoli-shlib-rules.mk deleted file mode 100644 index b03d2a7..0000000 --- a/mk/ecoli-shlib-rules.mk +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# dump some infos if debug is enabled -ifeq ($(D),1) -$(call disp_list,------ all-shlib,$(all-shlib)) -$(foreach shlib,$(all-shlib),\ - $(info,out-$(shlib): $(out-$(shlib))) \ - $(call disp_list,pre-$(shlib),$(pre-$(shlib))) \ -) -endif - -# include dependencies and commands files if they exist -$(foreach shlib,$(all-shlib),\ - $(eval -include $(call depfile,$(shlib))) \ - $(eval -include $(call cmdfile,$(shlib))) \ -) - -# remove duplicates -filtered-all-shlib := $(sort $(all-shlib)) - -# link several objects files into one shared object -$(filtered-all-shlib): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,\ - $(call shlib_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call shlib_cmd,$(pre-$(@)),$@),$?),\ - $(call shlib_print_cmd,$(pre-$(@)),$@) && \ - $(call shlib_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call shlib_cmd,$(pre-$(@)),$@),$@) && \ - $(call create_empty_depfile,$@)) diff --git a/mk/ecoli-shlib-vars.mk b/mk/ecoli-shlib-vars.mk deleted file mode 100644 index 55b982c..0000000 --- a/mk/ecoli-shlib-vars.mk +++ /dev/null @@ -1,52 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# shlib-y-$(shlib) is provided by the user -# $(shlib) is the path of the shared library, and the variable -# contains the list of sources. Several shlib-y-$(shlib) can be -# present. - -# list all shlib builds requested by user -all-shlib := $(patsubst shlib-y-%,%,$(filter shlib-y-%,$(.VARIABLES))) - -# add them to the list of targets -all-targets += $(all-shlib) - -# for each shlib, create the following variables: -# out-$(shlib) = output path of the shlibcutable -# pre-$(shlib) = list of prerequisites for this shlibcutable -# Some source files need intermediate objects, we define these variables -# for them too, and add them in a list: $(all-iobj). -# Last, we add the generated files in $(all-clean-file). -$(foreach shlib,$(all-shlib),\ - $(eval out-$(shlib) := $(dir $(shlib))) \ - $(eval pre-$(shlib) := ) \ - $(foreach src,$(shlib-y-$(shlib)), \ - $(if $(call is_cc_source,$(src)), \ - $(eval iobj := $(call src2iobj,$(src),$(out-$(shlib)))) \ - $(eval pre-$(iobj) := $(src)) \ - $(eval all-iobj += $(iobj)) \ - $(eval all-clean-file += $(iobj)) \ - $(eval pre-$(shlib) += $(iobj)) \ - , \ - $(if $(call is_obj_source,$(src)),\ - $(eval pre-$(shlib) += $(src)) \ - , \ - $(error "unsupported source format: $(src)"))) \ - )\ - $(eval all-clean-file += $(shlib)) \ -) - -# link several *.o files into a shared libary -# $1: sources (*.o) -# $2: dst (xyz.so) -shlib_cmd = $(CC) $(LDFLAGS) $(ldflags-$(2)) -shared -o $(2) $(1) - -# print line used to shlib object files -ifeq ($(V),1) -shlib_print_cmd = echo $(call protect_quote,$(call shlib_cmd,$1,$2)) -else -shlib_print_cmd = echo " SHLIB $(2)" -endif - -all-clean-file += $(all-shlib) diff --git a/mk/ecoli-slink-rules.mk b/mk/ecoli-slink-rules.mk deleted file mode 100644 index f91a09a..0000000 --- a/mk/ecoli-slink-rules.mk +++ /dev/null @@ -1,31 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# dump some infos if debug is enabled -ifeq ($(D),1) -$(call disp_list,------ all-slink,$(all-slink)) -$(foreach slink,$(all-slink),\ - $(info,out-$(slink): $(out-$(slink))) \ - $(call disp_list,pre-$(slink),$(pre-$(slink))) \ -) -endif - -# include dependencies and commands files if they exist -$(foreach slink,$(all-slink),\ - $(eval -include $(call depfile,$(slink))) \ - $(eval -include $(call cmdfile,$(slink))) \ -) - -# remove duplicates -filtered-all-slink := $(sort $(all-slink)) - -# convert format of executable -$(filtered-all-slink): $$(pre-$$@) $$(wildcard $$(dep-$$@)) FORCE - @[ -d $(dir $@) ] || mkdir -p $(dir $@) - @$(call display_deps,$(pre-$(@)),$@,\ - $(call slink_cmd,$(pre-$(@)),$@),$?) - @$(if $(call check_deps,$@,$(call slink_cmd,$(pre-$(@)),$@),$?),\ - $(call slink_print_cmd,$(pre-$(@)),$@) && \ - $(call slink_cmd,$(pre-$(@)),$@) && \ - $(call save_cmd,$(call slink_cmd,$(pre-$(@)),$@),$@) && \ - $(call create_empty_depfile,$@)) diff --git a/mk/ecoli-slink-vars.mk b/mk/ecoli-slink-vars.mk deleted file mode 100644 index 1559a98..0000000 --- a/mk/ecoli-slink-vars.mk +++ /dev/null @@ -1,50 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# create a symbolic link of a file -# slink-y-$(slink) is provided by the user -# $(slink) is the path of the directory containing the destination -# files, and the variable contains the path of the files to linked. Several -# slink-y-$(slink) can be present. - -# list all path requested by user -_all-slink := $(patsubst slink-y-%,%,$(filter slink-y-%,$(.VARIABLES))) -all-slink := - -# for each slink, create the following variables: -# out-$(slink) = output path of the executable -# pre-$(slink) = list of prerequisites for this executable -# We also add the files in $(all-slink). -$(foreach slink,$(_all-slink),\ - $(if $(notdir $(slink)), \ - $(if $(call compare,$(words $(slink-y-$(slink))),1), \ - $(error "only one source file is allowed in slink-y-$(slink)")) \ - $(eval dst := $(dir $(slink))$(notdir $(slink-y-$(slink)))) \ - $(eval out-$(slink) := $(dir $(slink))) \ - $(eval pre-$(slink) := $(slink-y-$(slink))) \ - $(eval all-slink += $(dst)) \ - , \ - $(foreach src,$(slink-y-$(slink)),\ - $(eval dst := $(slink)$(notdir $(src))) \ - $(eval out-$(slink) := $(slink)) \ - $(eval pre-$(dst) := $(src)) \ - $(eval all-slink += $(dst)) \ - ) \ - ) \ -) - -# add them to the list of targets and clean -all-targets += $(all-slink) -all-clean-file += $(all-slink) - -# convert format of executable from elf to ihex -# $1: source executable (elf) -# $2: destination file -slink_cmd = $(LN) -nsf $(abspath $(1)) $(2) - -# print line used to convert executable format -ifeq ($(V),1) -slink_print_cmd = echo $(call protect_quote,$(call slink_cmd,$1,$2)) -else -slink_print_cmd = echo " SLINK $(2)" -endif diff --git a/mk/ecoli-subdir-rules.mk b/mk/ecoli-subdir-rules.mk deleted file mode 100644 index c80166b..0000000 --- a/mk/ecoli-subdir-rules.mk +++ /dev/null @@ -1,6 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -.PHONY: $(subdir-y) -$(subdir-y): FORCE - $(Q)$(MAKE) -C $(@) $(mkflags-$(@)) $(MAKECMDGOALS) diff --git a/mk/ecoli-subdir-vars.mk b/mk/ecoli-subdir-vars.mk deleted file mode 100644 index 4190595..0000000 --- a/mk/ecoli-subdir-vars.mk +++ /dev/null @@ -1,9 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# subdir-y is provided by the user -# it contains the list of directory to build - -# add them to the list of targets -all-targets += $(subdir-y) -all-clean-target += $(subdir-y) diff --git a/mk/ecoli-tools.mk b/mk/ecoli-tools.mk deleted file mode 100644 index 93be008..0000000 --- a/mk/ecoli-tools.mk +++ /dev/null @@ -1,135 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -empty:= -space:= $(empty) $(empty) -indent:= $(space)$(space) - -# define a newline char, useful for debugging with $(info) -define newline - - -endef - -# $(prefix shell commands with $(Q) to silent them, except if V=1 -Q=@ -ifeq ("$(V)-$(origin V)", "1-command line") -Q= -endif - -# set variable $1 to $2 if the variable has an implicit value or -# is not defined -# $1 variable name -# $2 new variable content -set_default = $(if \ - $(call not,$(or \ - $(compare $(origin $(1)),default), \ - $(compare $(origin $(1)),undefined) \ - )),\ - $(eval $(1) = $(2)) \ -) - -# display a list -# $1 title -# $2 list -disp_list = $(info $(1)$(newline)\ - $(addsuffix $(newline),$(addprefix $(space),$(2)))) - -# add a dot in front of the file name -# $1 list of paths -# return: full paths with files prefixed by a dot -dotfile = $(strip $(foreach f,$(1),\ - $(join $(dir $f),.$(notdir $f)))) - -# convert source/obj files into dot-dep filename -# $1 list of paths -# return: full paths with files prefixed by a dot and suffixed with .d -depfile = $(strip $(call dotfile,$(addsuffix .d,$(1)))) - -# convert source/obj files into dot-dep filename -# $1 list of paths -# return: full paths with files prefixed by a dot and suffixed with .d.tmp -file2tmpdep = $(strip $(call dotfile,$(addsuffix .d.tmp,$(1)))) - -# convert source/obj files into dot-cmd filename -# $1 list of paths -# return: full paths with files prefixed by a dot and suffixed with .cmd -cmdfile = $(strip $(call dotfile,$(addsuffix .cmd,$(1)))) - -# add a \ before each quote -protect_quote = $(subst ','\'',$(1)) -#'# editor syntax highlight fix - -# return an non-empty string if $1 is empty, and vice versa -# $1 a string -not = $(if $1,,true) - -# return 1 if parameter is a non-empty string, else 0 -boolean = $(if $1,1,0) - -# return an empty string if string are equal -compare = $(strip $(subst $(1),,$(2)) $(subst $(2),,$(1))) - -# return a non-empty string if a file does not exist -# $1: file -file_missing = $(call compare,$(wildcard $1),$1) - -# return a non-empty string if cmdline changed -# $1: file to be built -# $2: the command to build it -cmdline_changed = $(call compare,$(strip $(cmd-$(1))),$(strip $(2))) - -# return an non-empty string if the .d file does not exist -# $1: the dep file (.d) -depfile_missing = $(call compare,$(wildcard $(1)),$(1)) - -# return a non-empty string if, according to dep-xyz variable, a file -# needed to build $1 does not exist. In this case we need to rebuild -# the file and the .d file. -# $1: file to be built -dep-missing = $(call compare,$(wildcard $(dep-$(1))),$(dep-$(1))) - -# return an empty string if no prereq is newer than target -# $1: list of prerequisites newer than target ($?) -dep-newer = $(strip $(filter-out FORCE,$(1))) - -# display why a file should be re-built -# $1: source files -# $2: dst file -# $3: build command -# $4: all prerequisites newer than target ($?) -ifeq ($(D),1) -display_deps = \ - echo -n "$1 -> $2 " ; \ - echo -n "file_missing=$(call boolean,$(call file_missing,$(2))) " ; \ - echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(2),$(3))) " ; \ - echo -n "depfile_missing=$(call boolean,$(call depfile_missing,$(call depfile,$(2)))) " ; \ - echo -n "dep-missing=$(call boolean,$(call dep-missing,$(2))) " ; \ - echo "dep-newer=$(call boolean,$(call dep-newer,$(4)))" -else -display_deps= -endif - -# return an empty string if a file should be rebuilt -# $1: dst file -# $2: build command -# $3: all prerequisites newer than target ($?) -check_deps = \ - $(or $(call file_missing,$(1)),\ - $(call cmdline_changed,$(1),$(2)),\ - $(call depfile_missing,$(call depfile,$(1))),\ - $(call dep-missing,$(1)),\ - $(call dep-newer,$(3))) - -# create a depfile (.d) with no additional deps -# $1: object file (.o) -create_empty_depfile = echo "dep-$(1) =" > $(call depfile,$(1)) - -# save a command in a file -# $1: command to build the file -# $2: name of the file -save_cmd = echo "cmd-$(2) = $(call protect_quote,$(1))" > $(call cmdfile,$(2)) - -# remove the FORCE target from the list of all prerequisites $+ -# no arguments, use $+ -prereq = $(filter-out FORCE,$(+)) diff --git a/mk/ecoli-vars.mk b/mk/ecoli-vars.mk deleted file mode 100644 index 7c69466..0000000 --- a/mk/ecoli-vars.mk +++ /dev/null @@ -1,23 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause -# Copyright 2015, Olivier MATZ - -# core tools -CP ?= cp -LN ?= ln -GAWK ?= gawk -GREP ?= grep -# compiler and binutils, set_default overrides mk implicit value -# but not command line or standard variables -$(call set_default,CC,$(CROSS)gcc) -$(call set_default,CPP,$(CROSS)cpp) -$(call set_default,AR,$(CROSS)ar) -$(call set_default,LD,$(CROSS)ld) -$(call set_default,OBJCOPY,$(CROSS)objcopy) -$(call set_default,OBJDUMP,$(CROSS)objdump) -$(call set_default,STRIP,$(CROSS)strip) -HOSTCC ?= cc - -CFLAGS += $(EXTRA_CFLAGS) -CPPFLAGS += $(EXTRA_CPPFLAGS) -LDFLAGS += $(EXTRA_LDFLAGS) -LDLIBS += $(EXTRA_LDLIBS) diff --git a/libecoli/ecoli_assert.c b/src/ecoli_assert.c similarity index 100% rename from libecoli/ecoli_assert.c rename to src/ecoli_assert.c diff --git a/libecoli/ecoli_complete.c b/src/ecoli_complete.c similarity index 100% rename from libecoli/ecoli_complete.c rename to src/ecoli_complete.c diff --git a/libecoli/ecoli_config.c b/src/ecoli_config.c similarity index 100% rename from libecoli/ecoli_config.c rename to src/ecoli_config.c diff --git a/libecoli_editline/ecoli_editline.c b/src/ecoli_editline.c similarity index 100% rename from libecoli_editline/ecoli_editline.c rename to src/ecoli_editline.c diff --git a/libecoli/ecoli_init.c b/src/ecoli_init.c similarity index 100% rename from libecoli/ecoli_init.c rename to src/ecoli_init.c diff --git a/libecoli/ecoli_keyval.c b/src/ecoli_keyval.c similarity index 100% rename from libecoli/ecoli_keyval.c rename to src/ecoli_keyval.c diff --git a/libecoli/ecoli_log.c b/src/ecoli_log.c similarity index 100% rename from libecoli/ecoli_log.c rename to src/ecoli_log.c diff --git a/libecoli/ecoli_malloc.c b/src/ecoli_malloc.c similarity index 100% rename from libecoli/ecoli_malloc.c rename to src/ecoli_malloc.c diff --git a/libecoli/ecoli_murmurhash.c b/src/ecoli_murmurhash.c similarity index 100% rename from libecoli/ecoli_murmurhash.c rename to src/ecoli_murmurhash.c diff --git a/libecoli/ecoli_node.c b/src/ecoli_node.c similarity index 100% rename from libecoli/ecoli_node.c rename to src/ecoli_node.c diff --git a/libecoli/ecoli_node_any.c b/src/ecoli_node_any.c similarity index 100% rename from libecoli/ecoli_node_any.c rename to src/ecoli_node_any.c diff --git a/libecoli/ecoli_node_cmd.c b/src/ecoli_node_cmd.c similarity index 100% rename from libecoli/ecoli_node_cmd.c rename to src/ecoli_node_cmd.c diff --git a/libecoli/ecoli_node_dynamic.c b/src/ecoli_node_dynamic.c similarity index 100% rename from libecoli/ecoli_node_dynamic.c rename to src/ecoli_node_dynamic.c diff --git a/libecoli/ecoli_node_empty.c b/src/ecoli_node_empty.c similarity index 100% rename from libecoli/ecoli_node_empty.c rename to src/ecoli_node_empty.c diff --git a/libecoli/ecoli_node_expr.c b/src/ecoli_node_expr.c similarity index 100% rename from libecoli/ecoli_node_expr.c rename to src/ecoli_node_expr.c diff --git a/libecoli/ecoli_node_expr_test.c b/src/ecoli_node_expr_test.c similarity index 100% rename from libecoli/ecoli_node_expr_test.c rename to src/ecoli_node_expr_test.c diff --git a/libecoli/ecoli_node_file.c b/src/ecoli_node_file.c similarity index 100% rename from libecoli/ecoli_node_file.c rename to src/ecoli_node_file.c diff --git a/libecoli/ecoli_node_helper.c b/src/ecoli_node_helper.c similarity index 100% rename from libecoli/ecoli_node_helper.c rename to src/ecoli_node_helper.c diff --git a/libecoli/ecoli_node_int.c b/src/ecoli_node_int.c similarity index 100% rename from libecoli/ecoli_node_int.c rename to src/ecoli_node_int.c diff --git a/libecoli/ecoli_node_many.c b/src/ecoli_node_many.c similarity index 100% rename from libecoli/ecoli_node_many.c rename to src/ecoli_node_many.c diff --git a/libecoli/ecoli_node_none.c b/src/ecoli_node_none.c similarity index 100% rename from libecoli/ecoli_node_none.c rename to src/ecoli_node_none.c diff --git a/libecoli/ecoli_node_once.c b/src/ecoli_node_once.c similarity index 100% rename from libecoli/ecoli_node_once.c rename to src/ecoli_node_once.c diff --git a/libecoli/ecoli_node_option.c b/src/ecoli_node_option.c similarity index 100% rename from libecoli/ecoli_node_option.c rename to src/ecoli_node_option.c diff --git a/libecoli/ecoli_node_or.c b/src/ecoli_node_or.c similarity index 100% rename from libecoli/ecoli_node_or.c rename to src/ecoli_node_or.c diff --git a/libecoli/ecoli_node_re.c b/src/ecoli_node_re.c similarity index 100% rename from libecoli/ecoli_node_re.c rename to src/ecoli_node_re.c diff --git a/libecoli/ecoli_node_re_lex.c b/src/ecoli_node_re_lex.c similarity index 100% rename from libecoli/ecoli_node_re_lex.c rename to src/ecoli_node_re_lex.c diff --git a/libecoli/ecoli_node_seq.c b/src/ecoli_node_seq.c similarity index 100% rename from libecoli/ecoli_node_seq.c rename to src/ecoli_node_seq.c diff --git a/libecoli/ecoli_node_sh_lex.c b/src/ecoli_node_sh_lex.c similarity index 100% rename from libecoli/ecoli_node_sh_lex.c rename to src/ecoli_node_sh_lex.c diff --git a/libecoli/ecoli_node_space.c b/src/ecoli_node_space.c similarity index 100% rename from libecoli/ecoli_node_space.c rename to src/ecoli_node_space.c diff --git a/libecoli/ecoli_node_str.c b/src/ecoli_node_str.c similarity index 100% rename from libecoli/ecoli_node_str.c rename to src/ecoli_node_str.c diff --git a/libecoli/ecoli_node_subset.c b/src/ecoli_node_subset.c similarity index 100% rename from libecoli/ecoli_node_subset.c rename to src/ecoli_node_subset.c diff --git a/libecoli/ecoli_parse.c b/src/ecoli_parse.c similarity index 100% rename from libecoli/ecoli_parse.c rename to src/ecoli_parse.c diff --git a/libecoli/ecoli_string.c b/src/ecoli_string.c similarity index 100% rename from libecoli/ecoli_string.c rename to src/ecoli_string.c diff --git a/libecoli/ecoli_strvec.c b/src/ecoli_strvec.c similarity index 100% rename from libecoli/ecoli_strvec.c rename to src/ecoli_strvec.c diff --git a/libecoli/ecoli_test.c b/src/ecoli_test.c similarity index 100% rename from libecoli/ecoli_test.c rename to src/ecoli_test.c diff --git a/libecoli/ecoli_vec.c b/src/ecoli_vec.c similarity index 100% rename from libecoli/ecoli_vec.c rename to src/ecoli_vec.c diff --git a/libecoli_yaml/ecoli_yaml.c b/src/ecoli_yaml.c similarity index 100% rename from libecoli_yaml/ecoli_yaml.c rename to src/ecoli_yaml.c diff --git a/libecoli_editline/editline.c b/src/editline.c similarity index 100% rename from libecoli_editline/editline.c rename to src/editline.c diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..4c9860f --- /dev/null +++ b/src/meson.build @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018, Olivier MATZ + +inc = include_directories('../include') + +libecoli_sources = [ + 'ecoli_assert.c', + 'ecoli_complete.c', + 'ecoli_config.c', + 'ecoli_editline.c', + 'ecoli_init.c', + 'ecoli_keyval.c', + 'ecoli_log.c', + 'ecoli_malloc.c', + 'ecoli_murmurhash.c', + 'ecoli_node_any.c', + 'ecoli_node.c', + 'ecoli_node_cmd.c', +# 'ecoli_node_cond.c', + 'ecoli_node_dynamic.c', + 'ecoli_node_empty.c', + 'ecoli_node_expr.c', + 'ecoli_node_expr_test.c', + 'ecoli_node_file.c', + 'ecoli_node_helper.c', + 'ecoli_node_int.c', + 'ecoli_node_many.c', + 'ecoli_node_none.c', + 'ecoli_node_once.c', + 'ecoli_node_option.c', + 'ecoli_node_or.c', + 'ecoli_node_re.c', + 'ecoli_node_re_lex.c', + 'ecoli_node_seq.c', + 'ecoli_node_sh_lex.c', + 'ecoli_node_space.c', + 'ecoli_node_str.c', + 'ecoli_node_subset.c', + 'ecoli_parse.c', + 'ecoli_string.c', + 'ecoli_strvec.c', + 'ecoli_test.c', + 'ecoli_vec.c', + 'ecoli_yaml.c', +] +libecoli = shared_library('ecoli', + libecoli_sources, + include_directories : inc, + dependencies : [edit_dep, yaml_dep], + install : true) diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000..f61dbc6 --- /dev/null +++ b/test/meson.build @@ -0,0 +1,15 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2018, Olivier MATZ + +inc = include_directories('../include') + +test_sources = [ + 'test.c', +] + +ecoli_test = executable('ecoli-test', + test_sources, + include_directories : inc, + link_with : libecoli) + +test('libecoli test', ecoli_test) diff --git a/todo.txt b/todo.txt index 2b84064..acb7069 100644 --- a/todo.txt +++ b/todo.txt @@ -123,6 +123,8 @@ X file + partial completion - fusion node: need to match several children, same for completion? - float - not +- reparse: parse a tree with received strvec, then another tree + with strvec generated from first tree encoding ======== @@ -421,3 +423,17 @@ c --------------- +about split in several libraries + +There are several options: + +1/ one library, config options to select libyaml, libedit + - need to manage dependencies in build system + +2/ one library for ecoli-core, one for ecoli-yaml, one for + ecoli-edit + - extra complexity + +3/ one library with core + yaml + edit + dependency is managed at runtime + -- 2.39.5