Dave Chapman | 2cc80f5 | 2007-07-29 21:19:14 +0000 | [diff] [blame] | 1 | CFLAGS=-Wall -W |
Jens Arnold | 7170a00 | 2007-02-05 00:50:49 +0000 | [diff] [blame] | 2 | |
Dave Chapman | 5742f89 | 2009-12-09 13:13:58 +0000 | [diff] [blame] | 3 | BOOT_H = ipod1g2g.h ipod3g.h ipod4g.h ipodcolor.h ipodmini1g.h ipodmini2g.h ipodnano1g.h ipodvideo.h |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 4 | |
Dave Chapman | 4cb879d | 2010-01-28 09:20:32 +0000 | [diff] [blame] | 5 | # Build with "make BOOTOBJS=1" to build with embedded bootloaders and the |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 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 |
| 9 | |
Dave Chapman | 4cb879d | 2010-01-28 09:20:32 +0000 | [diff] [blame] | 10 | # Releases of ipodpatcher are created with "make RELEASE=1". This |
| 11 | # enables BOOTOBJS and uses the VERSION string defined in main.c |
| 12 | |
Dave Chapman | 8e95cc4 | 2009-10-13 08:02:59 +0000 | [diff] [blame] | 13 | ifdef RELEASE |
| 14 | CFLAGS+=-DRELEASE |
| 15 | BOOTOBJS=1 |
| 16 | endif |
| 17 | |
| 18 | ifdef BOOTOBJS |
Dave Chapman | 5742f89 | 2009-12-09 13:13:58 +0000 | [diff] [blame] | 19 | BOOTSRC = ipod1g2g.c ipod3g.c ipod4g.c ipodcolor.c ipodmini1g.c ipodmini2g.c ipodnano1g.c ipodvideo.c ipodnano2g.c |
Dave Chapman | 8e95cc4 | 2009-10-13 08:02:59 +0000 | [diff] [blame] | 20 | CFLAGS += -DWITH_BOOTOBJS |
| 21 | endif |
| 22 | |
| 23 | ifndef VERSION |
| 24 | VERSION=$(shell ../../tools/version.sh) |
| 25 | endif |
| 26 | |
| 27 | CFLAGS+=-DVERSION=\"$(VERSION)\" |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 28 | |
Jens Arnold | 7170a00 | 2007-02-05 00:50:49 +0000 | [diff] [blame] | 29 | ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) |
| 30 | OUTPUT=ipodpatcher.exe |
| 31 | CROSS= |
| 32 | CFLAGS+=-mno-cygwin |
Dominik Riebeling | 919caf0 | 2008-01-06 11:55:55 +0000 | [diff] [blame] | 33 | else |
| 34 | ifeq ($(findstring MINGW,$(shell uname)),MINGW) |
| 35 | OUTPUT=ipodpatcher.exe |
| 36 | CROSS= |
Jens Arnold | 7170a00 | 2007-02-05 00:50:49 +0000 | [diff] [blame] | 37 | else |
| 38 | OUTPUT=ipodpatcher |
| 39 | CROSS=i586-mingw32msvc- |
| 40 | endif |
Dominik Riebeling | 919caf0 | 2008-01-06 11:55:55 +0000 | [diff] [blame] | 41 | endif |
Dominik Riebeling | c8d13b6 | 2010-01-30 17:02:37 +0000 | [diff] [blame] | 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 |
Jens Arnold | 7170a00 | 2007-02-05 00:50:49 +0000 | [diff] [blame] | 48 | |
Dominik Riebeling | c8d13b6 | 2010-01-30 17:02:37 +0000 | [diff] [blame] | 49 | NATIVECC ?= gcc |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 50 | CC = $(CROSS)gcc |
Jens Arnold | 4ce9368 | 2007-09-21 06:24:17 +0000 | [diff] [blame] | 51 | WINDRES = $(CROSS)windres |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 52 | |
Bertrik Sikken | 0d760c1 | 2008-08-30 09:49:00 +0000 | [diff] [blame] | 53 | SRC = main.c ipodpatcher.c fat32format.c arc4.c |
Dave Chapman | 56780e3 | 2007-06-16 22:32:57 +0000 | [diff] [blame] | 54 | |
Jens Arnold | 7170a00 | 2007-02-05 00:50:49 +0000 | [diff] [blame] | 55 | all: $(OUTPUT) |
Dave Chapman | 45895df | 2006-12-13 08:57:06 +0000 | [diff] [blame] | 56 | |
Dave Chapman | 56780e3 | 2007-06-16 22:32:57 +0000 | [diff] [blame] | 57 | ipodpatcher: $(SRC) ipodio-posix.c $(BOOTSRC) |
Dominik Riebeling | c8d13b6 | 2010-01-30 17:02:37 +0000 | [diff] [blame] | 58 | $(NATIVECC) $(CFLAGS) -o ipodpatcher $(SRC) ipodio-posix.c $(BOOTSRC) |
Jens Arnold | 7170a00 | 2007-02-05 00:50:49 +0000 | [diff] [blame] | 59 | strip ipodpatcher |
Dave Chapman | 4b7e1e0 | 2006-12-13 09:02:18 +0000 | [diff] [blame] | 60 | |
Dave Chapman | 1eca02d | 2009-08-04 20:32:30 +0000 | [diff] [blame] | 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) |
Jens Arnold | 7170a00 | 2007-02-05 00:50:49 +0000 | [diff] [blame] | 63 | $(CROSS)strip ipodpatcher.exe |
Dave Chapman | 45895df | 2006-12-13 08:57:06 +0000 | [diff] [blame] | 64 | |
Jens Arnold | 4ce9368 | 2007-09-21 06:24:17 +0000 | [diff] [blame] | 65 | ipodpatcher-rc.o: ipodpatcher.rc ipodpatcher.manifest |
| 66 | $(WINDRES) -i ipodpatcher.rc -o ipodpatcher-rc.o |
| 67 | |
Dave Chapman | 1602bf5 | 2007-03-03 10:57:32 +0000 | [diff] [blame] | 68 | ipodpatcher-mac: ipodpatcher-i386 ipodpatcher-ppc |
| 69 | lipo -create ipodpatcher-ppc ipodpatcher-i386 -output ipodpatcher-mac |
| 70 | |
Dave Chapman | 56780e3 | 2007-06-16 22:32:57 +0000 | [diff] [blame] | 71 | ipodpatcher-i386: $(SRC) ipodio-posix.c $(BOOTSRC) |
Dominik Riebeling | c8d13b6 | 2010-01-30 17:02:37 +0000 | [diff] [blame] | 72 | $(NATIVECC) -arch i386 $(CFLAGS) -o ipodpatcher-i386 $(SRC) ipodio-posix.c $(BOOTSRC) |
Dave Chapman | 1602bf5 | 2007-03-03 10:57:32 +0000 | [diff] [blame] | 73 | strip ipodpatcher-i386 |
| 74 | |
Dave Chapman | 56780e3 | 2007-06-16 22:32:57 +0000 | [diff] [blame] | 75 | ipodpatcher-ppc: $(SRC) ipodio-posix.c $(BOOTSRC) |
Dominik Riebeling | c8d13b6 | 2010-01-30 17:02:37 +0000 | [diff] [blame] | 76 | $(NATIVECC) -arch ppc $(CFLAGS) -o ipodpatcher-ppc $(SRC) ipodio-posix.c $(BOOTSRC) |
Dave Chapman | 1602bf5 | 2007-03-03 10:57:32 +0000 | [diff] [blame] | 77 | strip ipodpatcher-ppc |
| 78 | |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 79 | ipod2c: ipod2c.c |
| 80 | $(NATIVECC) $(CFLAGS) -o ipod2c ipod2c.c |
| 81 | |
Dave Chapman | 6a20def | 2007-07-26 20:21:11 +0000 | [diff] [blame] | 82 | ipod1g2g.c: bootloader-ipod1g2g.ipod ipod2c |
| 83 | ./ipod2c bootloader-ipod1g2g.ipod ipod1g2g |
| 84 | |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 85 | ipod3g.c: bootloader-ipod3g.ipod ipod2c |
| 86 | ./ipod2c bootloader-ipod3g.ipod ipod3g |
| 87 | |
| 88 | ipod4g.c: bootloader-ipod4g.ipod ipod2c |
| 89 | ./ipod2c bootloader-ipod4g.ipod ipod4g |
| 90 | |
| 91 | ipodcolor.c: bootloader-ipodcolor.ipod ipod2c |
| 92 | ./ipod2c bootloader-ipodcolor.ipod ipodcolor |
| 93 | |
Björn Stenberg | c074044 | 2009-12-07 12:19:08 +0000 | [diff] [blame] | 94 | ipodmini1g.c: bootloader-ipodmini1g.ipod ipod2c |
| 95 | ./ipod2c bootloader-ipodmini1g.ipod ipodmini1g |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 96 | |
| 97 | ipodmini2g.c: bootloader-ipodmini2g.ipod ipod2c |
| 98 | ./ipod2c bootloader-ipodmini2g.ipod ipodmini2g |
| 99 | |
Björn Stenberg | c074044 | 2009-12-07 12:19:08 +0000 | [diff] [blame] | 100 | ipodnano1g.c: bootloader-ipodnano1g.ipod ipod2c |
| 101 | ./ipod2c bootloader-ipodnano1g.ipod ipodnano1g |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 102 | |
| 103 | ipodvideo.c: bootloader-ipodvideo.ipod ipod2c |
| 104 | ./ipod2c bootloader-ipodvideo.ipod ipodvideo |
| 105 | |
Dave Chapman | 8e95cc4 | 2009-10-13 08:02:59 +0000 | [diff] [blame] | 106 | ipodnano2g.c: bootloader-ipodnano2g.ipodx ipod2c |
| 107 | ./ipod2c bootloader-ipodnano2g.ipodx ipodnano2g |
| 108 | |
Dave Chapman | bdc27ff | 2007-02-08 18:05:50 +0000 | [diff] [blame] | 109 | |
Dave Chapman | 45895df | 2006-12-13 08:57:06 +0000 | [diff] [blame] | 110 | clean: |
Jens Arnold | 2a61259 | 2007-09-21 06:52:45 +0000 | [diff] [blame] | 111 | rm -f ipodpatcher.exe ipodpatcher-rc.o ipodpatcher-mac ipodpatcher-i386 ipodpatcher-ppc ipodpatcher ipod2c *~ $(BOOTSRC) $(BOOT_H) |