summaryrefslogtreecommitdiffstats
path: root/rbutil/sansapatcher/Makefile
blob: 06ea7b09a54371db99b001f50ad14652533887c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
CFLAGS=-Wall -W -D_LARGEFILE64_SOURCE

ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
OUTPUT=sansapatcher.exe
CROSS=
CFLAGS+=-mno-cygwin
else
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
OUTPUT=sansapatcher.exe
CROSS=
else
OUTPUT=sansapatcher
CROSS=i586-mingw32msvc-
endif
endif

NATIVECC = gcc
CC = $(CROSS)gcc
WINDRES = $(CROSS)windres

all: $(OUTPUT)

sansapatcher: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
	gcc $(CFLAGS) -o sansapatcher main.c sansapatcher.c sansaio-posix.c bootimg_c200.c bootimg_e200.c
	strip sansapatcher

sansapatcher.exe: main.c sansapatcher.c sansaio-win32.c parttypes.h bootimg_c200.c bootimg_e200.c  sansapatcher-rc.o
	$(CC) $(CFLAGS) -o sansapatcher.exe main.c sansapatcher.c sansaio-win32.c bootimg_c200.c bootimg_e200.c  sansapatcher-rc.o
	$(CROSS)strip sansapatcher.exe

sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest
	$(WINDRES) -i sansapatcher.rc -o sansapatcher-rc.o
    
sansapatcher-mac: sansapatcher-i386 sansapatcher-ppc
	lipo -create sansapatcher-ppc sansapatcher-i386 -output sansapatcher-mac

sansapatcher.dmg: sansapatcher-mac
	mkdir sansapatcher-dmg
	cp sansapatcher-mac sansapatcher-dmg/sansapatcher
	hdiutil create -srcfolder sansapatcher-dmg sansapatcher.dmg

sansapatcher-i386: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
	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
	strip sansapatcher-i386

sansapatcher-ppc: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
	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
	strip sansapatcher-ppc

bootimg_c200.c: firmware.mi4 ../tools/bin2c
	../tools/bin2c firmware.mi4 bootimg_c200

bootimg_e200.c: PP5022.mi4 ../tools/bin2c
	../tools/bin2c PP5022.mi4 bootimg_e200

../tools/bin2c:
	make -C ../tools bin2c

clean:
	rm -f sansapatcher.exe sansapatcher-mac sansapatcher-i386 sansapatcher-ppc sansapatcher bootimg_c200.c bootimg_c200.h bootimg_e200.c bootimg_e200.h *~ sansapatcher.dmg
	rm -rf sansapatcher-dmg