I ve recently upgraded my Ubuntu installation from Jaunty to Karmic. This apparently includes an update of the GNU C compiler, because code that compiled previously no longer does.
Running cc 4.4.1 (Ubuntu 4.4.1-4ubuntu8) now produces the following error, on code that worked fine in the cc 4.3.3 (Ubuntu 4.3.3-5ubuntu4):
$ make
cc -c -MMD -MG -MP -MF lex.d -g -Wall -O -o lex.o lex.c
cc1: error: -MG may only be used with -M or -MM
Adding either the -M
or -MM
flag resulted in the following message:
[...]
flex -o lex.c lex.l
cc -c -MM -MG -MP -MF lex.d -g -Wall -O -o lex.o lex.c
[...]
cc -g -Wall -O -o translate lex.o grammar.tab.o main.o list.o salloc.o suffixed.o expr.o emit.o optimize.o -lfl
lex.o: file not recognized: File truncated
collect2: ld returned 1 exit status
make: *** [translate] Error 1
I ve been told that the various -Mx
tell flags make
how the various c files depend on .h
files.
My best fix so far is to tell make
explicitly that all .c
files depend on all .h
files, to make sure everything stays up to date.
However, this does induce a lot of unnecessary work at compile time.
My question therefore is: How do I need to adjust the flags for cc
to have it handle dependencies automatically again?