summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/ucl/src/Makefile31
1 files changed, 16 insertions, 15 deletions
diff --git a/tools/ucl/src/Makefile b/tools/ucl/src/Makefile
index c010cdf23c..8875522388 100644
--- a/tools/ucl/src/Makefile
+++ b/tools/ucl/src/Makefile
@@ -16,6 +16,20 @@ ifdef RBARCH
16CFLAGS += -arch $(RBARCH) 16CFLAGS += -arch $(RBARCH)
17endif 17endif
18 18
19# OS X specifics. Needs to consider cross compiling for Windows.
20ifeq ($(findstring Darwin,$(shell uname)),Darwin)
21ifneq ($(findstring mingw,$(CROSS)$(CC)),mingw)
22# when building libs for OS X build for both i386 and ppc at the same time.
23# This creates fat objects, and ar can only create the archive but not operate
24# on it. As a result the ar call must NOT use the u (update) flag.
25CFLAGS += -arch ppc -arch i386
26# building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode)
27# might need adjustment for older Xcode.
28CC ?= gcc-4.0
29CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
30NATIVECC ?= gcc-4.0
31endif
32endif
19 33
20TARGET_DIR ?= $(shell pwd) 34TARGET_DIR ?= $(shell pwd)
21OBJDIR = $(TARGET_DIR)build$(RBARCH) 35OBJDIR = $(TARGET_DIR)build$(RBARCH)
@@ -40,27 +54,14 @@ $(TARGET_DIR)ucl.dll: $(OBJS)
40 54
41$(TARGET_DIR)libucl$(RBARCH).a: $(OBJS) 55$(TARGET_DIR)libucl$(RBARCH).a: $(OBJS)
42 @echo AR $(notdir $@) 56 @echo AR $(notdir $@)
43 $(SILENT)$(CROSS)$(AR) rucs $@ $(OBJS) >/dev/null 2>&1 57 $(SILENT)rm -f $@
58 $(SILENT)$(CROSS)$(AR) rcs $@ $(OBJS) >/dev/null 2>&1
44 59
45$(OBJDIR)/%.o: %.c 60$(OBJDIR)/%.o: %.c
46 @echo CC $< 61 @echo CC $<
47 $(SILENT)mkdir -p $(dir $@) 62 $(SILENT)mkdir -p $(dir $@)
48 $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c $< -o $@ 63 $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c $< -o $@
49 64
50# some trickery to build ppc and i386 from a single call
51ifeq ($(RBARCH),)
52$(TARGET_DIR)libucli386.a:
53 make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libucli386.a
54
55$(TARGET_DIR)libuclppc.a:
56 make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libuclppc.a
57endif
58
59libucl-universal: $(TARGET_DIR)libucli386.a $(TARGET_DIR)libuclppc.a
60 @echo lipo $(TARGET_DIR)libucl.a
61 $(SILENT) rm -f $(TARGET_DIR)libucl.a
62 $(SILENT)lipo -create $(TARGET_DIR)libuclppc.a $(TARGET_DIR)libucli386.a -output $(TARGET_DIR)libucl.a
63
64clean: 65clean:
65 rm -f $(TARGET_DIR)libucl*.a 66 rm -f $(TARGET_DIR)libucl*.a
66 rm -rf build* 67 rm -rf build*