aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nextlang.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/nextlang.c b/nextlang.c
index aa0a42b2..aa1c1e92 100644
--- a/nextlang.c
+++ b/nextlang.c
@@ -112,9 +112,17 @@ int main(int argc, char *argv[])
fclose(out);
}
- const char *flags = getenv("CFLAGS");
- if (!flags) flags = "-std=c11 -lm -lgc -lcord";
- const char *run = heap_strf(verbose ? "tcc %s -run - | bat --file-name=output.txt" : "tcc %s -run -", flags);
+ const char *cflags = getenv("CFLAGS");
+ if (!cflags)
+ cflags = "-std=c11";
+
+ const char *ldlibs = "-lgc -lcord -lm";
+ if (getenv("LDLIBS"))
+ ldlibs = heap_strf("%s %s", ldlibs, getenv("LDLIBS"));
+
+ const char *run = heap_strf("tcc %s %s -run -", cflags, ldlibs);
+ if (verbose)
+ run = heap_strf("%s | bat --file-name=STDOUT", run);
FILE *cc = popen(run, "w");
CORD_put(program, cc);
fclose(cc);