Fix ucl-related makefiles
[maemo-rb.git] / tools / ucl / src / Makefile
blob8a73a53f5f2987d44e9c3a1e4cb6ab628f3bc40d
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
9 CFLAGS += -I../include
11 ifndef V
12 SILENT = @
13 endif
15 ifdef RBARCH
16 CFLAGS += -arch $(RBARCH)
17 endif
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
34 TARGET_DIR ?= $(shell pwd)/
35 OBJDIR = $(TARGET_DIR)build$(RBARCH)
37 SOURCES = alloc.c io.c n2b_99.c n2b_d.c n2b_ds.c n2b_to.c n2d_99.c \
38 n2d_d.c n2d_ds.c n2d_to.c n2e_99.c n2e_d.c n2e_ds.c n2e_to.c ucl_crc.c \
39 ucl_init.c ucl_ptr.c ucl_str.c ucl_util.c #ucl_dll.c
41 OBJS = $(addprefix $(OBJDIR)/,$(SOURCES:%.c=%.o))
43 # This Makefile is _not_ used to build uclpack for Rockbox builds anymore (they
44 # use tools.make), so we can use $(CC) and $(AR) here.
46 libucl$(RBARCH).a: $(TARGET_DIR)libucl$(RBARCH).a
48 dll: ucl.dll
49 ucl.dll: $(TARGET_DIR)ucl.dll
50 $(TARGET_DIR)ucl.dll: $(OBJS)
51 @echo DLL $(notdir $@)
52 $(SILENT)$(CROSS)$(CC) $(CFLAGS) -shared -o $@ $^ \
53 -Wl,--output-def,$(TARGET_DIR)ucl.def
55 $(TARGET_DIR)libucl$(RBARCH).a: $(OBJS)
56 @echo AR $(notdir $@)
57 $(SILENT)rm -f $@
58 $(SILENT)$(CROSS)$(AR) rcs $@ $(OBJS) >/dev/null 2>&1
60 $(OBJDIR)/%.o: %.c
61 @echo CC $<
62 $(SILENT)mkdir -p $(dir $@)
63 $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c $< -o $@
65 clean:
66 rm -f $(TARGET_DIR)libucl*.a
67 rm -rf build*