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-11-04 20:58:40 +00:00
|
|
|
# We use the UCL code available in the Rockbox tools/ directory
|
|
|
|
CFLAGS=-I../../tools/ucl/include -Wall -DVERSION=\"$(APPVERSION)\"
|
|
|
|
CC = gcc
|
|
|
|
|
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-11-04 20:58:40 +00:00
|
|
|
# additional link dependencies for the standalone executable
|
2009-10-31 17:18:17 +00:00
|
|
|
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-11-04 20:58:40 +00:00
|
|
|
# inputs
|
|
|
|
LIBSOURCES := dualboot.c md5.c mkamsboot.c
|
|
|
|
SOURCES := $(LIBSOURCES) main.c
|
|
|
|
OBJS := $(patsubst %.c,%.o,$(addprefix $(OUT)/,$(SOURCES)))
|
|
|
|
LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OUT)/,$(LIBSOURCES)))
|
|
|
|
EXTRADEPS := $(LIBUCL)
|
2009-08-15 13:54:13 +00:00
|
|
|
|
2009-11-04 20:58:40 +00:00
|
|
|
$(OUT)/%.o: %.c $(OUT)
|
|
|
|
@echo CC $< $
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
|
2008-10-19 19:51:42 +00:00
|
|
|
|
2009-11-04 20:58:40 +00:00
|
|
|
# building the library archive
|
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-11-04 20:58:40 +00:00
|
|
|
libmkamsboot$(RBARCH).a: $(LIBOBJS)
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo AR $@
|
2009-11-04 20:58:40 +00:00
|
|
|
$(SILENT)$(AR) ruc $(TARGET_DIR)$@ $^
|
|
|
|
|
|
|
|
# building the standalone executable
|
|
|
|
$(OUTPUT): $(OBJS) $(EXTRADEPS)
|
|
|
|
@echo LD $@
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) -o$(OUTPUT) $(OBJS) $(EXTRADEPS)
|
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-11-04 21:57:28 +00:00
|
|
|
rm -f $(OUTPUT) libmkamsboot.o $(TARGET_DIR)libmkamsboot*.a mkamsboot.dmg
|
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
|
|
|
|