2008-10-11 11:35:59 +00:00
|
|
|
# We use the UCL code available in the Rockbox tools/ directory
|
2009-05-28 18:27:08 +00:00
|
|
|
CFLAGS=-I../../tools/ucl/include -Wall
|
2009-09-04 19:54:18 +00:00
|
|
|
CC = gcc
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2009-07-05 10:35:47 +00:00
|
|
|
#change for releases
|
2009-10-11 09:47:15 +00:00
|
|
|
ifndef APPVERSION
|
2009-07-05 10:35:47 +00:00
|
|
|
APPVERSION=`../../tools/version.sh`
|
2009-10-11 09:47:15 +00:00
|
|
|
endif
|
2009-07-05 10:35:47 +00:00
|
|
|
|
2009-08-15 14:26:08 +00:00
|
|
|
ifndef V
|
|
|
|
SILENT = @
|
|
|
|
endif
|
|
|
|
|
2009-05-28 18:27:08 +00:00
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
|
|
|
|
OUTPUT=mkamsboot.exe
|
|
|
|
CFLAGS+=-mno-cygwin
|
|
|
|
else
|
|
|
|
ifeq ($(findstring MINGW,$(shell uname)),MINGW)
|
|
|
|
OUTPUT=mkamsboot.exe
|
|
|
|
else
|
|
|
|
ifeq ($(findstring mingw,$(CC)),mingw)
|
|
|
|
OUTPUT=mkamsboot.exe
|
|
|
|
else
|
|
|
|
OUTPUT=mkamsboot
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2009-08-15 13:54:13 +00:00
|
|
|
ifdef RBARCH
|
|
|
|
CFLAGS += -arch $(RBARCH)
|
|
|
|
endif
|
|
|
|
|
2009-09-04 21:31:17 +00:00
|
|
|
OUT = $(TARGET_DIR)build$(RBARCH)
|
2009-08-15 13:54:13 +00:00
|
|
|
|
2009-05-28 18:27:08 +00:00
|
|
|
all: $(OUTPUT)
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2009-10-31 17:18:17 +00:00
|
|
|
# Dependant modules
|
|
|
|
LIBUCL=../../tools/ucl/src/libucl$(RBARCH).a
|
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
$(LIBUCL):
|
2009-10-09 08:49:41 +00:00
|
|
|
make -C ../../tools/ucl/src $(TARGET_DIR)libucl$(RBARCH).a
|
2008-10-28 11:24:24 +00:00
|
|
|
|
2009-05-28 18:27:08 +00:00
|
|
|
# This file can be generated in the dualboot/ directory
|
2009-10-31 17:18:17 +00:00
|
|
|
$(OUT)/dualboot.o: dualboot.[ch]
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo CC $<
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) -c -o $(OUT)/dualboot.o dualboot.c
|
2009-08-15 13:54:13 +00:00
|
|
|
|
2009-10-31 17:18:17 +00:00
|
|
|
$(OUT)/md5.o: md5.[ch]
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo CC $<
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) -c -o $(OUT)/md5.o -W -Wall md5.c
|
2009-05-28 18:27:08 +00:00
|
|
|
|
2009-10-31 17:18:17 +00:00
|
|
|
DEPENDANT_OBJS=$(LIBUCL) $(OUT)/dualboot.o $(OUT)/md5.o
|
|
|
|
|
|
|
|
$(OUT)/mkamsboot.o: mkamsboot.[ch] $(DEPENDANT_OBJS)
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo CC $<
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) -c -o $(OUT)/mkamsboot.o -W -Wall mkamsboot.c -DVERSION=\"$(APPVERSION)\"
|
2008-10-19 19:51:42 +00:00
|
|
|
|
2009-10-31 17:18:17 +00:00
|
|
|
$(OUTPUT): $(OUT) $(OUT)/mkamsboot.o
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo CC $<
|
2009-10-31 17:18:17 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -o $(OUTPUT) $(OUT)/mkamsboot.o $(DEPENDANT_OBJS)
|
2008-10-19 19:51:42 +00:00
|
|
|
|
2009-10-31 17:18:17 +00:00
|
|
|
$(OUT)/libmkamsboot.o: $(OUT)/mkamsboot.o
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo CC $<
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) -DLIB -c -o $(OUT)/libmkamsboot.o -W -Wall mkamsboot.c
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2009-10-31 17:18:17 +00:00
|
|
|
libmkamsboot$(RBARCH).a: $(OUT) $(OUT)/libmkamsboot.o
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo AR $@
|
2009-11-03 22:05:35 +00:00
|
|
|
$(SILENT)$(AR) ruc $(TARGET_DIR)libmkamsboot$(RBARCH).a $(OUT)/libmkamsboot.o $(OUT)/md5.o $(OUT)/dualboot.o
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2009-08-15 13:54:13 +00:00
|
|
|
# some trickery to build ppc and i386 from a single call
|
|
|
|
ifeq ($(RBARCH),)
|
|
|
|
libmkamsbooti386.a:
|
2009-09-04 21:31:17 +00:00
|
|
|
make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libmkamsbooti386.a
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2009-08-15 13:54:13 +00:00
|
|
|
libmkamsbootppc.a:
|
2009-09-04 21:31:17 +00:00
|
|
|
make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkamsbootppc.a
|
2009-08-15 13:54:13 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
libmkamsboot-universal: libmkamsbooti386.a libmkamsbootppc.a
|
2009-09-04 21:31:17 +00:00
|
|
|
@echo lipo $(TARGET_DIR)libmkamsboot.a
|
|
|
|
$(SILENT) rm -f $(TARGET_DIR)libmkamsboot.a
|
2009-09-05 08:54:52 +00:00
|
|
|
lipo -create $(TARGET_DIR)libmkamsbootppc.a $(TARGET_DIR)libmkamsbooti386.a -output $(TARGET_DIR)libmkamsboot.a
|
2009-08-15 13:54:13 +00:00
|
|
|
|
2008-10-04 08:46:03 +00:00
|
|
|
clean:
|
2009-10-31 17:18:17 +00:00
|
|
|
rm -f $(OUTPUT) libmkamsboot.o $(TARGET_DIR)libmkamsboot*.a mkamsboot.dmg $(DEPENDANT_OBJS)
|
2009-10-09 08:49:41 +00:00
|
|
|
rm -rf build* mkamsboot-*
|
|
|
|
|
|
|
|
mkamsboot-i386:
|
|
|
|
$(MAKE) RBARCH=i386
|
|
|
|
mv mkamsboot mkamsboot-i386
|
|
|
|
|
|
|
|
mkamsboot-ppc:
|
|
|
|
make RBARCH=ppc
|
|
|
|
mv mkamsboot mkamsboot-ppc
|
|
|
|
|
|
|
|
mkamsboot-mac: mkamsboot-i386 mkamsboot-ppc
|
|
|
|
lipo -create mkamsboot-ppc mkamsboot-i386 -output mkamsboot-mac
|
|
|
|
|
|
|
|
mkamsboot.dmg: mkamsboot-mac
|
|
|
|
mkdir -p mkamsboot-dmg
|
|
|
|
cp -p mkamsboot-mac mkamsboot-dmg
|
|
|
|
hdiutil create -srcfolder mkamsboot-dmg mkamsboot.dmg
|
2009-08-15 13:54:13 +00:00
|
|
|
|
2009-09-04 21:31:17 +00:00
|
|
|
$(OUT):
|
|
|
|
@echo MKDIR $(OUT)
|
|
|
|
$(SILENT)mkdir $(OUT)
|
2009-08-15 14:26:08 +00:00
|
|
|
|