diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-11 22:12:21 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-11 22:12:21 -0500 |
| commit | 7d6af5f4c7663bddf4dad4a58c770dbdd299e022 (patch) | |
| tree | 30d092b28940492598339aa41d2d683524e74c02 /nextlang.c | |
| parent | 8ef46380189d2ce39a0ec2a489e704b059676bf9 (diff) | |
Handle LDLIBS as a separate thing
Diffstat (limited to 'nextlang.c')
| -rw-r--r-- | nextlang.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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); |
