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
|
2010-02-22 05:41:09 +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)\"
|
|
|
|
|
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)
|
2010-02-19 08:09:41 +00:00
|
|
|
OBJDIR = $(RBARCH)/
|
2009-08-15 13:54:13 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
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
|
2010-02-19 08:09:41 +00:00
|
|
|
OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES)))
|
|
|
|
LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(LIBSOURCES)))
|
2009-11-04 20:58:40 +00:00
|
|
|
EXTRADEPS := $(LIBUCL)
|
2009-08-15 13:54:13 +00:00
|
|
|
|
2010-02-25 18:08:16 +00:00
|
|
|
# explicit dependencies on dualboot.{c,h}
|
|
|
|
$(OBJDIR)mkamsboot.o: dualboot.h dualboot.c mkamsboot.c
|
|
|
|
$(OBJDIR)main.o: dualboot.h dualboot.c main.c
|
|
|
|
|
2010-02-19 08:09:41 +00:00
|
|
|
$(OBJDIR)%.o: %.c
|
2009-11-04 20:58:40 +00:00
|
|
|
@echo CC $< $
|
2010-02-19 08:09:41 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
2009-11-04 20:58:40 +00:00
|
|
|
$(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
|
2008-10-19 19:51:42 +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
|
2010-02-19 07:16:51 +00:00
|
|
|
$(OUTPUT): $(OBJS) $(EXTRADEPS)
|
2009-11-04 20:58:40 +00:00
|
|
|
@echo LD $@
|
2009-11-08 21:00:55 +00:00
|
|
|
$(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),)
|
2009-11-28 22:39:00 +00:00
|
|
|
$(TARGET_DIR)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-11-28 22:39:00 +00:00
|
|
|
$(TARGET_DIR)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
|
2010-02-19 08:09:41 +00:00
|
|
|
|
2009-11-28 22:39:00 +00:00
|
|
|
libmkamsboot-universal: $(TARGET_DIR)libmkamsbooti386.a $(TARGET_DIR)libmkamsbootppc.a
|
2009-09-04 21:31:17 +00:00
|
|
|
@echo lipo $(TARGET_DIR)libmkamsboot.a
|
|
|
|
$(SILENT) rm -f $(TARGET_DIR)libmkamsboot.a
|
2009-12-13 21:30:28 +00:00
|
|
|
$(SILENT)lipo -create $(TARGET_DIR)libmkamsbootppc.a $(TARGET_DIR)libmkamsbooti386.a -output $(TARGET_DIR)libmkamsboot.a
|
2010-02-19 08:09:41 +00:00
|
|
|
|
2008-10-04 08:46:03 +00:00
|
|
|
clean:
|
2010-02-19 08:09:41 +00:00
|
|
|
rm -f $(OBJS) $(OUTPUT) libmkamsboot.o $(TARGET_DIR)libmkamsboot*.a mkamsboot.dmg
|
|
|
|
rm -rf mkamsboot-* i386 ppc $(OBJDIR)
|
2009-10-09 08:49:41 +00:00
|
|
|
|
|
|
|
mkamsboot-i386:
|
|
|
|
$(MAKE) RBARCH=i386
|
|
|
|
mv mkamsboot mkamsboot-i386
|
|
|
|
|
|
|
|
mkamsboot-ppc:
|
2010-02-19 08:09:41 +00:00
|
|
|
$(MAKE) RBARCH=ppc
|
2009-10-09 08:49:41 +00:00
|
|
|
mv mkamsboot mkamsboot-ppc
|
|
|
|
|
|
|
|
mkamsboot-mac: mkamsboot-i386 mkamsboot-ppc
|
2009-12-13 21:30:28 +00:00
|
|
|
$(SILENT)lipo -create mkamsboot-ppc mkamsboot-i386 -output mkamsboot-mac
|
2009-10-09 08:49:41 +00:00
|
|
|
|
|
|
|
mkamsboot.dmg: mkamsboot-mac
|
|
|
|
mkdir -p mkamsboot-dmg
|
|
|
|
cp -p mkamsboot-mac mkamsboot-dmg
|
|
|
|
hdiutil create -srcfolder mkamsboot-dmg mkamsboot.dmg
|