We have a 3.9 release, update builds.pm
[maemo-rb.git] / rbutil / ipodpatcher / Makefile
blob7c203a94aac41f7b0243181d1a25ef6799cf1272
1 CFLAGS=-Wall -W
3 BOOT_H = ipod1g2g.h ipod3g.h ipod4g.h ipodcolor.h ipodmini1g.h ipodmini2g.h ipodnano1g.h ipodvideo.h
5 # Build with "make BOOTOBJS=1" to build with embedded bootloaders and the
6 # --install option and interactive mode. You need the full set of Rockbox
7 # bootloaders in this directory - download them from
8 # http://download.rockbox.org/bootloader/ipod/bootloaders.zip
10 # Releases of ipodpatcher are created with "make RELEASE=1". This
11 # enables BOOTOBJS and uses the VERSION string defined in main.c
13 ifdef RELEASE
14 CFLAGS+=-DRELEASE
15 BOOTOBJS=1
16 endif
18 ifdef BOOTOBJS
19 BOOTSRC = ipod1g2g.c ipod3g.c ipod4g.c ipodcolor.c ipodmini1g.c ipodmini2g.c ipodnano1g.c ipodvideo.c ipodnano2g.c
20 CFLAGS += -DWITH_BOOTOBJS
21 endif
23 ifndef VERSION
24 VERSION=$(shell ../../tools/version.sh)
25 endif
27 CFLAGS+=-DVERSION=\"$(VERSION)\"
29 ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
30 OUTPUT=ipodpatcher.exe
31 CROSS=
32 CFLAGS+=-mno-cygwin
33 else
34 ifeq ($(findstring MINGW,$(shell uname)),MINGW)
35 OUTPUT=ipodpatcher.exe
36 CROSS=
37 else
38 OUTPUT=ipodpatcher
39 CROSS=i586-mingw32msvc-
40 endif
41 endif
42 ifeq ($(findstring Darwin,$(shell uname)),Darwin)
43 # building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode)
44 # might need adjustment for older Xcode.
45 NATIVECC ?= gcc-4.0
46 CFLAGS+=-framework CoreFoundation -framework IOKit -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
47 endif
49 NATIVECC ?= gcc
50 CC = $(CROSS)gcc
51 WINDRES = $(CROSS)windres
53 SRC = main.c ipodpatcher.c fat32format.c arc4.c
55 all: $(OUTPUT)
57 ipodpatcher: $(SRC) ipodio-posix.c $(BOOTSRC)
58 $(NATIVECC) $(CFLAGS) -o ipodpatcher $(SRC) ipodio-posix.c $(BOOTSRC)
59 strip ipodpatcher
61 ipodpatcher.exe: $(SRC) ipodio-win32.c ipodio-win32-scsi.c ipodpatcher-rc.o $(BOOTSRC)
62 $(CC) $(CFLAGS) -o ipodpatcher.exe $(SRC) ipodio-win32.c ipodio-win32-scsi.c ipodpatcher-rc.o $(BOOTSRC)
63 $(CROSS)strip ipodpatcher.exe
65 ipodpatcher-rc.o: ipodpatcher.rc ipodpatcher.manifest
66 $(WINDRES) -i ipodpatcher.rc -o ipodpatcher-rc.o
68 ipodpatcher-mac: ipodpatcher-i386 ipodpatcher-ppc
69 lipo -create ipodpatcher-ppc ipodpatcher-i386 -output ipodpatcher-mac
71 ipodpatcher-i386: $(SRC) ipodio-posix.c $(BOOTSRC)
72 $(NATIVECC) -arch i386 $(CFLAGS) -o ipodpatcher-i386 $(SRC) ipodio-posix.c $(BOOTSRC)
73 strip ipodpatcher-i386
75 ipodpatcher-ppc: $(SRC) ipodio-posix.c $(BOOTSRC)
76 $(NATIVECC) -arch ppc $(CFLAGS) -o ipodpatcher-ppc $(SRC) ipodio-posix.c $(BOOTSRC)
77 strip ipodpatcher-ppc
79 ipod2c: ipod2c.c
80 $(NATIVECC) $(CFLAGS) -o ipod2c ipod2c.c
82 ipod1g2g.c: bootloader-ipod1g2g.ipod ipod2c
83 ./ipod2c bootloader-ipod1g2g.ipod ipod1g2g
85 ipod3g.c: bootloader-ipod3g.ipod ipod2c
86 ./ipod2c bootloader-ipod3g.ipod ipod3g
88 ipod4g.c: bootloader-ipod4g.ipod ipod2c
89 ./ipod2c bootloader-ipod4g.ipod ipod4g
91 ipodcolor.c: bootloader-ipodcolor.ipod ipod2c
92 ./ipod2c bootloader-ipodcolor.ipod ipodcolor
94 ipodmini1g.c: bootloader-ipodmini1g.ipod ipod2c
95 ./ipod2c bootloader-ipodmini1g.ipod ipodmini1g
97 ipodmini2g.c: bootloader-ipodmini2g.ipod ipod2c
98 ./ipod2c bootloader-ipodmini2g.ipod ipodmini2g
100 ipodnano1g.c: bootloader-ipodnano1g.ipod ipod2c
101 ./ipod2c bootloader-ipodnano1g.ipod ipodnano1g
103 ipodvideo.c: bootloader-ipodvideo.ipod ipod2c
104 ./ipod2c bootloader-ipodvideo.ipod ipodvideo
106 ipodnano2g.c: bootloader-ipodnano2g.ipodx ipod2c
107 ./ipod2c bootloader-ipodnano2g.ipodx ipodnano2g
110 clean:
111 rm -f ipodpatcher.exe ipodpatcher-rc.o ipodpatcher-mac ipodpatcher-i386 ipodpatcher-ppc ipodpatcher ipod2c *~ $(BOOTSRC) $(BOOT_H)