diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-05-11 17:31:34 +0200 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2013-05-11 20:34:12 +0200 |
commit | 9a9efefdb2ec7af52ca6946b78cb8610d8391ecf (patch) | |
tree | f53500ec8548344c7f6771d2ba2371314086c444 | |
parent | 4f3fa9accbd77f8c85f87ae057d2420ce7666ff7 (diff) | |
download | rockbox-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/Makefile | 21 |
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 | |||
22 | CFLAGS += -arch $(RBARCH) | 22 | CFLAGS += -arch $(RBARCH) |
23 | endif | 23 | endif |
24 | 24 | ||
25 | CPPDEFINES := $(shell echo foo | $(CROSS)$(CC) -dM -E -) | ||
26 | #build standalone win32 executables on cygwin | ||
27 | ifeq ($(findstring CYGWIN,$(CPPDEFINES)),CYGWIN) | ||
28 | COMPILETARGET = cygwin | ||
29 | else | ||
30 | ifeq ($(findstring MINGW,$(CPPDEFINES)),MINGW) | ||
31 | COMPILETARGET = mingw | ||
32 | else | ||
25 | # OS X specifics. Needs to consider cross compiling for Windows. | 33 | # OS X specifics. Needs to consider cross compiling for Windows. |
26 | ifeq ($(findstring Darwin,$(shell uname)),Darwin) | 34 | ifeq ($(findstring APPLE,$(CPPDEFINES)),APPLE) |
27 | ifneq ($(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. |
31 | CFLAGS += -arch ppc -arch i386 | 38 | ARCHFLAGS = -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. |
34 | CC ?= gcc-4.0 | 41 | CC ?= gcc-4.0 |
35 | CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 | 42 | CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 |
36 | NATIVECC ?= gcc-4.0 | 43 | NATIVECC ?= gcc-4.0 |
44 | COMPILETARGET = darwin | ||
45 | else | ||
46 | COMPILETARGET = posix | ||
47 | endif | ||
37 | endif | 48 | endif |
38 | endif | 49 | endif |
50 | $(info Compiler creates $(COMPILETARGET) binaries) | ||
39 | 51 | ||
40 | TARGET_DIR ?= $(shell pwd)/ | 52 | TARGET_DIR ?= $(shell pwd)/ |
41 | OBJDIR = $(TARGET_DIR)build$(RBARCH) | 53 | OBJDIR = $(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 | ||
71 | clean: | 82 | clean: |
72 | rm -f $(TARGET_DIR)libucl*.a | 83 | rm -f $(TARGET_DIR)libucl*.a |