1 CFLAGS
=-Wall
-W
-DWITH_BOOTOBJS
-I..
/..
/..
/tools
3 ifeq ($(findstring CYGWIN
,$(shell uname
)),CYGWIN
)
4 OUTPUT
=beastpatcher.exe
8 ifeq ($(findstring MINGW
,$(shell uname
)),MINGW
)
9 OUTPUT
=beastpatcher.exe
13 CROSS
=i586-mingw32msvc-
17 ifneq ($(findstring MINGW
,$(shell uname
)),MINGW
)
18 LIBS
= /usr
/lib
/libmtp.a
/usr
/lib
/libusb.a
19 CFLAGS
+= $(shell printf \
20 '\#include <libmtp.h>\nlibmtp version: LIBMTP_VERSION\n' | \
21 gcc
-E
-P
- -o
- | grep
-q
'^libmtp version: 0\.2' && echo
'-DOLDMTP')
22 CFLAGS
+= $(shell printf \
23 '\#include <libmtp.h>\nlibmtp version: LIBMTP_VERSION\n' | \
24 gcc
-E
-P
- -o
- | grep
-q
'^libmtp version: 0\.2\.[0-5]' && echo
'-DREALLYOLDMTP')
26 WINLIBS
= ..
/MTP_DLL.dll
33 SOURCES
= beastpatcher.c bootimg.c mknkboot.c main.c
34 HEADERS
= beastpatcher.h mtp_common.h bootimg.h mknkboot.h
35 OBJS
= beastpatcher.o bootimg.o mknkboot.o main.o mtp_libmtp.o
36 MTPSRCS_W32
= mtp_win32.c
37 MTPSRCS_MTP
= mtp_libmtp.c
39 beastpatcher
: $(SOURCES
) $(HEADERS
) $(MTPSRCS_MTP
)
40 gcc
$(CFLAGS
) -DBEASTPATCHER
-o beastpatcher
$(SOURCES
) $(MTPSRCS_MTP
) $(LIBS
)
43 beastpatcher.exe
: $(SOURCES
) $(HEADERS
) $(MTPSRCS_W32
) $(WINLIBS
)
44 $(CC
) $(CFLAGS
) -DBEASTPATCHER
-o beastpatcher.exe
$(SOURCES
) $(MTPSRCS_W32
) $(WINLIBS
)
45 $(CROSS
)strip beastpatcher.exe
47 beastpatcher-mac
: beastpatcher-i386 beastpatcher-ppc
48 lipo
-create beastpatcher-ppc beastpatcher-i386
-output beastpatcher-mac
50 beastpatcher.dmg
: beastpatcher-mac
51 mkdir
-p beastpatcher-dmg
52 cp
-p beastpatcher-mac beastpatcher-dmg
53 hdiutil create
-srcfolder beastpatcher-dmg beastpatcher.dmg
55 beastpatcher-i386
: $(SOURCES
) $(HEADERS
) $(MTPSRCS_MTP
) usb.h libmtp.h libusb-i386.a libmtp-i386.a
56 gcc
-c
-isysroot
/Developer
/SDKs
/MacOSX10.4u.sdk
-mmacosx-version-min
=10.4 -arch i386
$(CFLAGS
) -I.
-DBEASTPATCHER
$(SOURCES
) $(MTPSRCS_MTP
)
57 gcc
-framework iokit
-framework coreservices
-arch i386
-o beastpatcher-i386
$(OBJS
) libusb-i386.a libmtp-i386.a
-liconv
58 strip beastpatcher-i386
60 beastpatcher-ppc
: $(SOURCES
) $(HEADERS
) $(MTPSRCS_MTP
) usb.h libmtp.h libusb-ppc.a libmtp-ppc.a
61 gcc
-c
-isysroot
/Developer
/SDKs
/MacOSX10.4u.sdk
-mmacosx-version-min
=10.4 -arch ppc
$(CFLAGS
) -I.
-DBEASTPATCHER
$(SOURCES
) $(MTPSRCS_MTP
)
62 gcc
-framework iokit
-framework coreservices
-arch ppc
-o beastpatcher-ppc
$(OBJS
) libusb-ppc.a libmtp-ppc.a
-liconv
63 strip beastpatcher-ppc
65 bin2c
: ..
/..
/..
/rbutil
/tools
/bin2c.c
66 $(NATIVECC
) $(CFLAGS
) -o bin2c ..
/..
/..
/rbutil
/tools
/bin2c.c
68 bootimg.c
: bootloader.bin bin2c
69 .
/bin2c bootloader.bin bootimg
72 $(SILENT
)$(NATIVECC
) $(CFLAGS
) $+ -o
$@
74 rm -f beastpatcher.exe beastpatcher-mac beastpatcher-i386 beastpatcher-ppc beastpatcher bin2c bootimg.c bootimg.h mknkboot
*~
*.o beastpatcher.dmg
75 rm -rf beastpatcher-dmg