From 85bd57a1f3afd796e899a78f25bf75fac0c0c152 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 9ad197ee..7a958c8b 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.18.0

