Merge branch 'master' into sim-target-tree
[kugel-rb.git] / tools / ucl / src / Makefile
blobc519844e933cdf8a3335f94237816e0e8627d7bc
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
20 OUT = $(TARGET_DIR)build$(RBARCH)
22 SOURCES = alloc.c io.c n2b_99.c n2b_d.c n2b_ds.c n2b_to.c n2d_99.c \
23 n2d_d.c n2d_ds.c n2d_to.c n2e_99.c n2e_d.c n2e_ds.c n2e_to.c ucl_crc.c \
24 ucl_dll.c ucl_init.c ucl_ptr.c ucl_str.c ucl_util.c
26 OBJS = $(OUT)/alloc.o $(OUT)/io.o $(OUT)/n2b_99.o $(OUT)/n2b_d.o $(OUT)/n2b_ds.o $(OUT)/n2b_to.o $(OUT)/n2d_99.o \
27 $(OUT)/n2d_d.o $(OUT)/n2d_ds.o $(OUT)/n2d_to.o $(OUT)/n2e_99.o $(OUT)/n2e_d.o $(OUT)/n2e_ds.o $(OUT)/n2e_to.o $(OUT)/ucl_crc.o \
28 $(OUT)/ucl_dll.o $(OUT)/ucl_init.o $(OUT)/ucl_ptr.o $(OUT)/ucl_str.o $(OUT)/ucl_util.o
30 # we don't use $(AR) and $(RANLIB) below since we want the _native_ tools
31 # not the cross-compiler tools
32 libucl$(RBARCH).a: $(OUT) $(OBJS)
33 $(SILENT)ar ruv $(TARGET_DIR)$@ $(OBJS) >/dev/null 2>&1
34 $(SILENT)ranlib $(TARGET_DIR)$@
36 $(OUT)/%.o: %.c
37 @echo CC $<
38 $(SILENT)$(CC) $(CFLAGS) -c $< -o $@
40 # some trickery to build ppc and i386 from a single call
41 ifeq ($(RBARCH),)
42 $(TARGET_DIR)libucli386.a:
43 make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libucli386.a
45 $(TARGET_DIR)libuclppc.a:
46 make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libuclppc.a
47 endif
49 libucl-universal: $(TARGET_DIR)libucli386.a $(TARGET_DIR)libuclppc.a
50 @echo lipo $(TARGET_DIR)libucl.a
51 $(SILENT) rm -f $(TARGET_DIR)libucl.a
52 $(SILENT)lipo -create $(TARGET_DIR)libuclppc.a $(TARGET_DIR)libucli386.a -output $(TARGET_DIR)libucl.a
54 clean:
55 rm -f $(TARGET_DIR)libucl*.a
56 rm -rf build*
58 $(OUT):
59 @echo MKDIR $(OUT)
60 $(SILENT)mkdir $(OUT)