rockbox/lib/skin_parser/Makefile
Dominik Riebeling 8c6b8e6cd5 Theme Editor: make cross compiling on OS X work.
The attempt to detect if building a fat library is necessary for libskin_parser
makes cross compiling fail on OS X. Allow overriding the target platform for
libskin_parser to fix that.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29515 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 12:50:46 +00:00

69 lines
1.8 KiB
Makefile

# __________ __ ___.
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
# \/ \/ \/ \/ \/
# $Id$
#
ifndef V
SILENT = @
endif
CC ?= gcc
AR ?= ar
OUTPUT=libskin_parser
TARGET_DIR ?= ./
# construct build directory if BUILDDIR is not set.
BUILDDIR ?= $(TARGET_DIR)build
TARGETPLATFORM ?= $(shell uname)
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)mkdir -p $(dir $@)
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
ifeq ($(findstring Darwin,$(TARGETPLATFORM)),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
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 $(OBJS) $(OUTPUT) $(TARGET_DIR)$(OUTPUT)*.a
ifeq ($(findstring Darwin,$(shell uname)),Darwin)
endif