From 118517fb0211e84d1c3b9c6c31aeba367c6d6f8d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 24 Mar 2024 16:19:59 -0400 Subject: Add optimization flag --- tomo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tomo.c b/tomo.c index 087a8d4c..78b5e4a4 100644 --- a/tomo.c +++ b/tomo.c @@ -65,9 +65,12 @@ int main(int argc, char *argv[]) if (!cconfig) cconfig = "-std=c11 -fdollars-in-identifiers -fsanitize=signed-integer-overflow -fno-sanitize-recover -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE"; + const char *optimization = getenv("O"); + if (!optimization) optimization = "-O1"; + cflags = getenv("CFLAGS"); if (!cflags) - cflags = heap_strf("%s -I. -D_DEFAULT_SOURCE", cconfig); + cflags = heap_strf("%s %s -I. -D_DEFAULT_SOURCE", cconfig, optimization); ldlibs = "-lgc -lcord -lm -L. -ltomo"; if (getenv("LDLIBS")) @@ -227,7 +230,6 @@ int transpile(const char *filename, bool force_retranspile) printf("Transpiled to %s.c\n", f->filename); } - if (verbose) { FILE *out = popen(heap_strf("bat -P %s.h %s.c", f->filename, f->filename), "w"); CORD_put(module.header, out); -- cgit v1.2.3