Message ID | 1397918597-8680-4-git-send-email-vapier@gentoo.org |
---|---|
State | Not Applicable, archived |
Delegated to: | David Miller |
Headers | show |
Hey Mike, I'd like to set CC if is unset, check this patch, if it look sane for you :) https://github.com/iputils/iputils/commit/77ab88974eb4424620e4caa1dcd4bebe020a3b4e David Dne 2014-04-19 16:43, Mike Frysinger napsal: > This defaults CFLAGS to -O3 without clobbering settings people have set > up in the environment already. > > Signed-off-by: Mike Frysinger <vapier@gentoo.org> > --- > Makefile | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/Makefile b/Makefile > index 2c49940..ecabac3 100644 > --- a/Makefile > +++ b/Makefile > @@ -2,8 +2,6 @@ > # Configuration > # > > -# CC > -CC=gcc > # Path to parent kernel include files directory > LIBC_INCLUDE=/usr/include > # Libraries > @@ -48,11 +46,10 @@ ENABLE_RDISC_SERVER=no > > # ------------------------------------- > # What a pity, all new gccs are buggy and -Werror does not work. Sigh. > -# CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g > -CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -g > -CCOPTOPT=-O3 > -GLIBCFIX=-D_GNU_SOURCE > -DEFINES= > +# CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g > +CFLAGS?=-O3 -g > +CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall > +CPPFLAGS+=-D_GNU_SOURCE > LDLIB= > > FUNC_LIB = $(if $(filter static,$(1)),$(LDFLAG_STATIC) $(2) > $(LDFLAG_DYNAMIC),$(2)) > @@ -113,7 +110,6 @@ IPV4_TARGETS=tracepath ping clockdiff rdisc arping > tftpd rarpd > IPV6_TARGETS=tracepath6 traceroute6 ping6 > TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS) > > -CFLAGS=$(CCOPTOPT) $(CCOPT) $(GLIBCFIX) $(DEFINES) > LDLIBS=$(LDLIB) $(ADDLIB) > > UNAME_N:=$(shell uname -n) > @@ -132,6 +128,7 @@ all: $(TARGETS) > $(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -S -o $@ > %.o: %.c > $(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -o $@ > +LINK.o += $(CFLAGS) > $(TARGETS): %: %.o > $(LINK.o) $^ $(LIB_$@) $(LDLIBS) -o $@ -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Sat 19 Apr 2014 20:55:17 David Heidelberger wrote: > I'd like to set CC if is unset, check this patch, if it look sane for > you :) > https://github.com/iputils/iputils/commit/77ab88974eb4424620e4caa1dcd4bebe02 > 0a3b4e unfortunately that won't do anything. make provides a default CC so that code will effectively never get used. you could just delete the line. realistically, the default (cc) is going to be gcc on any system where this code is built. alternatively, you can use the pattern: ifeq ($(origin CC),default) CC = gcc endif -mike
diff --git a/Makefile b/Makefile index 2c49940..ecabac3 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,6 @@ # Configuration # -# CC -CC=gcc # Path to parent kernel include files directory LIBC_INCLUDE=/usr/include # Libraries @@ -48,11 +46,10 @@ ENABLE_RDISC_SERVER=no # ------------------------------------- # What a pity, all new gccs are buggy and -Werror does not work. Sigh. -# CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g -CCOPT=-fno-strict-aliasing -Wstrict-prototypes -Wall -g -CCOPTOPT=-O3 -GLIBCFIX=-D_GNU_SOURCE -DEFINES= +# CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall -Werror -g +CFLAGS?=-O3 -g +CFLAGS+=-fno-strict-aliasing -Wstrict-prototypes -Wall +CPPFLAGS+=-D_GNU_SOURCE LDLIB= FUNC_LIB = $(if $(filter static,$(1)),$(LDFLAG_STATIC) $(2) $(LDFLAG_DYNAMIC),$(2)) @@ -113,7 +110,6 @@ IPV4_TARGETS=tracepath ping clockdiff rdisc arping tftpd rarpd IPV6_TARGETS=tracepath6 traceroute6 ping6 TARGETS=$(IPV4_TARGETS) $(IPV6_TARGETS) -CFLAGS=$(CCOPTOPT) $(CCOPT) $(GLIBCFIX) $(DEFINES) LDLIBS=$(LDLIB) $(ADDLIB) UNAME_N:=$(shell uname -n) @@ -132,6 +128,7 @@ all: $(TARGETS) $(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -S -o $@ %.o: %.c $(COMPILE.c) $< $(DEF_$(patsubst %.o,%,$@)) -o $@ +LINK.o += $(CFLAGS) $(TARGETS): %: %.o $(LINK.o) $^ $(LIB_$@) $(LDLIBS) -o $@
This defaults CFLAGS to -O3 without clobbering settings people have set up in the environment already. Signed-off-by: Mike Frysinger <vapier@gentoo.org> --- Makefile | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-)