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
|
|
|
|
|
|
|
|
CC?= gcc
|
|
|
|
|
2009-08-15 13:54:13 +00:00
|
|
|
ifdef RBARCH
|
|
|
|
CFLAGS += -arch $(RBARCH)
|
|
|
|
endif
|
|
|
|
|
|
|
|
OUT = build$(RBARCH)
|
|
|
|
|
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):
|
|
|
|
make -C ../../tools/ucl/src 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
|
|
|
|
$(CC) $(CFLAGS) -c -o $(OUT)/dualboot.o dualboot.c
|
|
|
|
|
|
|
|
$(OUT)/md5.o: md5.c md5.h
|
|
|
|
$(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
|
|
|
|
$(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)
|
|
|
|
$(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
|
|
|
|
$(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-08-15 14:26:08 +00:00
|
|
|
$(AR) ru 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:
|
|
|
|
make RBARCH=i386 libmkamsbooti386.a
|
2008-10-04 08:46:03 +00:00
|
|
|
|
2009-08-15 13:54:13 +00:00
|
|
|
libmkamsbootppc.a:
|
|
|
|
make RBARCH=ppc libmkamsbootppc.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
libmkamsboot-universal: libmkamsbooti386.a libmkamsbootppc.a
|
|
|
|
@echo lipo libmkamsboot.a
|
|
|
|
$(SILENT) rm -f libmkamsboot.a
|
|
|
|
lipo -create libmkamsbootppc.a libmkamsbooti386.a -output libmkamsboot.a
|
|
|
|
|
2008-10-04 08:46:03 +00:00
|
|
|
clean:
|
2009-08-15 13:54:13 +00:00
|
|
|
rm -f $(OUTPUT) libmkamsboot.o libmkamsboot*.a
|
|
|
|
rm -rf build*
|
|
|
|
|
|
|
|
build$(RBARCH):
|
|
|
|
@echo MKDIR build$(RBARCH)
|
2009-08-15 14:26:08 +00:00
|
|
|
$(SILENT)mkdir build$(RBARCH)
|
|
|
|
|