Make CC an environment variable that's read from
This commit is contained in:
parent
a33de1a36e
commit
a1593ad8e4
2
Makefile
2
Makefile
@ -40,7 +40,7 @@ tags:
|
||||
ctags *.[ch] **/*.[ch]
|
||||
|
||||
test: nextlang
|
||||
for f in tests/*; do echo -e "\x1b[1;4m$$f\x1b[m"; VERBOSE=0 ./nextlang "$$f" || break; done
|
||||
for f in tests/*; do echo -e "\x1b[1;4m$$f\x1b[m"; VERBOSE=0 CC=tcc ./nextlang "$$f" || break; done
|
||||
|
||||
clean:
|
||||
rm -f nextlang *.o SipHash/halfsiphash.o builtins/*.o libnext.so
|
||||
|
12
nextlang.c
12
nextlang.c
@ -79,11 +79,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
const char *ldflags = "-Wl,-rpath '-Wl,$ORIGIN'";
|
||||
|
||||
// const char *run = heap_strf("tcc -run %s %s %s -", cflags, ldflags, ldlibs);
|
||||
const char *run = heap_strf("gcc -x c %s %s %s - -o program && ./program", cflags, ldflags, ldlibs);
|
||||
FILE *cc = popen(run, "w");
|
||||
CORD_put(program, cc);
|
||||
fclose(cc);
|
||||
const char *cc = getenv("CC");
|
||||
if (!cc) cc = "tcc";
|
||||
const char *run = streq(cc, "tcc") ? heap_strf("tcc -run %s %s %s -", cflags, ldflags, ldlibs)
|
||||
: heap_strf("gcc -x c %s %s %s - -o program && ./program", cflags, ldflags, ldlibs);
|
||||
FILE *runner = popen(run, "w");
|
||||
CORD_put(program, runner);
|
||||
fclose(runner);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user