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]
|
ctags *.[ch] **/*.[ch]
|
||||||
|
|
||||||
test: nextlang
|
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:
|
clean:
|
||||||
rm -f nextlang *.o SipHash/halfsiphash.o builtins/*.o libnext.so
|
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 *ldflags = "-Wl,-rpath '-Wl,$ORIGIN'";
|
||||||
|
|
||||||
// const char *run = heap_strf("tcc -run %s %s %s -", cflags, ldflags, ldlibs);
|
const char *cc = getenv("CC");
|
||||||
const char *run = heap_strf("gcc -x c %s %s %s - -o program && ./program", cflags, ldflags, ldlibs);
|
if (!cc) cc = "tcc";
|
||||||
FILE *cc = popen(run, "w");
|
const char *run = streq(cc, "tcc") ? heap_strf("tcc -run %s %s %s -", cflags, ldflags, ldlibs)
|
||||||
CORD_put(program, cc);
|
: heap_strf("gcc -x c %s %s %s - -o program && ./program", cflags, ldflags, ldlibs);
|
||||||
fclose(cc);
|
FILE *runner = popen(run, "w");
|
||||||
|
CORD_put(program, runner);
|
||||||
|
fclose(runner);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user