summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2013-05-11 17:31:34 +0200
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2013-05-11 20:34:12 +0200
commit9a9efefdb2ec7af52ca6946b78cb8610d8391ecf (patch)
treef53500ec8548344c7f6771d2ba2371314086c444 /tools
parent4f3fa9accbd77f8c85f87ae057d2420ce7666ff7 (diff)
downloadrockbox-9a9efefdb2ec7af52ca6946b78cb8610d8391ecf.tar.gz
rockbox-9a9efefdb2ec7af52ca6946b78cb8610d8391ecf.zip
ucl: Replace use of uname by checking the compiler output.
Similar as done for libtools.make ask the compiler for the binary it creates instead of using uname to figure the target to avoid special handling when cross compiling. Change-Id: Icb4654616e4339bf9e6e3be5177b35e0bb313bcd
Diffstat (limited to 'tools')
-rw-r--r--tools/ucl/src/Makefile21
1 files changed, 16 insertions, 5 deletions
diff --git a/tools/ucl/src/Makefile b/tools/ucl/src/Makefile
index 2d6f18f102..1f3207f426 100644
--- a/tools/ucl/src/Makefile
+++ b/tools/ucl/src/Makefile
@@ -22,20 +22,32 @@ ifdef RBARCH
CFLAGS += -arch $(RBARCH)
endif
+CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -)
+#build standalone win32 executables on cygwin
+ifeq ($(findstring CYGWIN,$(CPPDEFINES)),CYGWIN)
+COMPILETARGET = cygwin
+else
+ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW)
+COMPILETARGET = mingw
+else
# OS X specifics. Needs to consider cross compiling for Windows.
-ifeq ($(findstring Darwin,$(shell uname)),Darwin)
-ifneq ($(findstring mingw,$(CROSS)$(CC)),mingw)
+ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE)
# when building libs for OS X build for both i386 and ppc at the same time.
# This creates fat objects, and ar can only create the archive but not operate
# on it. As a result the ar call must NOT use the u (update) flag.
-CFLAGS += -arch ppc -arch i386
+ARCHFLAGS = -arch ppc -arch i386
# building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode)
# might need adjustment for older Xcode.
CC ?= gcc-4.0
CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
NATIVECC ?= gcc-4.0
+COMPILETARGET = darwin
+else
+COMPILETARGET = posix
+endif
endif
endif
+$(info Compiler creates $(COMPILETARGET) binaries)
TARGET_DIR ?= $(shell pwd)/
OBJDIR = $(TARGET_DIR)build$(RBARCH)
@@ -60,13 +72,12 @@ $(TARGET_DIR)ucl.dll: $(OBJS)
$(TARGET_DIR)libucl$(RBARCH).a: $(OBJS)
@echo AR $(notdir $@)
- $(SILENT)rm -f $@
$(SILENT)$(CROSS)$(AR) rcs $@ $(OBJS) >/dev/null 2>&1
$(OBJDIR)/%.o: %.c
@echo CC $<
$(SILENT)$(call mkdir, $(dir $@))
- $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c $< -o $@
+ $(SILENT)$(CROSS)$(CC) $(CFLAGS) $(ARCHFLAGS) -c $< -o $@
clean:
rm -f $(TARGET_DIR)libucl*.a