blob: 9c5bec1bdf4fdc4d999c1e9211f8f5dcf4e5cad9 [file] [log] [blame]
Dave Chapmanf119dc02007-07-29 21:47:05 +00001CFLAGS=-Wall -W -D_LARGEFILE64_SOURCE
Dave Chapmane17043e2007-03-15 22:55:36 +00002
3ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
4OUTPUT=sansapatcher.exe
5CROSS=
6CFLAGS+=-mno-cygwin
7else
Dominik Riebeling919caf02008-01-06 11:55:55 +00008ifeq ($(findstring MINGW,$(shell uname)),MINGW)
9OUTPUT=sansapatcher.exe
Dominik Riebelingccd8f6c2008-01-26 22:19:27 +000010CROSS=
Dominik Riebeling919caf02008-01-06 11:55:55 +000011else
Dave Chapmane17043e2007-03-15 22:55:36 +000012OUTPUT=sansapatcher
13CROSS=i586-mingw32msvc-
14endif
Dominik Riebeling919caf02008-01-06 11:55:55 +000015endif
Dave Chapmane17043e2007-03-15 22:55:36 +000016
17NATIVECC = gcc
18CC = $(CROSS)gcc
Dominik Wenger4e8d6142008-01-20 21:19:37 +000019WINDRES = $(CROSS)windres
Dave Chapmane17043e2007-03-15 22:55:36 +000020
21all: $(OUTPUT)
22
Dave Chapman8d145a52007-09-19 18:46:54 +000023sansapatcher: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
24 gcc $(CFLAGS) -o sansapatcher main.c sansapatcher.c sansaio-posix.c bootimg_c200.c bootimg_e200.c
Dave Chapmane17043e2007-03-15 22:55:36 +000025 strip sansapatcher
26
Dominik Wenger4e8d6142008-01-20 21:19:37 +000027sansapatcher.exe: main.c sansapatcher.c sansaio-win32.c parttypes.h bootimg_c200.c bootimg_e200.c sansapatcher-rc.o
28 $(CC) $(CFLAGS) -o sansapatcher.exe main.c sansapatcher.c sansaio-win32.c bootimg_c200.c bootimg_e200.c sansapatcher-rc.o
Dave Chapmane17043e2007-03-15 22:55:36 +000029 $(CROSS)strip sansapatcher.exe
30
Dominik Wenger4e8d6142008-01-20 21:19:37 +000031sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest
32 $(WINDRES) -i sansapatcher.rc -o sansapatcher-rc.o
33
Dave Chapmane17043e2007-03-15 22:55:36 +000034sansapatcher-mac: sansapatcher-i386 sansapatcher-ppc
35 lipo -create sansapatcher-ppc sansapatcher-i386 -output sansapatcher-mac
36
Dave Chapman8d145a52007-09-19 18:46:54 +000037sansapatcher-i386: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
Barry Wardell386f77b2008-03-25 19:50:41 +000038 gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 $(CFLAGS) -o sansapatcher-i386 main.c sansapatcher.c sansaio-posix.c bootimg_c200.c bootimg_e200.c
Dave Chapmane17043e2007-03-15 22:55:36 +000039 strip sansapatcher-i386
40
Dave Chapman8d145a52007-09-19 18:46:54 +000041sansapatcher-ppc: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
Barry Wardell386f77b2008-03-25 19:50:41 +000042 gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc $(CFLAGS) -o sansapatcher-ppc main.c sansapatcher.c sansaio-posix.c bootimg_c200.c bootimg_e200.c
Dave Chapmane17043e2007-03-15 22:55:36 +000043 strip sansapatcher-ppc
44
Dave Chapmane8156012007-03-15 23:26:47 +000045bin2c: bin2c.c
46 $(NATIVECC) $(CFLAGS) -o bin2c bin2c.c
Dave Chapmane17043e2007-03-15 22:55:36 +000047
Dave Chapman8d145a52007-09-19 18:46:54 +000048bootimg_c200.c: firmware.mi4 bin2c
49 ./bin2c firmware.mi4 bootimg_c200
50
51bootimg_e200.c: PP5022.mi4 bin2c
52 ./bin2c PP5022.mi4 bootimg_e200
Dave Chapmane17043e2007-03-15 22:55:36 +000053
54clean:
Dave Chapman8d145a52007-09-19 18:46:54 +000055 rm -f sansapatcher.exe sansapatcher-mac sansapatcher-i386 sansapatcher-ppc sansapatcher bin2c bootimg_c200.c bootimg_c200.h bootimg_e200.c bootimg_e200.h *~