Reputation: 24354
Can I configure GCC to add some file globally, for every project? I want to make it temporarily and only with flags like: -fdiagnostics-color
.
Upvotes: 2
Views: 5209
Reputation: 1
You might read about GCC spec files and alter the spec file used by your particular version of gcc
. But this is generally frowned upon.
The usual practice would be to use GNU make and add a CFLAGS += -fdiagnostics-color
to your Makefile
. BTW with a recent enough GCC this (adding -fdiagnostics-color
flag) is not even necessary since (at least by setting your GCC_COLORS
environment variable) the default is -fdiagnostics-color=auto
Upvotes: 2
Reputation: 6960
I don't understand why do you need it but you can do a wrapper:
which gcc
- will print a patch to GCC (copy it to clipboard) mkdir somedir; cd somedir
gcc
full path to gcc(from clipboard) -fdiagnostics-color somefile.c $@
this command will add -fdiagnostics-color somefile.c
before every line that came to gcc.chmod +x gcc
- set execution rights to gcc wrapper export PATH=somedir:$PATH
Upvotes: 1