1 # VAR = [ RemoveOptWild regexp-options-to-remove : options-list : flags ] ;
2 # remove options from list with egrep-like regexps
3 rule RemoveOptWild oname : str : flags {
6 #Echo "removing " $(oname) " from " $(str) ;
8 _t = [ Match $(oname) : $(_f) : $(flags) ] ;
11 #Echo "include: " $(f) ;
19 rule remove-std99-flags optlist {
20 optlist -= "-std=c99" "-std=gnu99" ;
25 # remove-opt-flags $(var)
26 # remove optimization flags from compiler options
27 rule remove-opt-flags {
28 local orm = "-march=*" "-mtune=*" "-mfpmath=*" "-O[0-9s]" ;
29 local ormff = "-f[^n][^o]*" ;
30 local res = [ RemoveOptWild $(orm) $(ormff) : $(<) : glob ] ;
35 rule remove-opt-flags-for-all-compilers {
36 OPTIM = [ remove-opt-flags $(OPTIM) ] ;
37 C++OPTIM = [ remove-opt-flags $(C++OPTIM) ] ;
38 OBJCOPTIM = [ remove-opt-flags $(OBJCOPTIM) ] ;
39 OPTIM.all = [ remove-opt-flags $(OPTIM.all) ] ;
43 rule gcc-suggest-attrs {
45 CFLAGS.all += -Wsuggest-attribute=const ;
46 CFLAGS.all += -Wsuggest-attribute=pure ;
47 CFLAGS.all += -Wsuggest-attribute=noreturn ;