@@ -34,17 +34,30 @@ endif
3434LIBLINK = $(subst .$(VERSION ) ,,$(LIBFILE ) )
3535
3636ifndef CFLAGS
37- CFLAGS = -Wall -Wextra -pedantic -Wno-unused-parameter
37+ cc_std = c89
38+ cc_version := $(shell $(CC ) --version)
39+ cc_is_gnu := $(if $(findstring Free Software Foundation,$(cc_version ) ) ,1)
40+ ifdef cc_is_gnu
41+ CFLAGS = $(if $(cc_std ) ,-std=$(cc_std ) )
42+ CFLAGS += -pedantic -Wall -Wextra
43+ CFLAGS += -Wno-unused-parameter
44+ CFLAGS += -Wno-unreachable-code-return
45+ else
46+ CFLAGS = $(if $(cc_std ) ,-std=$(cc_std ) )
47+ CFLAGS += -pedantic -Weverything
48+ CFLAGS += -Wno-unused-parameter
49+ CFLAGS += -Wno-unreachable-code-return
50+ endif
3851endif
3952
4053.SECONDEXPANSION : # to expand $$(@D)/.DIR
4154
42- $(BUILD ) /mpicc : CC := CC
43- $(BUILD ) /mpicc : cc := cc
44- $(BUILD ) /mpicc : op := cc
45- $(BUILD ) /mpicxx : CC := CXX
46- $(BUILD ) /mpicxx : cc := c++
47- $(BUILD ) /mpicxx : op := cxx
55+ $(BUILD ) /mpicc : override CC := CC
56+ $(BUILD ) /mpicc : override cc := cc
57+ $(BUILD ) /mpicc : override op := cc
58+ $(BUILD ) /mpicxx : override CC := CXX
59+ $(BUILD ) /mpicxx : override cc := c++
60+ $(BUILD ) /mpicxx : override op := cxx
4861$(BUILD ) /mpic% : mpicc.in | $$(@D ) /.DIR
4962 cp $< $@
5063 $(SED_I ) -e ' s:@includedir@:$(abspath $(PREFIX))/$(INCDIR):' $@
0 commit comments