Fix wrong #ifdefs
[kugel-rb.git] / utils / MTP / beastpatcher / Makefile
bloba40a2338f098e2a3602af0fcd0bf626dc4c8b8ae
1 CFLAGS=-Wall -W
3 ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
4 OUTPUT=beastpatcher.exe
5 CROSS=
6 CFLAGS+=-mno-cygwin
7 else
8 ifeq ($(findstring MINGW,$(shell uname)),MINGW)
9 OUTPUT=beastpatcher.exe
10 CROSS=
11 else
12 OUTPUT=beastpatcher
13 CROSS=i586-mingw32msvc-
14 endif
15 endif
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 endif
23 WINLIBS = ../MTP_DLL.dll
25 NATIVECC = gcc
26 CC = $(CROSS)gcc
28 all: $(OUTPUT)
30 beastpatcher: beastpatcher.c bootimg.c mtp_common.h mtp_libmtp.c
31 gcc $(CFLAGS) -o beastpatcher beastpatcher.c bootimg.c mtp_libmtp.c $(LIBS)
32 strip beastpatcher
34 beastpatcher.exe: beastpatcher.c bootimg.c mtp_common.h mtp_win32.c $(WINLIBS)
35 $(CC) $(CFLAGS) -o beastpatcher.exe beastpatcher.c bootimg.c mtp_win32.c $(WINLIBS)
36 $(CROSS)strip beastpatcher.exe
38 beastpatcher-mac: beastpatcher-i386 beastpatcher-ppc
39 lipo -create beastpatcher-ppc beastpatcher-i386 -output beastpatcher-mac
41 beastpatcher-i386: beastpatcher.c bootimg.c usb.h libusb-i386.a
42 $(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
43 strip beastpatcher-i386
45 beastpatcher-ppc: beastpatcher.c bootimg.c usb.h libusb-ppc.a
46 $(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
47 strip beastpatcher-ppc
49 bin2c: ../../../rbutil/sansapatcher/bin2c.c
50 $(NATIVECC) $(CFLAGS) -o bin2c ../../../rbutil/sansapatcher/bin2c.c
52 bootimg.c: bootloader.bin bin2c
53 ./bin2c bootloader.bin bootimg
55 clean:
56 rm -f beastpatcher.exe beastpatcher-mac beastpatcher-i386 beastpatcher-ppc beastpatcher bin2c bootimg.c bootimg.h *~