diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-12-15 18:45:00 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-12-15 18:45:00 +0000 |
commit | dfcb85e62541c828414219106b04a4b20e5e86c6 (patch) | |
tree | bdf4aa39b76d70dfafed97b2b2def0c90822bbe2 | |
parent | 17a0c8348264721abbd311b4b500ee65e900ebd2 (diff) | |
download | rockbox-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/Makefile | 94 | ||||
-rw-r--r-- | rbutil/chinachippatcher/main.c | 10 |
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 | # | ||
9 | CFLAGS = -g -Wall | ||
10 | CC = gcc | ||
7 | 11 | ||
8 | #change for releases | 12 | OUTPUT = chinachip |
9 | TARGET_DIR ?= $(shell pwd)/ | ||
10 | CFLAGS=-Wall -g | ||
11 | 13 | ||
12 | ifndef V | 14 | LIBSOURCES = chinachip.c |
13 | SILENT = @ | 15 | SOURCES = $(LIBSOURCES) main.c |
14 | endif | ||
15 | 16 | ||
16 | ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) | 17 | include ../libtools.make |
17 | OUTPUT=chinachip.exe | ||
18 | CFLAGS+=-mno-cygwin | ||
19 | else | ||
20 | ifeq ($(findstring MINGW,$(shell uname)),MINGW) | ||
21 | OUTPUT=chinachip.exe | ||
22 | else | ||
23 | ifeq ($(findstring mingw,$(CC)),mingw) | ||
24 | OUTPUT=chinachip.exe | ||
25 | else | ||
26 | OUTPUT=chinachip | ||
27 | endif | ||
28 | endif | ||
29 | endif | ||
30 | 18 | ||
31 | ifdef RBARCH | ||
32 | CFLAGS += -arch $(RBARCH) | ||
33 | OBJDIR = $(TARGET_DIR)build/$(RBARCH)/ | ||
34 | else | ||
35 | OBJDIR = $(TARGET_DIR)build/ | ||
36 | endif | ||
37 | |||
38 | |||
39 | all: $(OUTPUT) | ||
40 | |||
41 | # inputs | ||
42 | LIBSOURCES := chinachip.c | ||
43 | SOURCES := $(LIBSOURCES) main.c | ||
44 | OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES))) | ||
45 | LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(LIBSOURCES))) | ||
46 | EXTRADEPS := | ||
47 | |||
48 | $(OBJDIR)%.o: %.c | ||
49 | @echo CC $< | ||
50 | $(SILENT)mkdir -p $(dir $@) | ||
51 | $(SILENT)$(CC) $(CFLAGS) -c -o $@ $< | ||
52 | |||
53 | libchinachip$(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 | ||
65 | ifeq ($(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 | ||
71 | endif | ||
72 | |||
73 | libchinachip-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 | |||
78 | clean: | ||
79 | rm -f $(OBJS) $(OUTPUT) libchinachip.o $(TARGET_DIR)libchinachip*.a chinachip.dmg | ||
80 | rm -rf chinachip-* i386 ppc $(OBJDIR) | ||
81 | |||
82 | chinachip-i386: | ||
83 | $(MAKE) RBARCH=i386 | ||
84 | mv chinachip chinachip-i386 | ||
85 | |||
86 | chinachip-ppc: | ||
87 | $(MAKE) RBARCH=ppc | ||
88 | mv chinachip chinachip-ppc | ||
89 | |||
90 | chinachip-mac: chinachip-i386 chinachip-ppc | ||
91 | $(SILENT)lipo -create chinachip-ppc chinachip-i386 -output chinachip-mac | ||
92 | |||
93 | chinachip.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 | ||
28 | void usage(char* name) | 30 | void 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 | ||
39 | int main(int argc, char* argv[]) | 41 | int 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 | { |