summaryrefslogtreecommitdiff
path: root/rbutil
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-03 09:44:21 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-03 09:44:21 +0000
commit7de4f64bb6f1630c1b62767f69b7ce00936f5fa1 (patch)
treecdbc7fad4f6da36b48d62ff8171d808edf03484b /rbutil
parentfd5f16c070d5afd6b01a9ff0cdc4ccc1ab01c76a (diff)
Rockbox Utility: build chinachippatcher as library.
Update the chinachip Makefile based on the mkamsboot one, build and link as library for Rockbox Utility. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31117 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r--rbutil/chinachippatcher/Makefile98
-rw-r--r--rbutil/rbutilqt/rbutilqt.pri2
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro7
3 files changed, 98 insertions, 9 deletions
diff --git a/rbutil/chinachippatcher/Makefile b/rbutil/chinachippatcher/Makefile
index fbdb30f4b8..af1e32ab4c 100644
--- a/rbutil/chinachippatcher/Makefile
+++ b/rbutil/chinachippatcher/Makefile
@@ -1,10 +1,96 @@
-CFLAGS=-g -Wall -DSTANDALONE
-CC=gcc
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
-all: chinachip
+#change for releases
+TARGET_DIR ?= $(shell pwd)/
+CFLAGS=-Wall -g
-chinachip: chinachip.c main.c
- $(CC) $(CFLAGS) -o $@ $^
+ifndef V
+SILENT = @
+endif
+
+ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
+OUTPUT=chinachip.exe
+CFLAGS+=-mno-cygwin
+else
+ifeq ($(findstring MINGW,$(shell uname)),MINGW)
+OUTPUT=chinachip.exe
+else
+ifeq ($(findstring mingw,$(CC)),mingw)
+OUTPUT=chinachip.exe
+else
+OUTPUT=chinachip
+endif
+endif
+endif
+
+ifdef RBARCH
+CFLAGS += -arch $(RBARCH)
+OBJDIR = $(TARGET_DIR)build/$(RBARCH)/
+else
+OBJDIR = $(TARGET_DIR)build/
+endif
+
+
+all: $(OUTPUT)
+
+# inputs
+LIBSOURCES := chinachip.c
+SOURCES := $(LIBSOURCES) main.c
+OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES)))
+LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(LIBSOURCES)))
+EXTRADEPS :=
+
+$(OBJDIR)%.o: %.c
+ @echo CC $<
+ $(SILENT)mkdir -p $(dir $@)
+ $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
+
+libchinachip$(RBARCH).a: $(TARGET_DIR)libchinachip$(RBARCH).a
+
+$(TARGET_DIR)libchinachip$(RBARCH).a: $(LIBOBJS)
+ @echo AR $(notdir $@)
+ $(SILENT)$(AR) rucs $@ $^
+
+# building the standalone executable
+$(OUTPUT): $(OBJS) $(EXTRADEPS)
+ @echo LD $@
+ $(SILENT)$(CC) $(CFLAGS) -o $(OUTPUT) $(OBJS) $(EXTRADEPS)
+
+# some trickery to build ppc and i386 from a single call
+ifeq ($(RBARCH),)
+$(TARGET_DIR)libchinachipi386.a:
+ make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libchinachipi386.a
+
+$(TARGET_DIR)libchinachipppc.a:
+ make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libchinachipppc.a
+endif
+
+libchinachip-universal: $(TARGET_DIR)libchinachipi386.a $(TARGET_DIR)libchinachipppc.a
+ @echo lipo $(TARGET_DIR)libchinachip.a
+ $(SILENT) rm -f $(TARGET_DIR)libchinachip.a
+ $(SILENT)lipo -create $(TARGET_DIR)libchinachipppc.a $(TARGET_DIR)libchinachipi386.a -output $(TARGET_DIR)libchinachip.a
clean:
- rm -f chinachip
+ rm -f $(OBJS) $(OUTPUT) libchinachip.o $(TARGET_DIR)libchinachip*.a chinachip.dmg
+ rm -rf chinachip-* i386 ppc $(OBJDIR)
+
+chinachip-i386:
+ $(MAKE) RBARCH=i386
+ mv chinachip chinachip-i386
+
+chinachip-ppc:
+ $(MAKE) RBARCH=ppc
+ mv chinachip chinachip-ppc
+
+chinachip-mac: chinachip-i386 chinachip-ppc
+ $(SILENT)lipo -create chinachip-ppc chinachip-i386 -output chinachip-mac
+
+chinachip.dmg: chinachip-mac
+ mkdir -p chinachip-dmg
+ cp -p chinachip-mac chinachip-dmg
+ hdiutil create -srcfolder chinachip-dmg chinachip.dmg
diff --git a/rbutil/rbutilqt/rbutilqt.pri b/rbutil/rbutilqt/rbutilqt.pri
index 0f887d7070..a0f4d550aa 100644
--- a/rbutil/rbutilqt/rbutilqt.pri
+++ b/rbutil/rbutilqt/rbutilqt.pri
@@ -30,7 +30,6 @@ SOURCES += \
base/autodetection.cpp \
../ipodpatcher/ipodpatcher.c \
../sansapatcher/sansapatcher.c \
- ../chinachippatcher/chinachip.c \
themesinstallwindow.cpp \
base/uninstall.cpp \
uninstallwindow.cpp \
@@ -94,7 +93,6 @@ HEADERS += \
../ipodpatcher/parttypes.h \
../sansapatcher/sansapatcher.h \
../sansapatcher/sansaio.h \
- ../chinachippatcher/chinachip.h \
irivertools/h100sums.h \
irivertools/h120sums.h \
irivertools/h300sums.h \
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index fc547525aa..e8e2ac9fe0 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -95,9 +95,14 @@ libmkmpioboot.commands = @$(MAKE) -s \
APPVERSION=\"rbutil\" \
libmkmpioboot$$RBLIBPOSTFIX \
CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
+libchinachip.commands = @$(MAKE) -s \
+ TARGET_DIR=$$MYBUILDDIR -C $$RBBASE_DIR/rbutil/chinachippatcher \
+ APPVERSION=\"rbutil\" \
+ libchinachip$$RBLIBPOSTFIX \
+ CC=\"$$QMAKE_CC $$MACHINEFLAGS\" AR=\"$$MYAR\"
# Note: order is important for RBLIBS! The libs are appended to the linker
# flags in this order, put libucl at the end.
-RBLIBS = librbspeex libmkamsboot libmktccboot libmkmpioboot libucl
+RBLIBS = librbspeex libmkamsboot libmktccboot libmkmpioboot libchinachip libucl
QMAKE_EXTRA_TARGETS += $$RBLIBS
PRE_TARGETDEPS += $$RBLIBS