aboutsummaryrefslogtreecommitdiff
path: root/tomo.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-03 16:08:38 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-03 16:08:38 -0500
commit32f27b6206c542d53383654fffff27a3fcdbc168 (patch)
tree93e11bf6e594fccfcb8b013f59f00105d1604373 /tomo.c
parent5486cdcedb592818f17195d6225ad9711aa21724 (diff)
Fix table literals
Diffstat (limited to 'tomo.c')
-rw-r--r--tomo.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tomo.c b/tomo.c
index 81eb9088..13ac7b7f 100644
--- a/tomo.c
+++ b/tomo.c
@@ -73,9 +73,13 @@ int main(int argc, char *argv[])
pclose(out);
}
+ const char *cconfig = getenv("CCONFIG");
+ 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 *cflags = getenv("CFLAGS");
if (!cflags)
- cflags = "-std=c11 -fdollars-in-identifiers -fsanitize=signed-integer-overflow -fno-sanitize-recover -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -D_DEFAULT_SOURCE";
+ cflags = heap_strf("%s -I. -D_DEFAULT_SOURCE", cconfig);
const char *ldlibs = "-lgc -lcord -lm -L. -ltomo";
if (getenv("LDLIBS"))
@@ -124,7 +128,7 @@ int main(int argc, char *argv[])
return WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE;
prog = popen(heap_strf("%s > %s.c", autofmt, f->filename), "w");
- CORD_put(CORD_all("#include \"", f->filename, ".h\"\n\n", module.c_file), prog);
+ CORD_put(CORD_all("#include \"", module.module_name, ".tm.h\"\n\n", module.c_file), prog);
status = pclose(prog);
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
printf("Transpiled to %s.c\n", f->filename);
@@ -141,7 +145,7 @@ int main(int argc, char *argv[])
return WIFEXITED(status) ? WEXITSTATUS(status) : EXIT_FAILURE;
prog = popen(heap_strf("%s -x c %s -E - | %s > %s.c", cc, cflags, autofmt, f->filename), "w");
- CORD_put(CORD_all("#include \"", f->filename, ".h\"\n\n", module.c_file), prog);
+ CORD_put(CORD_all("#include \"", module.module_name, ".tm.h\"\n\n", module.c_file), prog);
status = pclose(prog);
if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
printf("Transpiled to %s.c\n", f->filename);