libtools.make: allow overriding variables via environment.

Simplify a bit while at it as well.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31523 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2012-01-02 16:59:22 +00:00
parent de6c203b53
commit 8c6c6a6b20

View file

@ -23,11 +23,9 @@ endif
TOP := $(dir $(lastword $(MAKEFILE_LIST))) TOP := $(dir $(lastword $(MAKEFILE_LIST)))
# overwrite for releases # overwrite for releases
ifndef APPVERSION APPVERSION ?= $(shell $(TOP)/../tools/version.sh ../)
APPVERSION=$(shell $(TOP)/../tools/version.sh ../)
endif
CFLAGS += -DVERSION=\"$(APPVERSION)\" CFLAGS += -DVERSION=\"$(APPVERSION)\"
TARGET_DIR = $(shell pwd)/ TARGET_DIR ?= $(shell pwd)/
BINARY = $(OUTPUT) BINARY = $(OUTPUT)
# when building a Windows binary add the correct file suffix # when building a Windows binary add the correct file suffix
@ -45,19 +43,17 @@ endif
endif endif
NATIVECC = gcc NATIVECC = gcc
CC = gcc CC ?= gcc
ifeq ($(findstring Darwin,$(shell uname)),Darwin) ifeq ($(findstring Darwin,$(shell uname)),Darwin)
# building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode) # building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode)
# might need adjustment for older Xcode. # might need adjustment for older Xcode.
CC = gcc-4.0 CC ?= gcc-4.0
CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
NATIVECC = gcc-4.0 NATIVECC ?= gcc-4.0
endif endif
WINDRES = windres WINDRES = windres
ifndef BUILD_DIR BUILD_DIR ?= $(TARGET_DIR)build
BUILD_DIR = $(TARGET_DIR)build
endif
OBJDIR = $(abspath $(BUILD_DIR)/$(RBARCH))/ OBJDIR = $(abspath $(BUILD_DIR)/$(RBARCH))/
ifdef RBARCH ifdef RBARCH