summaryrefslogtreecommitdiffstats
path: root/rbutil/e200rpatcher/Makefile
blob: 8ca0b0aad008aebd308fcdfe452089fa05e2c4d7 (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
CFLAGS=-Wall -W

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

LIBS = -lusb
WINLIBS = -I libusb-win32-device-bin-0.1.12.1/include libusb-win32-device-bin-0.1.12.1/lib/dynamic/libusb_dyn.c 

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

all: $(OUTPUT)

e200rpatcher: e200rpatcher.c bootimg.c
	gcc $(CFLAGS) $(LIBS) -o e200rpatcher e200rpatcher.c bootimg.c
	strip e200rpatcher

e200rpatcher.exe:  e200rpatcher.c bootimg.c  e200rpatcher-rc.o
	$(CC) $(CFLAGS) $(WINLIBS) -o e200rpatcher.exe e200rpatcher.c bootimg.c e200rpatcher-rc.o
	$(CROSS)strip e200rpatcher.exe
    
e200rpatcher-rc.o: e200rpatcher.rc e200rpatcher.manifest
	$(WINDRES) -i e200rpatcher.rc -o e200rpatcher-rc.o

e200rpatcher-mac: e200rpatcher-i386 e200rpatcher-ppc
	lipo -create e200rpatcher-ppc e200rpatcher-i386 -output e200rpatcher-mac

e200rpatcher.dmg: e200rpatcher-mac
	mkdir e200rpatcher-dmg
	cp e200rpatcher-mac e200rpatcher-dmg
	hdiutil create -srcfolder e200rpatcher-dmg e200rpatcher.dmg

e200rpatcher-i386:  e200rpatcher.c  bootimg.c usb.h libusb-i386.a
	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
	strip e200rpatcher-i386

e200rpatcher-ppc: e200rpatcher.c bootimg.c usb.h libusb-ppc.a
	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
	strip e200rpatcher-ppc

bin2c: ../tools/bin2c.c
	$(NATIVECC) $(CFLAGS) -o bin2c ../tools/bin2c.c

bootimg.c: bootloader.bin bin2c
	./bin2c bootloader.bin bootimg

clean:
	rm -f e200rpatcher.exe e200rpatcher-mac e200rpatcher-i386 e200rpatcher-ppc e200rpatcher bin2c bootimg.c bootimg.h *~ e200rpatcher.dmg
	rm -rf e200rpatcher-dmg