2009-10-27 21:15:21 +00:00
|
|
|
CFLAGS=-Wall -W -DWITH_BOOTOBJS -I../../../tools
|
2009-02-22 13:54:46 +00:00
|
|
|
|
|
|
|
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
|
2021-06-10 04:14:43 +00:00
|
|
|
CROSS=i686-w64-mingw32-
|
2009-02-22 13:54:46 +00:00
|
|
|
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)
|
2021-06-10 04:14:43 +00:00
|
|
|
LIBS := -lmtp
|
2020-08-05 21:44:07 +00:00
|
|
|
ifdef STATIC
|
|
|
|
LIBS := -Wl,-Bstatic $(LIBS) -Wl,-Bdynamic
|
|
|
|
endif
|
2009-02-22 13:54:46 +00:00
|
|
|
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)
|
|
|
|
|
2021-06-12 06:25:25 +00:00
|
|
|
SOURCES = beastpatcher.c bootimg.c mknkboot.c md5.c main.c
|
|
|
|
HEADERS = beastpatcher.h mtp_common.h bootimg.h mknkboot.h md5.h
|
|
|
|
OBJS = beastpatcher.o bootimg.o mknkboot.o md5.o main.o mtp_libmtp.o
|
2009-09-20 08:28:18 +00:00
|
|
|
MTPSRCS_W32 = mtp_win32.c
|
|
|
|
MTPSRCS_MTP = mtp_libmtp.c
|
|
|
|
|
|
|
|
beastpatcher: $(SOURCES) $(HEADERS) $(MTPSRCS_MTP)
|
2009-10-27 21:15:21 +00:00
|
|
|
gcc $(CFLAGS) -DBEASTPATCHER -o beastpatcher $(SOURCES) $(MTPSRCS_MTP) $(LIBS)
|
2009-02-22 13:54:46 +00:00
|
|
|
strip beastpatcher
|
|
|
|
|
2009-09-20 08:28:18 +00:00
|
|
|
beastpatcher.exe: $(SOURCES) $(HEADERS) $(MTPSRCS_W32) $(WINLIBS)
|
2009-10-27 21:15:21 +00:00
|
|
|
$(CC) $(CFLAGS) -DBEASTPATCHER -o beastpatcher.exe $(SOURCES) $(MTPSRCS_W32) $(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-10-30 21:07:06 +00:00
|
|
|
beastpatcher.dmg: beastpatcher-mac
|
|
|
|
mkdir -p beastpatcher-dmg
|
|
|
|
cp -p beastpatcher-mac beastpatcher-dmg
|
|
|
|
hdiutil create -srcfolder beastpatcher-dmg beastpatcher.dmg
|
|
|
|
|
2009-10-30 13:31:04 +00:00
|
|
|
beastpatcher-i386: $(SOURCES) $(HEADERS) $(MTPSRCS_MTP) usb.h libmtp.h libusb-i386.a libmtp-i386.a
|
|
|
|
gcc -c -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 $(CFLAGS) -I. -DBEASTPATCHER $(SOURCES) $(MTPSRCS_MTP)
|
|
|
|
gcc -framework iokit -framework coreservices -arch i386 -o beastpatcher-i386 $(OBJS) libusb-i386.a libmtp-i386.a -liconv
|
2009-02-22 13:54:46 +00:00
|
|
|
strip beastpatcher-i386
|
2009-10-30 13:31:04 +00:00
|
|
|
|
|
|
|
beastpatcher-ppc: $(SOURCES) $(HEADERS) $(MTPSRCS_MTP) usb.h libmtp.h libusb-ppc.a libmtp-ppc.a
|
|
|
|
gcc -c -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc $(CFLAGS) -I. -DBEASTPATCHER $(SOURCES) $(MTPSRCS_MTP)
|
|
|
|
gcc -framework iokit -framework coreservices -arch ppc -o beastpatcher-ppc $(OBJS) libusb-ppc.a libmtp-ppc.a -liconv
|
2009-02-22 13:54:46 +00:00
|
|
|
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
|
|
|
|
|
2021-06-12 06:25:25 +00:00
|
|
|
mknkboot: mknkboot.c md5.c
|
2009-10-27 21:15:21 +00:00
|
|
|
$(SILENT)$(NATIVECC) $(CFLAGS) $+ -o $@
|
2009-02-22 13:54:46 +00:00
|
|
|
clean:
|
2009-10-30 21:07:06 +00:00
|
|
|
rm -f beastpatcher.exe beastpatcher-mac beastpatcher-i386 beastpatcher-ppc beastpatcher bin2c bootimg.c bootimg.h mknkboot *~ *.o beastpatcher.dmg
|
|
|
|
rm -rf beastpatcher-dmg
|