Dave Chapman | f119dc0 | 2007-07-29 21:47:05 +0000 | [diff] [blame] | 1 | CFLAGS=-Wall -W -D_LARGEFILE64_SOURCE |
Dave Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 2 | |
| 3 | ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) |
| 4 | OUTPUT=sansapatcher.exe |
| 5 | CROSS= |
| 6 | CFLAGS+=-mno-cygwin |
| 7 | else |
Dominik Riebeling | 919caf0 | 2008-01-06 11:55:55 +0000 | [diff] [blame] | 8 | ifeq ($(findstring MINGW,$(shell uname)),MINGW) |
| 9 | OUTPUT=sansapatcher.exe |
Dominik Riebeling | ccd8f6c | 2008-01-26 22:19:27 +0000 | [diff] [blame] | 10 | CROSS= |
Dominik Riebeling | 919caf0 | 2008-01-06 11:55:55 +0000 | [diff] [blame] | 11 | else |
Dave Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 12 | OUTPUT=sansapatcher |
| 13 | CROSS=i586-mingw32msvc- |
| 14 | endif |
Dominik Riebeling | 919caf0 | 2008-01-06 11:55:55 +0000 | [diff] [blame] | 15 | endif |
Dave Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 16 | |
| 17 | NATIVECC = gcc |
| 18 | CC = $(CROSS)gcc |
Dominik Wenger | 4e8d614 | 2008-01-20 21:19:37 +0000 | [diff] [blame] | 19 | WINDRES = $(CROSS)windres |
Dave Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 20 | |
| 21 | all: $(OUTPUT) |
| 22 | |
Dave Chapman | 8d145a5 | 2007-09-19 18:46:54 +0000 | [diff] [blame] | 23 | sansapatcher: 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 Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 25 | strip sansapatcher |
| 26 | |
Dominik Wenger | 4e8d614 | 2008-01-20 21:19:37 +0000 | [diff] [blame] | 27 | sansapatcher.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 Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 29 | $(CROSS)strip sansapatcher.exe |
| 30 | |
Dominik Wenger | 4e8d614 | 2008-01-20 21:19:37 +0000 | [diff] [blame] | 31 | sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest |
| 32 | $(WINDRES) -i sansapatcher.rc -o sansapatcher-rc.o |
| 33 | |
Dave Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 34 | sansapatcher-mac: sansapatcher-i386 sansapatcher-ppc |
| 35 | lipo -create sansapatcher-ppc sansapatcher-i386 -output sansapatcher-mac |
| 36 | |
Dave Chapman | 8d145a5 | 2007-09-19 18:46:54 +0000 | [diff] [blame] | 37 | sansapatcher-i386: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c |
Barry Wardell | 386f77b | 2008-03-25 19:50:41 +0000 | [diff] [blame] | 38 | 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 Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 39 | strip sansapatcher-i386 |
| 40 | |
Dave Chapman | 8d145a5 | 2007-09-19 18:46:54 +0000 | [diff] [blame] | 41 | sansapatcher-ppc: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c |
Barry Wardell | 386f77b | 2008-03-25 19:50:41 +0000 | [diff] [blame] | 42 | 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 Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 43 | strip sansapatcher-ppc |
| 44 | |
Dave Chapman | e815601 | 2007-03-15 23:26:47 +0000 | [diff] [blame] | 45 | bin2c: bin2c.c |
| 46 | $(NATIVECC) $(CFLAGS) -o bin2c bin2c.c |
Dave Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 47 | |
Dave Chapman | 8d145a5 | 2007-09-19 18:46:54 +0000 | [diff] [blame] | 48 | bootimg_c200.c: firmware.mi4 bin2c |
| 49 | ./bin2c firmware.mi4 bootimg_c200 |
| 50 | |
| 51 | bootimg_e200.c: PP5022.mi4 bin2c |
| 52 | ./bin2c PP5022.mi4 bootimg_e200 |
Dave Chapman | e17043e | 2007-03-15 22:55:36 +0000 | [diff] [blame] | 53 | |
| 54 | clean: |
Dave Chapman | 8d145a5 | 2007-09-19 18:46:54 +0000 | [diff] [blame] | 55 | rm -f sansapatcher.exe sansapatcher-mac sansapatcher-i386 sansapatcher-ppc sansapatcher bin2c bootimg_c200.c bootimg_c200.h bootimg_e200.c bootimg_e200.h *~ |