Description: make cloop build honor compiler/linker flags from the environment
Author: Damyan Ivanov <dmn@debian.org>
Forwarded: no

--- a/extern/cloop/Makefile
+++ b/extern/cloop/Makefile
@@ -27,8 +27,8 @@ SRCS_CPP := $(foreach sdir,$(SRC_DIRS),$
 OBJS_C := $(patsubst $(SRC_DIR)/%.c,$(OBJ_DIR)/%.o,$(SRCS_C))
 OBJS_CPP := $(patsubst $(SRC_DIR)/%.cpp,$(OBJ_DIR)/%.o,$(SRCS_CPP))
 
-C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter
-CXX_FLAGS := $(C_FLAGS) -std=c++11
+C_FLAGS := -ggdb -fPIC -MMD -MP -W -Wall -Wno-unused-parameter $(CPPFLAGS) $(CFLAGS)
+CXX_FLAGS := $(C_FLAGS) $(CXXFLAGS) -std=c++11
 FPC_FLAGS := -Mdelphi -Cg
 
 ifeq ($(shell uname),FreeBSD)
@@ -94,7 +94,7 @@ $(BIN_DIR)/cloop: \
 	$(OBJ_DIR)/cloop/Main.o \
 	| $(BIN_DIR)
 
-	$(LD) $^ -o $@ $(LIBS)
+	$(LD) $(LDFLAGS) $^ -o $@ $(LIBS)
 
 $(SRC_DIR)/tests/test1/CalcCApi.h: $(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl
 	$(BIN_DIR)/cloop $(SRC_DIR)/tests/test1/Interface.idl c-header $@ CALC_C_API_H CALC_I
@@ -121,23 +121,23 @@ $(BIN_DIR)/test1-c$(SHRLIB_EXT): \
 	$(OBJ_DIR)/tests/test1/CalcCApi.o \
 	$(OBJ_DIR)/tests/test1/CTest.o \
 
-	$(LD) $^ -shared $(DL_LIB) -o $@ $(LIBS)
+	$(LD) $(LDFLAGS) $^ -shared $(DL_LIB) -o $@ $(LIBS)
 
 $(BIN_DIR)/test1-c$(EXE_EXT): \
 	$(OBJ_DIR)/tests/test1/CalcCApi.o \
 	$(OBJ_DIR)/tests/test1/CTest.o \
 
-	$(LD) $^ $(DL_LIB) -o $@ $(LIBS)
+	$(LD) $(LDFLAGS) $^ $(DL_LIB) -o $@ $(LIBS)
 
 $(BIN_DIR)/test1-cpp$(SHRLIB_EXT): \
 	$(OBJ_DIR)/tests/test1/CppTest.o \
 
-	$(LD) $^ -shared $(DL_LIB) -o $@ $(LIBS)
+	$(LD) $(LDFLAGS) $^ -shared $(DL_LIB) -o $@ $(LIBS)
 
 $(BIN_DIR)/test1-cpp$(EXE_EXT): \
 	$(OBJ_DIR)/tests/test1/CppTest.o \
 
-	$(LD) $^ $(DL_LIB) -o $@ $(LIBS)
+	$(LD) $(LDFLAGS) $^ $(DL_LIB) -o $@ $(LIBS)
 
 $(BIN_DIR)/test1-pascal$(SHRLIB_EXT): \
 	$(SRC_DIR)/tests/test1/PascalClasses.pas \
