summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-15 18:45:00 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-15 18:45:00 +0000
commitdfcb85e62541c828414219106b04a4b20e5e86c6 (patch)
treebdf4aa39b76d70dfafed97b2b2def0c90822bbe2
parent17a0c8348264721abbd311b4b500ee65e900ebd2 (diff)
downloadrockbox-dfcb85e62541c828414219106b04a4b20e5e86c6.tar.gz
rockbox-dfcb85e62541c828414219106b04a4b20e5e86c6.zip
chinachippatcher: convert to use libtools.make.
While at it break some long lines in the program output as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31282 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/chinachippatcher/Makefile94
-rw-r--r--rbutil/chinachippatcher/main.c10
2 files changed, 14 insertions, 90 deletions
diff --git a/rbutil/chinachippatcher/Makefile b/rbutil/chinachippatcher/Makefile
index af1e32ab4c..7575cd9452 100644
--- a/rbutil/chinachippatcher/Makefile
+++ b/rbutil/chinachippatcher/Makefile
@@ -4,93 +4,15 @@
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/ 6# \/ \/ \/ \/ \/
7# $Id$
8#
9CFLAGS = -g -Wall
10CC = gcc
7 11
8#change for releases 12OUTPUT = chinachip
9TARGET_DIR ?= $(shell pwd)/
10CFLAGS=-Wall -g
11 13
12ifndef V 14LIBSOURCES = chinachip.c
13SILENT = @ 15SOURCES = $(LIBSOURCES) main.c
14endif
15 16
16ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) 17include ../libtools.make
17OUTPUT=chinachip.exe
18CFLAGS+=-mno-cygwin
19else
20ifeq ($(findstring MINGW,$(shell uname)),MINGW)
21OUTPUT=chinachip.exe
22else
23ifeq ($(findstring mingw,$(CC)),mingw)
24OUTPUT=chinachip.exe
25else
26OUTPUT=chinachip
27endif
28endif
29endif
30 18
31ifdef RBARCH
32CFLAGS += -arch $(RBARCH)
33OBJDIR = $(TARGET_DIR)build/$(RBARCH)/
34else
35OBJDIR = $(TARGET_DIR)build/
36endif
37
38
39all: $(OUTPUT)
40
41# inputs
42LIBSOURCES := chinachip.c
43SOURCES := $(LIBSOURCES) main.c
44OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES)))
45LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(LIBSOURCES)))
46EXTRADEPS :=
47
48$(OBJDIR)%.o: %.c
49 @echo CC $<
50 $(SILENT)mkdir -p $(dir $@)
51 $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
52
53libchinachip$(RBARCH).a: $(TARGET_DIR)libchinachip$(RBARCH).a
54
55$(TARGET_DIR)libchinachip$(RBARCH).a: $(LIBOBJS)
56 @echo AR $(notdir $@)
57 $(SILENT)$(AR) rucs $@ $^
58
59# building the standalone executable
60$(OUTPUT): $(OBJS) $(EXTRADEPS)
61 @echo LD $@
62 $(SILENT)$(CC) $(CFLAGS) -o $(OUTPUT) $(OBJS) $(EXTRADEPS)
63
64# some trickery to build ppc and i386 from a single call
65ifeq ($(RBARCH),)
66$(TARGET_DIR)libchinachipi386.a:
67 make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libchinachipi386.a
68
69$(TARGET_DIR)libchinachipppc.a:
70 make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libchinachipppc.a
71endif
72
73libchinachip-universal: $(TARGET_DIR)libchinachipi386.a $(TARGET_DIR)libchinachipppc.a
74 @echo lipo $(TARGET_DIR)libchinachip.a
75 $(SILENT) rm -f $(TARGET_DIR)libchinachip.a
76 $(SILENT)lipo -create $(TARGET_DIR)libchinachipppc.a $(TARGET_DIR)libchinachipi386.a -output $(TARGET_DIR)libchinachip.a
77
78clean:
79 rm -f $(OBJS) $(OUTPUT) libchinachip.o $(TARGET_DIR)libchinachip*.a chinachip.dmg
80 rm -rf chinachip-* i386 ppc $(OBJDIR)
81
82chinachip-i386:
83 $(MAKE) RBARCH=i386
84 mv chinachip chinachip-i386
85
86chinachip-ppc:
87 $(MAKE) RBARCH=ppc
88 mv chinachip chinachip-ppc
89
90chinachip-mac: chinachip-i386 chinachip-ppc
91 $(SILENT)lipo -create chinachip-ppc chinachip-i386 -output chinachip-mac
92
93chinachip.dmg: chinachip-mac
94 mkdir -p chinachip-dmg
95 cp -p chinachip-mac chinachip-dmg
96 hdiutil create -srcfolder chinachip-dmg chinachip.dmg
diff --git a/rbutil/chinachippatcher/main.c b/rbutil/chinachippatcher/main.c
index 0553b7d798..e7779774c9 100644
--- a/rbutil/chinachippatcher/main.c
+++ b/rbutil/chinachippatcher/main.c
@@ -22,7 +22,9 @@
22#include <stdarg.h> 22#include <stdarg.h>
23#include "chinachip.h" 23#include "chinachip.h"
24 24
25#ifndef VERSION /* allow setting version from outside for svn builds */
25#define VERSION "0.1" 26#define VERSION "0.1"
27#endif
26#define PRINT(fmt, ...) fprintf(stderr, fmt"\n", ##__VA_ARGS__) 28#define PRINT(fmt, ...) fprintf(stderr, fmt"\n", ##__VA_ARGS__)
27 29
28void usage(char* name) 30void usage(char* name)
@@ -31,16 +33,16 @@ void usage(char* name)
31 PRINT(" %s <firmware> <bootloader> <firmware_output> [backup]", name); 33 PRINT(" %s <firmware> <bootloader> <firmware_output> [backup]", name);
32 PRINT("\nExample:"); 34 PRINT("\nExample:");
33 PRINT(" %s VX747.HXF bootloader.bin output.HXF ccpmp.bak", name); 35 PRINT(" %s VX747.HXF bootloader.bin output.HXF ccpmp.bak", name);
34 PRINT(" This will copy ccpmp.bin in VX747.HXF as ccpmp.old and replace it" 36 PRINT(" This will copy ccpmp.bin in VX747.HXF as ccpmp.old and replace it\n"
35 " with bootloader.bin, the output will get written to output.HXF." 37 " with bootloader.bin, the output will get written to output.HXF.\n"
36 " The old ccpmp.bin will get written to ccpmp.bak."); 38 " The old ccpmp.bin will get written to ccpmp.bak.\n");
37} 39}
38 40
39int main(int argc, char* argv[]) 41int main(int argc, char* argv[])
40{ 42{
41 PRINT("ChinaChipPatcher v" VERSION " - (C) Maurus Cuelenaere 2009"); 43 PRINT("ChinaChipPatcher v" VERSION " - (C) Maurus Cuelenaere 2009");
42 PRINT("This is free software; see the source for copying conditions. There is NO"); 44 PRINT("This is free software; see the source for copying conditions. There is NO");
43 PRINT("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); 45 PRINT("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
44 46
45 if(argc < 4) 47 if(argc < 4)
46 { 48 {