2009-02-22 13:54:46 +00:00
|
|
|
CFLAGS=-Wall -W
|
|
|
|
|
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
|
|
OUTPUT=beastpatcher.exe
|
|
|
|
CROSS=
|
2009-02-22 23:35:29 +00:00
|
|
|
CFLAGS+=-mno-cygwin
|
2009-02-22 13:54:46 +00:00
|
|
|
else
|
2009-05-16 10:51:20 +00:00
|
|
|
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
|
|
|
OUTPUT=beastpatcher.exe
|
|
|
|
CROSS=
|
|
|
|
else
|
2009-02-22 13:54:46 +00:00
|
|
|
OUTPUT=beastpatcher
|
|
|
|
CROSS=i586-mingw32msvc-
|
|
|
|
endif
|
2009-05-16 10:51:20 +00:00
|
|
|
endif
|
2009-02-22 13:54:46 +00:00
|
|
|
|
2009-05-16 10:51:20 +00:00
|
|
|
ifneq ($(findstring MINGW,$(shell uname)),MINGW)
|
2009-02-22 13:54:46 +00:00
|
|
|
LIBS = /usr/lib/libmtp.a /usr/lib/libusb.a
|
|
|
|
CFLAGS += $(shell printf \
|
|
|
|
'\#include <libmtp.h>\nlibmtp version: LIBMTP_VERSION\n' | \
|
|
|
|
gcc -E -P - -o - | grep -q '^libmtp version: 0\.2' && echo '-DOLDMTP')
|
2009-06-11 19:55:28 +00:00
|
|
|
CFLAGS += $(shell printf \
|
|
|
|
'\#include <libmtp.h>\nlibmtp version: LIBMTP_VERSION\n' | \
|
|
|
|
gcc -E -P - -o - | grep -q '^libmtp version: 0\.2\.[0-5]' && echo '-DREALLYOLDMTP')
|
2009-05-16 10:51:20 +00:00
|
|
|
endif
|
2009-02-22 23:35:29 +00:00
|
|
|
WINLIBS = ../MTP_DLL.dll
|
2009-02-22 13:54:46 +00:00
|
|
|
|
|
|
|
NATIVECC = gcc
|
|
|
|
CC = $(CROSS)gcc
|
|
|
|
|
|
|
|
all: $(OUTPUT)
|
|
|
|
|
2009-06-12 16:35:34 +00:00
|
|
|
beastpatcher: beastpatcher.c bootimg.c mtp_common.h mtp_libmtp.c main.c
|
|
|
|
gcc $(CFLAGS) -o beastpatcher beastpatcher.c bootimg.c mtp_libmtp.c main.c $(LIBS)
|
2009-02-22 13:54:46 +00:00
|
|
|
strip beastpatcher
|
|
|
|
|
2009-06-12 16:35:34 +00:00
|
|
|
beastpatcher.exe: beastpatcher.c bootimg.c mtp_common.h mtp_win32.c main.c $(WINLIBS)
|
|
|
|
$(CC) $(CFLAGS) -o beastpatcher.exe beastpatcher.c bootimg.c mtp_win32.c main.c $(WINLIBS)
|
2009-02-22 13:54:46 +00:00
|
|
|
$(CROSS)strip beastpatcher.exe
|
|
|
|
|
|
|
|
beastpatcher-mac: beastpatcher-i386 beastpatcher-ppc
|
|
|
|
lipo -create beastpatcher-ppc beastpatcher-i386 -output beastpatcher-mac
|
|
|
|
|
2009-06-12 16:35:34 +00:00
|
|
|
beastpatcher-i386: beastpatcher.c bootimg.c usb.h main.c libusb-i386.a
|
2009-02-22 13:54:46 +00:00
|
|
|
$(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
|
|
|
|
strip beastpatcher-i386
|
|
|
|
|
2009-06-12 16:35:34 +00:00
|
|
|
beastpatcher-ppc: beastpatcher.c bootimg.c usb.h main.c libusb-ppc.a
|
2009-02-22 13:54:46 +00:00
|
|
|
$(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
|
|
|
|
strip beastpatcher-ppc
|
|
|
|
|
2009-06-13 14:15:50 +00:00
|
|
|
bin2c: ../../../rbutil/tools/bin2c.c
|
|
|
|
$(NATIVECC) $(CFLAGS) -o bin2c ../../../rbutil/tools/bin2c.c
|
2009-02-22 13:54:46 +00:00
|
|
|
|
|
|
|
bootimg.c: bootloader.bin bin2c
|
|
|
|
./bin2c bootloader.bin bootimg
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f beastpatcher.exe beastpatcher-mac beastpatcher-i386 beastpatcher-ppc beastpatcher bin2c bootimg.c bootimg.h *~
|