diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-07-12 15:40:57 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-07-12 15:40:57 -0400 |
| commit | d39d2810121a52625d3950c8a4f53422243b46c2 (patch) | |
| tree | e748c6e2f4b99a48c9f3448fd7e04c347b097199 | |
| parent | 789497e2ca25c8189fb2466f34dda054d99453b1 (diff) | |
Use `#embed` to embed the changelog in the binary and give access via
--changelog
| -rw-r--r-- | docs/tomo.1.md | 3 | ||||
| -rw-r--r-- | man/man1/tomo.1 | 3 | ||||
| -rw-r--r-- | src/tomo.c | 14 |
3 files changed, 19 insertions, 1 deletions
diff --git a/docs/tomo.1.md b/docs/tomo.1.md index 4207de6a..3bf5e779 100644 --- a/docs/tomo.1.md +++ b/docs/tomo.1.md @@ -62,6 +62,9 @@ C code, which is then compiled using a C compiler of your choice. `--version` : Print the compiler version and exit. +`--changelog` +: Print the compiler change log and exit. + `--prefix` : Print the Tomo installation prefix and exit. diff --git a/man/man1/tomo.1 b/man/man1/tomo.1 index 4b4f16bd..c3330175 100644 --- a/man/man1/tomo.1 +++ b/man/man1/tomo.1 @@ -60,6 +60,9 @@ Print extra verbose output. \f[B]\-\-version\f[R] Print the compiler version and exit. .TP +\f[B]\-\-changelog\f[R] +Print the compiler change log and exit. +.TP \f[B]\-\-prefix\f[R] Print the Tomo installation prefix and exit. .TP @@ -71,7 +71,8 @@ static OptionalBool_t verbose = false, compile_exe = false, should_install = false, clean_build = false, - source_mapping = true; + source_mapping = true, + show_changelog = false; static OptionalText_t show_codegen = NONE_TEXT, @@ -96,6 +97,11 @@ static Text_t config_summary, // of that directory. as_owner = Text(""); +static const char changelog[] = { +#embed "../CHANGES.md" + , 0 +}; + static void transpile_header(env_t *base_env, Path_t path); static void transpile_code(env_t *base_env, Path_t path); static void compile_object_file(Path_t path); @@ -214,6 +220,7 @@ int main(int argc, char *argv[]) {"f", false, &Bool$info, &clean_build}, {"source-mapping", false, &Bool$info, &source_mapping}, {"m", false, &Bool$info, &source_mapping}, + {"changelog", false, &Bool$info, &show_changelog}, ); if (show_prefix) { @@ -221,6 +228,11 @@ int main(int argc, char *argv[]) return 0; } + if (show_changelog) { + print_inline(changelog); + return 0; + } + bool is_gcc = (system(String(cc, " -v 2>&1 | grep -q 'gcc version'")) == 0); if (is_gcc) { cflags = Texts(cflags, Text(" -fsanitize=signed-integer-overflow -fno-sanitize-recover" |
