blob: c0c82df53b8338b4a0005482e3571da05402e442 [file] [log] [blame]
Dave Chapmanc06071e2009-02-22 13:54:46 +00001CFLAGS=-Wall -W
2
3ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
4OUTPUT=beastpatcher.exe
5CROSS=
Dave Chapman93f4bd32009-02-22 23:35:29 +00006CFLAGS+=-mno-cygwin
Dave Chapmanc06071e2009-02-22 13:54:46 +00007else
8OUTPUT=beastpatcher
9CROSS=i586-mingw32msvc-
10endif
11
Dave Chapmanc06071e2009-02-22 13:54:46 +000012LIBS = /usr/lib/libmtp.a /usr/lib/libusb.a
13CFLAGS += $(shell printf \
14 '\#include <libmtp.h>\nlibmtp version: LIBMTP_VERSION\n' | \
15 gcc -E -P - -o - | grep -q '^libmtp version: 0\.2' && echo '-DOLDMTP')
Dave Chapman93f4bd32009-02-22 23:35:29 +000016WINLIBS = ../MTP_DLL.dll
Dave Chapmanc06071e2009-02-22 13:54:46 +000017
18NATIVECC = gcc
19CC = $(CROSS)gcc
20
21all: $(OUTPUT)
22
23beastpatcher: beastpatcher.c bootimg.c mtp_common.h mtp_libmtp.c
24 gcc $(CFLAGS) -o beastpatcher beastpatcher.c bootimg.c mtp_libmtp.c $(LIBS)
25 strip beastpatcher
26
Dave Chapman93f4bd32009-02-22 23:35:29 +000027beastpatcher.exe: beastpatcher.c bootimg.c mtp_common.h mtp_win32.c $(WINLIBS)
28 $(CC) $(CFLAGS) -o beastpatcher.exe beastpatcher.c bootimg.c mtp_win32.c $(WINLIBS)
Dave Chapmanc06071e2009-02-22 13:54:46 +000029 $(CROSS)strip beastpatcher.exe
30
31beastpatcher-mac: beastpatcher-i386 beastpatcher-ppc
32 lipo -create beastpatcher-ppc beastpatcher-i386 -output beastpatcher-mac
33
34beastpatcher-i386: beastpatcher.c bootimg.c usb.h libusb-i386.a
35 $(CC) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -framework iokit -framework coreservices -arch i386 $(CFLAGS) -o beastpatcher-i386 beastpatcher.c bootimg.c -I. libusb-i386.a
36 strip beastpatcher-i386
37
38beastpatcher-ppc: beastpatcher.c bootimg.c usb.h libusb-ppc.a
39 $(CC) -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -framework iokit -framework coreservices -arch ppc $(CFLAGS) -o beastpatcher-ppc beastpatcher.c bootimg.c -I. libusb-ppc.a
40 strip beastpatcher-ppc
41
42bin2c: ../../../rbutil/sansapatcher/bin2c.c
43 $(NATIVECC) $(CFLAGS) -o bin2c ../../../rbutil/sansapatcher/bin2c.c
44
45bootimg.c: bootloader.bin bin2c
46 ./bin2c bootloader.bin bootimg
47
48clean:
49 rm -f beastpatcher.exe beastpatcher-mac beastpatcher-i386 beastpatcher-ppc beastpatcher bin2c bootimg.c bootimg.h *~