aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-24 16:19:59 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-03-24 16:19:59 -0400
commit118517fb0211e84d1c3b9c6c31aeba367c6d6f8d (patch)
tree4d164c1a57e960c2b422cda524c52a2e9f997c11
parentbdfb388aa16aa3c708ea49be10ed244680e318d6 (diff)
Add optimization flag
-rw-r--r--tomo.c6
1 files 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);