Author: Andreas Tille <tille@debian.org>
Date: Thu, 26 Jul 2012 12:15:21 +0200
Description: Some adaptations to Debian
  * Enable building with Debian default compiler
  * Enable fixing rpath issue when build under Debian
  * Fix X11 path
  * Enable propagation of hardening flags

--- a/Makefile
+++ b/Makefile
@@ -67,8 +67,9 @@ ALLOWED_GCC_4xx_VERSIONS=\
 	4.2.0 4.2.1       4.2.3 4.2.4 \
 	      4.3.1 4.3.2 4.3.3 \
 	      4.4.1       4.4.3 \
-	      4.6.1 \
-	      4.7.1
+	      4.6.1 4.6.2 4.6.3 \
+	      4.7.1 4.7.2 4.7.3 \
+        4.8.0 4.8.1 4.8.2 4.8.3
 
 ALLOWED_GCC_VERSIONS=$(ALLOWED_GCC_3xx_VERSIONS) $(ALLOWED_GCC_4xx_VERSIONS)
 
@@ -105,7 +106,12 @@ ifeq ($(DEBUG),0)
 	dflags := -DNDEBUG# defines
 	cflags := -O4# compiler flags (C and C++)
  ifndef DARWIN
-	lflags += -O99# linker flags
+	ifdef DEBIAN
+		lflags += -O2 -Wl,-rpath=/usr/lib/arb/lib # linker flags
+		# remark:  --strip-all option breaks g++ 4.6 and it's unwanted anyway
+	else
+		lflags += -O99# linker flags
+	endif
  endif
 endif
 
@@ -208,7 +214,7 @@ cflags += -fPIC
 
 #---------------------- X11 location
 
-ifdef DARWIN
+ifdef DEBIAN
 	XHOME:=$(PREFIX)
 else
 	XHOME:=/usr/X11R6
@@ -285,9 +291,9 @@ endif
 #	(instead define variables above)
 # -------------------------------------------------------------------------
 
-cflags += -W -Wall $(dflags) $(extended_warnings) $(cdynamic)
+cflags += $(CFLAGS) -W -Wall $(dflags) $(extended_warnings) $(cdynamic)
 
-cppflags := $(extended_cpp_warnings)
+cppflags := $(extended_cpp_warnings) $(CPPFLAGS)
 
 ifeq ($(DEVELOPER),RALF)
 HAVE_GNUPP0X=`SOURCE_TOOLS/requireVersion.pl 4.3 $(GCC_VERSION_FOUND)`
@@ -304,7 +310,7 @@ CPP := $(GPP) $(cppflags)# compile C++
 ACCLIB := $(ACC) $(shared_cflags)# compile C (shared libs)
 CPPLIB := $(CPP) $(shared_cflags)# compile C++ (shared libs)
 
-LINK_STATIC_LIB := ld $(lflags) $(ldynamic) -r -o# link static lib
+LINK_STATIC_LIB := ld -rpath=/usr/lib/arb/lib -z relro -r -o# link static lib
 LINK_EXECUTABLE := $(GPP) $(lflags) $(cdynamic) -o# link executable (c++)
 
 ifeq ($(LINK_STATIC),1)
