2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 APPVERSION
=$(shell ..
/..
/tools
/version.sh ..
/..
/)
12 TARGET_DIR ?
= $(shell pwd
)/
13 # We use the UCL code available in the Rockbox tools/ directory
14 CFLAGS
=-I..
/..
/tools
/ucl
/include -Wall
-DVERSION
=\"$(APPVERSION
)\"
20 ifeq ($(findstring CYGWIN
,$(shell uname
)),CYGWIN
)
24 ifeq ($(findstring MINGW
,$(shell uname
)),MINGW
)
27 ifeq ($(findstring mingw
,$(CC
)),mingw
)
36 CFLAGS
+= -arch
$(RBARCH
)
37 OBJDIR
= $(TARGET_DIR
)build
/$(RBARCH
)/
39 OBJDIR
= $(TARGET_DIR
)build
/
45 # additional link dependencies for the standalone executable
46 LIBUCL
=$(OBJDIR
)libucl
$(RBARCH
).a
49 $(SILENT
)$(MAKE
) -C ..
/..
/tools
/ucl
/src TARGET_DIR
=$(OBJDIR
) libucl
$(RBARCH
).a
52 LIBSOURCES
:= dualboot.c md5.c mkamsboot.c
53 SOURCES
:= $(LIBSOURCES
) main.c
54 OBJS
:= $(patsubst %.c
,%.o
,$(addprefix $(OBJDIR
),$(SOURCES
)))
55 LIBOBJS
:= $(patsubst %.c
,%.o
,$(addprefix $(OBJDIR
),$(LIBSOURCES
)))
56 EXTRADEPS
:= $(LIBUCL
)
58 # explicit dependencies on dualboot.{c,h} and mkamsboot.h
59 $(OBJDIR
)mkamsboot.o
: dualboot.h dualboot.c mkamsboot.c mkamsboot.h
60 $(OBJDIR
)main.o
: dualboot.h dualboot.c main.c mkamsboot.h
64 $(SILENT
)mkdir
-p
$(dir $@
)
65 $(SILENT
)$(CC
) $(CFLAGS
) -c
-o
$@
$<
67 libmkamsboot
$(RBARCH
).a
: $(TARGET_DIR
)libmkamsboot
$(RBARCH
).a
69 $(TARGET_DIR
)libmkamsboot
$(RBARCH
).a
: $(LIBOBJS
)
71 $(SILENT
)$(AR
) rucs
$@
$^
73 # building the standalone executable
74 $(OUTPUT
): $(OBJS
) $(EXTRADEPS
)
76 $(SILENT
)$(CC
) $(CFLAGS
) -o
$(OUTPUT
) $(OBJS
) $(EXTRADEPS
)
78 # some trickery to build ppc and i386 from a single call
80 $(TARGET_DIR
)libmkamsbooti386.a
:
81 make RBARCH
=i386 TARGET_DIR
=$(TARGET_DIR
) libmkamsbooti386.a
83 $(TARGET_DIR
)libmkamsbootppc.a
:
84 make RBARCH
=ppc TARGET_DIR
=$(TARGET_DIR
) libmkamsbootppc.a
87 libmkamsboot-universal
: $(TARGET_DIR
)libmkamsbooti386.a
$(TARGET_DIR
)libmkamsbootppc.a
88 @echo lipo
$(TARGET_DIR
)libmkamsboot.a
89 $(SILENT
) rm -f
$(TARGET_DIR
)libmkamsboot.a
90 $(SILENT
)lipo
-create
$(TARGET_DIR
)libmkamsbootppc.a
$(TARGET_DIR
)libmkamsbooti386.a
-output
$(TARGET_DIR
)libmkamsboot.a
93 rm -f
$(OBJS
) $(OUTPUT
) libmkamsboot.o
$(TARGET_DIR
)libmkamsboot
*.a mkamsboot.dmg
94 rm -rf mkamsboot-
* i386 ppc
$(OBJDIR
)
98 mv mkamsboot mkamsboot-i386
102 mv mkamsboot mkamsboot-ppc
104 mkamsboot-mac
: mkamsboot-i386 mkamsboot-ppc
105 $(SILENT
)lipo
-create mkamsboot-ppc mkamsboot-i386
-output mkamsboot-mac
107 mkamsboot.dmg
: mkamsboot-mac
108 mkdir
-p mkamsboot-dmg
109 cp
-p mkamsboot-mac mkamsboot-dmg
110 hdiutil create
-srcfolder mkamsboot-dmg mkamsboot.dmg