summaryrefslogtreecommitdiff
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
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
-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
22CFLAGS += -arch $(RBARCH) 22CFLAGS += -arch $(RBARCH)
23endif 23endif
24 24
25CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -)
26#build standalone win32 executables on cygwin
27ifeq ($(findstring CYGWIN,$(CPPDEFINES)),CYGWIN)
28COMPILETARGET = cygwin
29else
30ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW)
31COMPILETARGET = mingw
32else
25# OS X specifics. Needs to consider cross compiling for Windows. 33# OS X specifics. Needs to consider cross compiling for Windows.
26ifeq ($(findstring Darwin,$(shell uname)),Darwin) 34ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE)
27ifneq ($(findstring mingw,$(CROSS)$(CC)),mingw)
28# when building libs for OS X build for both i386 and ppc at the same time. 35# when building libs for OS X build for both i386 and ppc at the same time.
29# This creates fat objects, and ar can only create the archive but not operate 36# This creates fat objects, and ar can only create the archive but not operate
30# on it. As a result the ar call must NOT use the u (update) flag. 37# on it. As a result the ar call must NOT use the u (update) flag.
31CFLAGS += -arch ppc -arch i386 38ARCHFLAGS = -arch ppc -arch i386
32# building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode) 39# building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode)
33# might need adjustment for older Xcode. 40# might need adjustment for older Xcode.
34CC ?= gcc-4.0 41CC ?= gcc-4.0
35CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 42CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
36NATIVECC ?= gcc-4.0 43NATIVECC ?= gcc-4.0
44COMPILETARGET = darwin
45else
46COMPILETARGET = posix
47endif
37endif 48endif
38endif 49endif
50$(info Compiler creates $(COMPILETARGET) binaries)
39 51
40TARGET_DIR ?= $(shell pwd)/ 52TARGET_DIR ?= $(shell pwd)/
41OBJDIR = $(TARGET_DIR)build$(RBARCH) 53OBJDIR = $(TARGET_DIR)build$(RBARCH)
@@ -60,13 +72,12 @@ $(TARGET_DIR)ucl.dll: $(OBJS)
60 72
61$(TARGET_DIR)libucl$(RBARCH).a: $(OBJS) 73$(TARGET_DIR)libucl$(RBARCH).a: $(OBJS)
62 @echo AR $(notdir $@) 74 @echo AR $(notdir $@)
63 $(SILENT)rm -f $@
64 $(SILENT)$(CROSS)$(AR) rcs $@ $(OBJS) >/dev/null 2>&1 75 $(SILENT)$(CROSS)$(AR) rcs $@ $(OBJS) >/dev/null 2>&1
65 76
66$(OBJDIR)/%.o: %.c 77$(OBJDIR)/%.o: %.c
67 @echo CC $< 78 @echo CC $<
68 $(SILENT)$(call mkdir, $(dir $@)) 79 $(SILENT)$(call mkdir, $(dir $@))
69 $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c $< -o $@ 80 $(SILENT)$(CROSS)$(CC) $(CFLAGS) $(ARCHFLAGS) -c $< -o $@
70 81
71clean: 82clean:
72 rm -f $(TARGET_DIR)libucl*.a 83 rm -f $(TARGET_DIR)libucl*.a