Description: Remove hardcoded GCC optimization flags
 This is necessary in order to make DEB_BUILD_OPTIONS=noopt work as expected.
 .
 Note that the hack on llvm-config --cxxflags is not absolutely needed, because
 the -O2 that it brings come before the -O0 brought by dpkg-buildflags. But I
 leave it for clarity.
Author: Sébastien Villemot <sebastien@debian.org>
Forwarded: not-needed
Last-Update: 2015-11-17
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/Make.inc
+++ b/Make.inc
@@ -297,7 +297,7 @@
 JCPPFLAGS =
 JCXXFLAGS = -pipe $(fPIC) -fno-rtti
 DEBUGFLAGS = -O0 -ggdb3 -DJL_DEBUG_BUILD -fstack-protector-all
-SHIPFLAGS = -O3 -ggdb3 -falign-functions
+SHIPFLAGS = -ggdb3 -falign-functions
 endif
 
 ifeq ($(USECLANG),1)
--- a/deps/Rmath/Make.inc
+++ b/deps/Rmath/Make.inc
@@ -4,12 +4,11 @@
 ARCH = $(shell uname -m)
 
 FC = gfortran
-FFLAGS-add += -O3
 
 USEGCC = 1
 USECLANG = 0
 
-CFLAGS-add += -Wall -O3
+CFLAGS-add += -Wall
 
 ifeq ($(USECLANG),1)
 USEGCC = 0
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -1626,7 +1626,7 @@
 endif
 
 $(build_shlibdir)/libsuitesparse_wrapper.$(SHLIB_EXT): SuiteSparse_wrapper.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -O2 -shared $(fPIC) $(SUITESPARSE_INC) $< -o $@ $(SUITESPARSE_LIB)
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -shared $(fPIC) $(SUITESPARSE_INC) $< -o $@ $(SUITESPARSE_LIB)
 	$(INSTALL_NAME_CMD)libsuitesparse_wrapper.$(SHLIB_EXT) $@
 	touch -c $@
 
--- a/src/Makefile
+++ b/src/Makefile
@@ -78,7 +78,7 @@
 $(BUILDDIR)/%.dbg.obj: %.c $(HEADERS) | $(BUILDDIR)
 	@$(call PRINT_CC, $(CC) $(CPPFLAGS) $(CFLAGS) $(DEBUGFLAGS) -c $< -o $@)
 $(BUILDDIR)/%.o: %.cpp $(HEADERS) $(shell which $(LLVM_CONFIG)) | $(BUILDDIR)
-	@$(call PRINT_CC, $(CXX) $(call exec,$(LLVM_CONFIG) --cxxflags) $(CPPFLAGS) $(CXXFLAGS) $(SHIPFLAGS) -c $< -o $@)
+	@$(call PRINT_CC, $(CXX) $(call exec,$(LLVM_CONFIG) --cxxflags | sed 's/^/ /;s/$$/ /;s/\s-O.\s/ /') $(CPPFLAGS) $(CXXFLAGS) $(SHIPFLAGS) -c $< -o $@)
 $(BUILDDIR)/%.dbg.obj: %.cpp $(HEADERS) $(shell which $(LLVM_CONFIG)) | $(BUILDDIR)
 	@$(call PRINT_CC, $(CXX) $(call exec,$(LLVM_CONFIG) --cxxflags) $(CPPFLAGS) $(CXXFLAGS) $(DEBUGFLAGS) -c $< -o $@)
 
