summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2010-07-06 21:08:16 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2010-07-06 21:08:16 +0000
commite464128c546748edc9b54355a7cc45ab1b71f6eb (patch)
tree3f9ad2d48d142d4237e8bcdc7287153d5a4166ca /lib
parenteccc2bd009e967e45d38a573080d13a1339eb0a6 (diff)
downloadrockbox-e464128c546748edc9b54355a7cc45ab1b71f6eb.tar.gz
rockbox-e464128c546748edc9b54355a7cc45ab1b71f6eb.tar.bz2
rockbox-e464128c546748edc9b54355a7cc45ab1b71f6eb.zip
Rework libskin_parser Makefile for OS X support.
- add similar trickery that is used for the libraries used by Rockbox Utility to allow building as universal binary. - don't overwrite CC, we need to set this from outside for building OS X 10.4 compatible binaries. - extend Theme Editor project file to build 10.4 compatible binaries on OS X. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27323 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'lib')
-rw-r--r--lib/skin_parser/Makefile61
1 files changed, 48 insertions, 13 deletions
diff --git a/lib/skin_parser/Makefile b/lib/skin_parser/Makefile
index cdce7bb0c4..ac933f77de 100644
--- a/lib/skin_parser/Makefile
+++ b/lib/skin_parser/Makefile
@@ -7,27 +7,62 @@
# $Id$
#
-BUILDDIR ?= .
ifndef V
SILENT = @
endif
-SRC = skin_buffer.c skin_parser.c skin_debug.c skin_scan.c tag_table.c
-OBJ := $(patsubst %.c,$(BUILDDIR)/%.o,$(SRC))
-OUT = $(BUILDDIR)/libskin_parser.a
-CC = gcc
+CC ?= gcc
AR = ar
-INCLUDES = -I.
+OUTPUT=libskin_parser
+TARGET_DIR ?= ./
-default: $(OUT)
+# construct build directory if BUILDDIR is not set.
+BUILDDIR ?= $(TARGET_DIR)build
-$(BUILDDIR)/%.o: %.c
+ifdef RBARCH
+CFLAGS += -arch $(RBARCH)
+OBJDIR = $(BUILDDIR)/$(RBARCH)/
+else
+OBJDIR = $(BUILDDIR)/
+endif
+
+# input files
+SOURCES := skin_buffer.c skin_debug.c skin_parser.c skin_scan.c tag_table.c
+OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES)))
+
+all: $(OUTPUT).a
+
+$(OBJDIR)%.o: %.c
@echo CC $<
- $(SILENT)$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
+ $(SILENT)mkdir -p $(dir $@)
+ $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
+
+ifeq ($(findstring Darwin,$(shell uname)),Darwin)
+# some trickery to build ppc and i386 from a single call
+$(OUTPUT).a: $(TARGET_DIR)$(OUTPUT)i386.a $(TARGET_DIR)$(OUTPUT)ppc.a
+ @echo lipo $(TARGET_DIR)$@
+ $(SILENT) rm -f $(TARGET_DIR)$(OUTPUT)
+ $(SILENT)lipo -create $(TARGET_DIR)$(OUTPUT)ppc.a $(TARGET_DIR)$(OUTPUT)i386.a -output $(TARGET_DIR)$(OUTPUT).a
-$(OUT): $(OBJ)
- @echo AR $(notdir $(OUT))
- $(SILENT)$(AR) rcs $(OUT) $(OBJ)
+ifneq ($(RBARCH),)
+$(OUTPUT)$(RBARCH).a: $(OBJS)
+ @echo AR $@
+ $(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
+else
+$(TARGET_DIR)$(OUTPUT)i386.a:
+ make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) $(OUTPUT)i386.a
+
+$(TARGET_DIR)$(OUTPUT)ppc.a:
+ make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) $(OUTPUT)ppc.a
+endif
+else
+$(OUTPUT).a: $(OBJS)
+ @echo AR $@
+ $(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
+endif
clean:
- rm -f $(OBJ) $(OUT)
+ rm -f $(OBJS) $(OUTPUT) $(TARGET_DIR)$(OUTPUT)*.a
+ifeq ($(findstring Darwin,$(shell uname)),Darwin)
+endif
+