summaryrefslogtreecommitdiffstats
path: root/rbutil/sansapatcher
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/sansapatcher')
-rw-r--r--rbutil/sansapatcher/Makefile91
1 files changed, 40 insertions, 51 deletions
diff --git a/rbutil/sansapatcher/Makefile b/rbutil/sansapatcher/Makefile
index 05739245b9..6e203042be 100644
--- a/rbutil/sansapatcher/Makefile
+++ b/rbutil/sansapatcher/Makefile
@@ -1,62 +1,51 @@
-CFLAGS=-Wall -W -D_LARGEFILE64_SOURCE
-
-ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
-OUTPUT=sansapatcher.exe
-CROSS=
-CFLAGS+=-mno-cygwin
-else
-ifeq ($(findstring MINGW,$(shell uname)),MINGW)
-OUTPUT=sansapatcher.exe
-CROSS=
-CFLAGS+=-D__USE_MINGW_ANSI_STDIO=1
-else
-OUTPUT=sansapatcher
-CROSS=i586-mingw32msvc-
+# __________ __ ___.
+# Open \______ \ ____ ____ | | _\_ |__ _______ ___
+# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+# \/ \/ \/ \/ \/
+
+TARGET_DIR ?= $(shell pwd)/
+CFLAGS += -Wall -W -D_LARGEFILE64_SOURCE
+
+OUTPUT = sansapatcher
+
+# inputs
+BOOTSRC = bootimg_c200.c bootimg_e200.c
+LIBSOURCES := sansapatcher.c sansaio-posix.c sansaio-win32.c
+SOURCES := $(LIBSOURCES) main.c
+# additional link dependencies for the standalone executable
+EXTRADEPS :=
+
+# Releases of sansapatcher are created with "make RELEASE=1". This
+# enables BOOTOBJS and uses the VERSION string defined in main.c
+ifdef RELEASE
+CFLAGS += -DRELEASE
+BOOTOBJS=1
endif
-endif
-
-NATIVECC = gcc
-CC = $(CROSS)gcc
-WINDRES = $(CROSS)windres
-all: $(OUTPUT)
+ifdef WITH_BOOTOBJS
+SOURCES += $(BOOTSRC)
+CFLAGS += -DWITH_BOOTOBJS
+endif
-sansapatcher: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
- gcc $(CFLAGS) -o sansapatcher main.c sansapatcher.c sansaio-posix.c bootimg_c200.c bootimg_e200.c
- strip sansapatcher
+include ../libtools.make
-sansapatcher.exe: main.c sansapatcher.c sansaio-win32.c parttypes.h bootimg_c200.c bootimg_e200.c sansapatcher-rc.o
- $(CC) $(CFLAGS) -o sansapatcher.exe main.c sansapatcher.c sansaio-win32.c bootimg_c200.c bootimg_e200.c sansapatcher-rc.o
- $(CROSS)strip sansapatcher.exe
+# find out if we need to link the manifest resource.
+# Since libtools.make sets up BINARY we check it for the file extension .exe.
+ifeq ($(findstring exe,$(BINARY)),exe)
+$(BINARY): $(OBJDIR)sansapatcher-rc.o
+endif
-sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest
+$(OBJDIR)sansapatcher-rc.o: sansapatcher.rc sansapatcher.manifest
$(WINDRES) -i sansapatcher.rc -o sansapatcher-rc.o
-
-sansapatcher-mac: sansapatcher-i386 sansapatcher-ppc
- lipo -create sansapatcher-ppc sansapatcher-i386 -output sansapatcher-mac
-
-sansapatcher.dmg: sansapatcher-mac
- mkdir -p sansapatcher-dmg
- cp -p sansapatcher-mac sansapatcher-dmg/sansapatcher
- hdiutil create -srcfolder sansapatcher-dmg sansapatcher.dmg
-
-sansapatcher-i386: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
- gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch i386 $(CFLAGS) -o sansapatcher-i386 main.c sansapatcher.c sansaio-posix.c bootimg_c200.c bootimg_e200.c
- strip sansapatcher-i386
-
-sansapatcher-ppc: main.c sansapatcher.c sansaio-posix.c parttypes.h bootimg_c200.c bootimg_e200.c
- gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 -arch ppc $(CFLAGS) -o sansapatcher-ppc main.c sansapatcher.c sansaio-posix.c bootimg_c200.c bootimg_e200.c
- strip sansapatcher-ppc
bootimg_c200.c: firmware.mi4 ../tools/bin2c
- ../tools/bin2c firmware.mi4 bootimg_c200
+ @echo BIN2C $<
+ $(SILENT)../tools/bin2c firmware.mi4 bootimg_c200
bootimg_e200.c: PP5022.mi4 ../tools/bin2c
- ../tools/bin2c PP5022.mi4 bootimg_e200
-
+ @echo BIN2C $<
+ $(SILENT)../tools/bin2c PP5022.mi4 bootimg_e200
../tools/bin2c:
- make -C ../tools bin2c
-
-clean:
- rm -f sansapatcher.exe sansapatcher-mac sansapatcher-i386 sansapatcher-ppc sansapatcher bootimg_c200.c bootimg_c200.h bootimg_e200.c bootimg_e200.h *~ sansapatcher.dmg
- rm -rf sansapatcher-dmg
+ $(SILENT)make -C ../tools bin2c