From 96e0e92afd6ae57c55b75b42c4c6156ae5b3f341 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 8 May 2016 23:47:21 -0400 Subject: [PATCH 1/2] get default CFLAGS/CXXFLAGS from configure Since autoconf already sets up default compiler flags for us, use those. These also come from the user's build settings. --- Makefile.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index b8fbb81..2d677d7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -103,9 +103,11 @@ STRIP:=@STRIP@ OBJECTS:=$(subst .cc,.o,$(SOURCE)) TOP_DIR:=@top_srcdir@ TOP_BUILDDIR:=@top_builddir@ -CFLAGS+=-g -Wall -O3 +CFLAGS?=@CFLAGS@ +CFLAGS+=-Wall CFLAGS+=@LFS_FLAGS@ -CXXFLAGS+=-g -Wall -fno-strict-aliasing -std=gnu++98 +CXXFLAGS?=@CXXFLAGS@ +CXXFLAGS+=-Wall -fno-strict-aliasing -std=gnu++98 CXXFLAGS+=@CXXOPTIMISE_FLAG@ CXXFLAGS+=@CXXDEBUG_FLAG@ CXXFLAGS+=@CXX_STRERROR_FLAG@ From 3e24cff8a140a6e7f82a5c01944d93d6dcbf7966 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sun, 8 May 2016 23:51:22 -0400 Subject: [PATCH 2/2] respect & use CPPFLAGS properly The common preprocessor variable is named CPPFLAGS. configure sets this up for us, including sourcing values from the user. Rename INCLUDES to match, and pull the default from configure. --- Makefile.in | 7 ++++--- unit-tests/Makefile.in | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile.in b/Makefile.in index 2d677d7..14da10f 100644 --- a/Makefile.in +++ b/Makefile.in @@ -112,7 +112,8 @@ CXXFLAGS+=@CXXOPTIMISE_FLAG@ CXXFLAGS+=@CXXDEBUG_FLAG@ CXXFLAGS+=@CXX_STRERROR_FLAG@ CXXFLAGS+=@LFS_FLAGS@ -INCLUDES+=-I$(TOP_BUILDDIR) -I$(TOP_DIR) -I$(TOP_DIR)/thin-provisioning +CPPFLAGS?=@CPPFLAGS@ +CPPFLAGS+=-I$(TOP_BUILDDIR) -I$(TOP_DIR) -I$(TOP_DIR)/thin-provisioning LIBS:=-laio -lexpat ifeq ("@STATIC_CXX@", "yes") @@ -149,9 +150,9 @@ endif %.o: %.cc @echo " [CXX] $<" - $(V) $(CXX) -c $(INCLUDES) $(CXXFLAGS) -o $@ $< + $(V) $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $< @echo " [DEP] $<" - $(V) $(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(TEST_INCLUDES) $(CXXFLAGS) $< > $*.$$$$; \ + $(V) $(CXX) -MM -MT $(subst .cc,.o,$<) $(CPPFLAGS) $(TEST_INCLUDES) $(CXXFLAGS) $< > $*.$$$$; \ sed 's,\([^ :]*\)\.o[ :]*,\1.o \1.gmo $* : Makefile ,g' < $*.$$$$ > $*.d; \ $(RM) $*.$$$$ diff --git a/unit-tests/Makefile.in b/unit-tests/Makefile.in index 738552b..0ff70dd 100644 --- a/unit-tests/Makefile.in +++ b/unit-tests/Makefile.in @@ -74,9 +74,9 @@ TEST_OBJECTS=$(subst .cc,.gmo,$(TEST_SOURCE)) %.gmo: %.cc @echo " [CXX] $<" - $(V) $(CXX) -c $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) -o $@ $< + $(V) $(CXX) -c $(CPPFLAGS) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) -o $@ $< @echo " [DEP] $<" - $(V) $(CXX) -MM -MT $(subst .cc,.o,$<) $(INCLUDES) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) $< > $*.$$$$; \ + $(V) $(CXX) -MM -MT $(subst .cc,.o,$<) $(CPPFLAGS) $(GMOCK_INCLUDES) $(CXXFLAGS) $(GMOCK_FLAGS) $< > $*.$$$$; \ sed 's,\([^ :]*\)\.o[ :]*,\1.o \1.gmo $* : Makefile ,g' < $*.$$$$ > $*.d; \ $(RM) $*.$$$$