On Wed, 1 Sept 2021 at 13:50, Luo Xinsheng SGH ADWA4 <xinsheng.luo@xxxxxx> wrote: > > Hi Jonathan: > > > > Are there some examples for this @file using in GCC command option? Is the documentation not clear? > > > > Locally we usually create makefile and call GCC to compile similar as below script: > > > > # Collect GCC options (include dirs, defines etc.) > > CC := gcc > > CC_OPTS := -c -ggdb3 -std=gnu99 -W0nline -w -fgnu89-inline -g -fomit-frame-pointer > > CC_OPTS += -include Platformtypes_Stubs.h > > CC_OPTS += $(foreach d, $(INCDIRS), -I$d) > > CC_OPTS += $(foreach p, $(INCDIRS_PTU), -I$d) > > CC_OPTS += $(foreach d, $(DEFINES), -D$d) > > # Options for static library build > > AR := ar > > AR_OPTS := rcs > > > > $(OBJDIR)/%.o: $(OBJDIR)/%.c > > @echo Compiling: $(<F) > > @$(CC) $(CC_OPTS) $< -o $@ > > > > Now on above script, we find GCC command option in CC_OPTS content is too huge(About 12000 bytes inside) and it can not be analyzed totally in gcc command. 12000 bytes seems ridiculously large, somebody has let things get out of control. Instead of adding all those directories and options to the CC_OPTS variable, write them to a file and then tell GCC to read them from that file. How to update your makefile is out of scope for this mailing list, but you could add a target to the makefile: CC := gcc CC_OPTS := -c -ggdb3 -std=gnu99 -W0nline -w -fgnu89-inline -g -fomit-frame-pointer CC_OPTS += -include Platformtypes_Stubs.h CC_OPTS += @gcc_opts gcc_opts: printf "$(foreach d, $(INCDIRS), -I$d)" > $@ printf "$(foreach d, $(INCDIRS_PTU), -I$d)" >> $@ printf "$(foreach d, $(DEFINES), -D$d)" >> $@ Then make that a prerequisite of your object files, so that gcc_opts gets created before it's needed.