blob: 7c203a94aac41f7b0243181d1a25ef6799cf1272 [file] [log] [blame]
Dave Chapman2cc80f52007-07-29 21:19:14 +00001CFLAGS=-Wall -W
Jens Arnold7170a002007-02-05 00:50:49 +00002
Dave Chapman5742f892009-12-09 13:13:58 +00003BOOT_H = ipod1g2g.h ipod3g.h ipod4g.h ipodcolor.h ipodmini1g.h ipodmini2g.h ipodnano1g.h ipodvideo.h
Dave Chapmanbdc27ff2007-02-08 18:05:50 +00004
Dave Chapman4cb879d2010-01-28 09:20:32 +00005# Build with "make BOOTOBJS=1" to build with embedded bootloaders and the
Dave Chapmanbdc27ff2007-02-08 18:05:50 +00006# --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 Chapman4cb879d2010-01-28 09:20:32 +000010# Releases of ipodpatcher are created with "make RELEASE=1". This
11# enables BOOTOBJS and uses the VERSION string defined in main.c
12
Dave Chapman8e95cc42009-10-13 08:02:59 +000013ifdef RELEASE
14CFLAGS+=-DRELEASE
15BOOTOBJS=1
16endif
17
18ifdef BOOTOBJS
Dave Chapman5742f892009-12-09 13:13:58 +000019BOOTSRC = ipod1g2g.c ipod3g.c ipod4g.c ipodcolor.c ipodmini1g.c ipodmini2g.c ipodnano1g.c ipodvideo.c ipodnano2g.c
Dave Chapman8e95cc42009-10-13 08:02:59 +000020CFLAGS += -DWITH_BOOTOBJS
21endif
22
23ifndef VERSION
24VERSION=$(shell ../../tools/version.sh)
25endif
26
27CFLAGS+=-DVERSION=\"$(VERSION)\"
Dave Chapmanbdc27ff2007-02-08 18:05:50 +000028
Jens Arnold7170a002007-02-05 00:50:49 +000029ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
30OUTPUT=ipodpatcher.exe
31CROSS=
32CFLAGS+=-mno-cygwin
Dominik Riebeling919caf02008-01-06 11:55:55 +000033else
34ifeq ($(findstring MINGW,$(shell uname)),MINGW)
35OUTPUT=ipodpatcher.exe
36CROSS=
Jens Arnold7170a002007-02-05 00:50:49 +000037else
38OUTPUT=ipodpatcher
39CROSS=i586-mingw32msvc-
40endif
Dominik Riebeling919caf02008-01-06 11:55:55 +000041endif
Dominik Riebelingc8d13b62010-01-30 17:02:37 +000042ifeq ($(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.
45NATIVECC ?= gcc-4.0
46CFLAGS+=-framework CoreFoundation -framework IOKit -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4
47endif
Jens Arnold7170a002007-02-05 00:50:49 +000048
Dominik Riebelingc8d13b62010-01-30 17:02:37 +000049NATIVECC ?= gcc
Dave Chapmanbdc27ff2007-02-08 18:05:50 +000050CC = $(CROSS)gcc
Jens Arnold4ce93682007-09-21 06:24:17 +000051WINDRES = $(CROSS)windres
Dave Chapmanbdc27ff2007-02-08 18:05:50 +000052
Bertrik Sikken0d760c12008-08-30 09:49:00 +000053SRC = main.c ipodpatcher.c fat32format.c arc4.c
Dave Chapman56780e32007-06-16 22:32:57 +000054
Jens Arnold7170a002007-02-05 00:50:49 +000055all: $(OUTPUT)
Dave Chapman45895df2006-12-13 08:57:06 +000056
Dave Chapman56780e32007-06-16 22:32:57 +000057ipodpatcher: $(SRC) ipodio-posix.c $(BOOTSRC)
Dominik Riebelingc8d13b62010-01-30 17:02:37 +000058 $(NATIVECC) $(CFLAGS) -o ipodpatcher $(SRC) ipodio-posix.c $(BOOTSRC)
Jens Arnold7170a002007-02-05 00:50:49 +000059 strip ipodpatcher
Dave Chapman4b7e1e02006-12-13 09:02:18 +000060
Dave Chapman1eca02d2009-08-04 20:32:30 +000061ipodpatcher.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 Arnold7170a002007-02-05 00:50:49 +000063 $(CROSS)strip ipodpatcher.exe
Dave Chapman45895df2006-12-13 08:57:06 +000064
Jens Arnold4ce93682007-09-21 06:24:17 +000065ipodpatcher-rc.o: ipodpatcher.rc ipodpatcher.manifest
66 $(WINDRES) -i ipodpatcher.rc -o ipodpatcher-rc.o
67
Dave Chapman1602bf52007-03-03 10:57:32 +000068ipodpatcher-mac: ipodpatcher-i386 ipodpatcher-ppc
69 lipo -create ipodpatcher-ppc ipodpatcher-i386 -output ipodpatcher-mac
70
Dave Chapman56780e32007-06-16 22:32:57 +000071ipodpatcher-i386: $(SRC) ipodio-posix.c $(BOOTSRC)
Dominik Riebelingc8d13b62010-01-30 17:02:37 +000072 $(NATIVECC) -arch i386 $(CFLAGS) -o ipodpatcher-i386 $(SRC) ipodio-posix.c $(BOOTSRC)
Dave Chapman1602bf52007-03-03 10:57:32 +000073 strip ipodpatcher-i386
74
Dave Chapman56780e32007-06-16 22:32:57 +000075ipodpatcher-ppc: $(SRC) ipodio-posix.c $(BOOTSRC)
Dominik Riebelingc8d13b62010-01-30 17:02:37 +000076 $(NATIVECC) -arch ppc $(CFLAGS) -o ipodpatcher-ppc $(SRC) ipodio-posix.c $(BOOTSRC)
Dave Chapman1602bf52007-03-03 10:57:32 +000077 strip ipodpatcher-ppc
78
Dave Chapmanbdc27ff2007-02-08 18:05:50 +000079ipod2c: ipod2c.c
80 $(NATIVECC) $(CFLAGS) -o ipod2c ipod2c.c
81
Dave Chapman6a20def2007-07-26 20:21:11 +000082ipod1g2g.c: bootloader-ipod1g2g.ipod ipod2c
83 ./ipod2c bootloader-ipod1g2g.ipod ipod1g2g
84
Dave Chapmanbdc27ff2007-02-08 18:05:50 +000085ipod3g.c: bootloader-ipod3g.ipod ipod2c
86 ./ipod2c bootloader-ipod3g.ipod ipod3g
87
88ipod4g.c: bootloader-ipod4g.ipod ipod2c
89 ./ipod2c bootloader-ipod4g.ipod ipod4g
90
91ipodcolor.c: bootloader-ipodcolor.ipod ipod2c
92 ./ipod2c bootloader-ipodcolor.ipod ipodcolor
93
Björn Stenbergc0740442009-12-07 12:19:08 +000094ipodmini1g.c: bootloader-ipodmini1g.ipod ipod2c
95 ./ipod2c bootloader-ipodmini1g.ipod ipodmini1g
Dave Chapmanbdc27ff2007-02-08 18:05:50 +000096
97ipodmini2g.c: bootloader-ipodmini2g.ipod ipod2c
98 ./ipod2c bootloader-ipodmini2g.ipod ipodmini2g
99
Björn Stenbergc0740442009-12-07 12:19:08 +0000100ipodnano1g.c: bootloader-ipodnano1g.ipod ipod2c
101 ./ipod2c bootloader-ipodnano1g.ipod ipodnano1g
Dave Chapmanbdc27ff2007-02-08 18:05:50 +0000102
103ipodvideo.c: bootloader-ipodvideo.ipod ipod2c
104 ./ipod2c bootloader-ipodvideo.ipod ipodvideo
105
Dave Chapman8e95cc42009-10-13 08:02:59 +0000106ipodnano2g.c: bootloader-ipodnano2g.ipodx ipod2c
107 ./ipod2c bootloader-ipodnano2g.ipodx ipodnano2g
108
Dave Chapmanbdc27ff2007-02-08 18:05:50 +0000109
Dave Chapman45895df2006-12-13 08:57:06 +0000110clean:
Jens Arnold2a612592007-09-21 06:52:45 +0000111 rm -f ipodpatcher.exe ipodpatcher-rc.o ipodpatcher-mac ipodpatcher-i386 ipodpatcher-ppc ipodpatcher ipod2c *~ $(BOOTSRC) $(BOOT_H)