makefile - How to add different rules for specific files? -


i have problem makefile.

with command, can compile *.c files *.o works well:

$(obj) : %.o : %.c $(ldscript) makefile     $(cc) $(arm9_includes) -c $(cflags) $< -o $@ 

but i'm wondering, if want run -o3 optimization on 1 particular file, , have -o0 on rest?

is there command add different rule specific file?

what i'm doing right compiling each c file own rules, annoying because have around 30 files makes makefile huge, , every time change in 1 file compiles again.

particular_file.o : cflags+=-o3 

(assuming gnu make) see target-specific variable values in gnu make manual (and following pattern-specific variable values, maybe).

also note, commands used specific rule given file, can have in case target-specific variable value not sufficient:

particular_file.o : particular_file.c         completely_special_compiler -o $@ $<  %.o : %.c         $(cc) $(cflags) -o $@ $< 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -