aboutsummaryrefslogtreecommitdiff
path: root/src/tomo.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-07-12 15:40:57 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-07-12 15:40:57 -0400
commitd39d2810121a52625d3950c8a4f53422243b46c2 (patch)
treee748c6e2f4b99a48c9f3448fd7e04c347b097199 /src/tomo.c
parent789497e2ca25c8189fb2466f34dda054d99453b1 (diff)
Use `#embed` to embed the changelog in the binary and give access via
--changelog
Diffstat (limited to 'src/tomo.c')
-rw-r--r--src/tomo.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/tomo.c b/src/tomo.c
index 187495ce..cf3508bd 100644
--- a/src/tomo.c
+++ b/src/tomo.c
@@ -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"