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
|
2008-10-11 11:35:59 +00:00
|
|
|
LIBUCL=../../tools/ucl/src/libucl.a
|
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
|
|
|
|
APPVERSION=`../../tools/version.sh`
|
|
|
|
|
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
|
|
|
|
2008-11-14 22:16:22 +00:00
|
|
|
$(LIBUCL):
|
2009-09-04 21:31:17 +00:00
|
|
|
make -C ../../tools/ucl/src $(TARGET_DIR)libucl.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-08-15 13:54:13 +00:00
|
|
|
$(OUT)/dualboot.o: dualboot.c
|
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
|
|
|
|
|
|
|
$(OUT)/md5.o: md5.c md5.h
|
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-08-15 13:54:13 +00:00
|
|
|
$(OUT)/mkamsboot.o: mkamsboot.c dualboot.h md5.h
|
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-08-15 13:54:13 +00:00
|
|
|
$(OUTPUT): $(OUT) $(OUT)/mkamsboot.o $(OUT)/md5.o $(OUT)/dualboot.o $(LIBUCL)
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo CC $<
|
|
|
|
$(SILENT)$(CC) $(CFLAGS) -o $(OUTPUT) $(OUT)/mkamsboot.o $(OUT)/md5.o $(OUT)/dualboot.o $(LIBUCL)
|
2008-10-19 19:51:42 +00:00
|
|
|
|
2009-08-15 13:54:13 +00:00
|
|
|
$(OUT)/libmkamsboot.o: mkamsboot.c dualboot.h md5.h
|
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-08-15 13:54:13 +00:00
|
|
|
libmkamsboot$(RBARCH).a: $(OUT) $(OUT)/libmkamsboot.o $(OUT)/md5.o $(OUT)/dualboot.o
|
2009-09-05 08:54:52 +00:00
|
|
|
@echo AR $@
|
|
|
|
$(SILENT)$(AR) ru $(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-09-04 21:31:17 +00:00
|
|
|
rm -f $(OUTPUT) libmkamsboot.o $(TARGET_DIR)libmkamsboot*.a
|
2009-08-15 13:54:13 +00:00
|
|
|
rm -rf build*
|
|
|
|
|
2009-09-04 21:31:17 +00:00
|
|
|
$(OUT):
|
|
|
|
@echo MKDIR $(OUT)
|
|
|
|
$(SILENT)mkdir $(OUT)
|
2009-08-15 14:26:08 +00:00
|
|
|
|