From da98320ab62969e7f97154662f0c7fe4f4b32c7c Mon Sep 17 00:00:00 2001
From: Ray Donnelly <mingw.android@gmail.com>
Date: Mon, 19 Mar 2018 12:46:19 +0000
Subject: [PATCH 5/5] Add ADD_*FLAGS to end of commandlines

.. so they take precedence.
---
 Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 42d3bfe1..a5171da6 100644
--- a/Makefile
+++ b/Makefile
@@ -68,7 +68,7 @@ endif
 endif
 
 export LDFLAGS= -pthread -lm $(ADD_LDFLAGS) $(DMLC_LDFLAGS) $(PLUGIN_LDFLAGS)
-export CFLAGS= -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude $(ADD_CFLAGS) $(PLUGIN_CFLAGS)
+export CFLAGS= -DDMLC_LOG_CUSTOMIZE=1 -std=c++11 -Wall -Wno-unknown-pragmas -Iinclude $(PLUGIN_CFLAGS)
 CFLAGS += -I$(DMLC_CORE)/include -I$(RABIT)/include -I$(GTEST_PATH)/include
 #java include path
 export JAVAINCFLAGS = -I${JAVA_HOME}/include -I./java
@@ -116,6 +116,10 @@ else
 endif
 CFLAGS += $(OPENMP_FLAGS)
 
+# Add the ADD_*FLAGS last so they take precedence
+LDFLAGS += $(ADD_LDFLAGS)
+CFLAGS += $(ADD_CFLAGS)
+
 # specify tensor path
 .PHONY: clean all lint clean_all doxygen rcpplint pypack Rpack Rbuild Rcheck java pylint
 
-- 
2.17.1

