diff Makefile @ 272:cfeb196251e4

Fix conditional setting of build tools variables in the makefile As pointed out by Tormod Volden, make automatically sets CC and AR. Instead of a conditional setting of those variables, automatically add BUILDTPREFIX to them if it is set without overriding the values of CC, AR, and RANLIB. Also have extra default conditional settings of those three variables in the event that they happen not to be set for some reason.
author William Astle <lost@l-w.ca>
date Sat, 20 Apr 2013 11:00:11 -0600
parents f6acfc659dd9
children 776a076d1afa
line wrap: on
line diff
--- a/Makefile	Sun Apr 07 01:29:29 2013 -0600
+++ b/Makefile	Sat Apr 20 11:00:11 2013 -0600
@@ -9,14 +9,19 @@
 
 DESTDIR ?= /usr/local/bin
 
-# C compiler
-CC ?= $(BUILDTPREFIX)cc
+# this are probably pointless but they will make sure
+# the variables are set without overriding the environment
+# or automatic values from make itself.
+CC ?= cc
+AR ?= ar
+RANLIB ?= ranlib
 
-# ar
-AR ?= $(BUILDTPREFIX)ar
-
-# ranlib
-RANLIB ?= $(BUILDTPREFIX)ranlib
+# Set variables for cross compiling
+ifneq ($(BUILDTPREFIX),)
+CC := $(BUILDTPREFIX)$(CC)
+AR := $(BUILDTPREFIX)$(AR)
+RANLIB := $(BUILDTPREFIX)$(RANLIB)
+endif
 
 CPPFLAGS += -I lwlib -DPACKAGE_STRING='"lwtools 4.7+"'
 LDFLAGS += -L$(PWD)/lwlib -llw