rockbox/utils/MTP/beastpatcher/Makefile
Dominik Riebeling 6d1d9bed3e Integrate mknkboot into beastpatcher.
Add a new option to beastpatcher to patch and upload an original firmware file.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22745 a1c6a512-1295-4272-9138-f99709370657
2009-09-20 08:28:18 +00:00

64 lines
2.3 KiB
Makefile

CFLAGS=-Wall -W -DWITH_BOOTOBJS -DBEASTPATCHER -I../../../tools
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
OUTPUT=beastpatcher.exe
CROSS=
CFLAGS+=-mno-cygwin
else
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
OUTPUT=beastpatcher.exe
CROSS=
else
OUTPUT=beastpatcher
CROSS=i586-mingw32msvc-
endif
endif
ifneq ($(findstring MINGW,$(shell uname)),MINGW)
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')
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')
endif
WINLIBS = ../MTP_DLL.dll
NATIVECC = gcc
CC = $(CROSS)gcc
all: $(OUTPUT)
SOURCES = beastpatcher.c bootimg.c ../../../tools/mknkboot.c main.c
HEADERS = beastpatcher.h mtp_common.h bootimg.h ../../../tools/mknkboot.h
MTPSRCS_W32 = mtp_win32.c
MTPSRCS_MTP = mtp_libmtp.c
beastpatcher: $(SOURCES) $(HEADERS) $(MTPSRCS_MTP)
gcc $(CFLAGS) -o beastpatcher $(SOURCES) $(MTPSRCS_MTP) $(LIBS)
strip beastpatcher
beastpatcher.exe: $(SOURCES) $(HEADERS) $(MTPSRCS_W32) $(WINLIBS)
$(CC) $(CFLAGS) -o beastpatcher.exe $(SOURCES) $(MTPSRCS_W32) $(WINLIBS)
$(CROSS)strip beastpatcher.exe
beastpatcher-mac: beastpatcher-i386 beastpatcher-ppc
lipo -create beastpatcher-ppc beastpatcher-i386 -output beastpatcher-mac
beastpatcher-i386: beastpatcher.c bootimg.c usb.h main.c libusb-i386.a
$(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
beastpatcher-ppc: beastpatcher.c bootimg.c usb.h main.c libusb-ppc.a
$(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
bin2c: ../../../rbutil/tools/bin2c.c
$(NATIVECC) $(CFLAGS) -o bin2c ../../../rbutil/tools/bin2c.c
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 *~