diff options
Diffstat (limited to 'tools/ucl/src/Makefile')
-rw-r--r-- | tools/ucl/src/Makefile | 31 |
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 | |||
16 | CFLAGS += -arch $(RBARCH) | 16 | CFLAGS += -arch $(RBARCH) |
17 | endif | 17 | endif |
18 | 18 | ||
19 | # OS X specifics. Needs to consider cross compiling for Windows. | ||
20 | ifeq ($(findstring Darwin,$(shell uname)),Darwin) | ||
21 | ifneq ($(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. | ||
25 | CFLAGS += -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. | ||
28 | CC ?= gcc-4.0 | ||
29 | CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 | ||
30 | NATIVECC ?= gcc-4.0 | ||
31 | endif | ||
32 | endif | ||
19 | 33 | ||
20 | TARGET_DIR ?= $(shell pwd) | 34 | TARGET_DIR ?= $(shell pwd) |
21 | OBJDIR = $(TARGET_DIR)build$(RBARCH) | 35 | OBJDIR = $(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 | ||
51 | ifeq ($(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 | ||
57 | endif | ||
58 | |||
59 | libucl-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 | |||
64 | clean: | 65 | clean: |
65 | rm -f $(TARGET_DIR)libucl*.a | 66 | rm -f $(TARGET_DIR)libucl*.a |
66 | rm -rf build* | 67 | rm -rf build* |