blob: 73ac574651053ba3a64e17c53d16e86ca7c4e57c [file] [log] [blame]
Dave Chapmandd998b72007-09-09 13:30:40 +00001CFLAGS=-Wall -W
2
3ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
4OUTPUT=e200rpatcher.exe
5CROSS=
6CFLAGS+=-mno-cygwin
7else
8OUTPUT=e200rpatcher
9CROSS=i586-mingw32msvc-
10endif
11
12LIBS = -lusb
Dave Chapman76ea4122007-09-15 22:49:29 +000013WINLIBS = -I libusb-win32-device-bin-0.1.12.1/include libusb-win32-device-bin-0.1.12.1/lib/dynamic/libusb_dyn.c
Dave Chapmandd998b72007-09-09 13:30:40 +000014
15NATIVECC = gcc
16CC = $(CROSS)gcc
17
18all: $(OUTPUT)
19
20e200rpatcher: e200rpatcher.c bootimg.c
21 gcc $(CFLAGS) $(LIBS) -o e200rpatcher e200rpatcher.c bootimg.c
22 strip e200rpatcher
23
24e200rpatcher.exe: e200rpatcher.c bootimg.c
Dave Chapman76ea4122007-09-15 22:49:29 +000025 $(CC) $(CFLAGS) $(WINLIBS) -o e200rpatcher.exe e200rpatcher.c bootimg.c
Dave Chapmandd998b72007-09-09 13:30:40 +000026 $(CROSS)strip e200rpatcher.exe
27
28e200rpatcher-mac: e200rpatcher-i386 e200rpatcher-ppc
29 lipo -create e200rpatcher-ppc e200rpatcher-i386 -output e200rpatcher-mac
Dave Chapman7eb73ef2007-09-11 16:47:26 +000030
31e200rpatcher-i386: e200rpatcher.c bootimg.c usb.h libusb-i386.a
32 gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -framework iokit -framework coreservices -arch i386 $(CFLAGS) -o e200rpatcher-i386 e200rpatcher.c bootimg.c -I. libusb-i386.a
Dave Chapmandd998b72007-09-09 13:30:40 +000033 strip e200rpatcher-i386
34
Dave Chapman7eb73ef2007-09-11 16:47:26 +000035e200rpatcher-ppc: e200rpatcher.c bootimg.c usb.h libusb-ppc.a
36 gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -framework iokit -framework coreservices -arch ppc $(CFLAGS) -o e200rpatcher-ppc e200rpatcher.c bootimg.c -I. libusb-ppc.a
Dave Chapmandd998b72007-09-09 13:30:40 +000037 strip e200rpatcher-ppc
38
39bin2c: ../sansapatcher/bin2c.c
40 $(NATIVECC) $(CFLAGS) -o bin2c ../sansapatcher/bin2c.c
41
42bootimg.c: bootloader.bin bin2c
43 ./bin2c bootloader.bin bootimg
44
45clean:
46 rm -f e200rpatcher.exe e200rpatcher-mac e200rpatcher-i386 e200rpatcher-ppc e200rpatcher bin2c bootimg.c bootimg.h *~