blob: 2cf150005864660a885fc2df620ae2e0ffe553b2 [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
Dominik Wenger4e8d6142008-01-20 21:19:37 +000017WINDRES = $(CROSS)windres
Dave Chapmandd998b72007-09-09 13:30:40 +000018
19all: $(OUTPUT)
20
21e200rpatcher: e200rpatcher.c bootimg.c
22 gcc $(CFLAGS) $(LIBS) -o e200rpatcher e200rpatcher.c bootimg.c
23 strip e200rpatcher
24
Dominik Wenger4e8d6142008-01-20 21:19:37 +000025e200rpatcher.exe: e200rpatcher.c bootimg.c e200rpatcher-rc.o
26 $(CC) $(CFLAGS) $(WINLIBS) -o e200rpatcher.exe e200rpatcher.c bootimg.c e200rpatcher-rc.o
Dave Chapmandd998b72007-09-09 13:30:40 +000027 $(CROSS)strip e200rpatcher.exe
Dominik Wenger4e8d6142008-01-20 21:19:37 +000028
29e200rpatcher-rc.o: e200rpatcher.rc e200rpatcher.manifest
30 $(WINDRES) -i e200rpatcher.rc -o e200rpatcher-rc.o
Dave Chapmandd998b72007-09-09 13:30:40 +000031
32e200rpatcher-mac: e200rpatcher-i386 e200rpatcher-ppc
33 lipo -create e200rpatcher-ppc e200rpatcher-i386 -output e200rpatcher-mac
Dave Chapman7eb73ef2007-09-11 16:47:26 +000034
35e200rpatcher-i386: e200rpatcher.c bootimg.c usb.h libusb-i386.a
Barry Wardell482f8bf2008-02-24 19:39:51 +000036 gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -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 +000037 strip e200rpatcher-i386
38
Dave Chapman7eb73ef2007-09-11 16:47:26 +000039e200rpatcher-ppc: e200rpatcher.c bootimg.c usb.h libusb-ppc.a
Barry Wardell482f8bf2008-02-24 19:39:51 +000040 gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -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 +000041 strip e200rpatcher-ppc
42
43bin2c: ../sansapatcher/bin2c.c
44 $(NATIVECC) $(CFLAGS) -o bin2c ../sansapatcher/bin2c.c
45
46bootimg.c: bootloader.bin bin2c
47 ./bin2c bootloader.bin bootimg
48
49clean:
50 rm -f e200rpatcher.exe e200rpatcher-mac e200rpatcher-i386 e200rpatcher-ppc e200rpatcher bin2c bootimg.c bootimg.h *~