summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-15 18:45:05 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2011-12-15 18:45:05 +0000
commitd16cefca9505fb814cbbbe7866a90584347e745c (patch)
treee4843d5c428f558334f7203f6342fb1a242275e1
parentdfcb85e62541c828414219106b04a4b20e5e86c6 (diff)
downloadrockbox-d16cefca9505fb814cbbbe7866a90584347e745c.tar.gz
rockbox-d16cefca9505fb814cbbbe7866a90584347e745c.zip
mkamsboot: convert to use libtools.make.
As a result building mkamsboot for Rockbox Utility will now respect BUILD_DIR, which should eliminate all possibly remaining issues with dualboot.o. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31283 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/mkamsboot/Makefile96
1 files changed, 5 insertions, 91 deletions
diff --git a/rbutil/mkamsboot/Makefile b/rbutil/mkamsboot/Makefile
index 052904211b..5379e1376f 100644
--- a/rbutil/mkamsboot/Makefile
+++ b/rbutil/mkamsboot/Makefile
@@ -5,106 +5,20 @@
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/ 6# \/ \/ \/ \/ \/
7 7
8#change for releases
9ifndef APPVERSION
10APPVERSION=$(shell ../../tools/version.sh ../../)
11endif
12TARGET_DIR ?= $(shell pwd)/
13# We use the UCL code available in the Rockbox tools/ directory 8# We use the UCL code available in the Rockbox tools/ directory
14CFLAGS=-I../../tools/ucl/include -Wall -DVERSION=\"$(APPVERSION)\" 9CFLAGS += -I../../tools/ucl/include -Wall
15 10
16ifndef V 11OUTPUT = mkamsboot
17SILENT = @ 12LIBUCL = libucl$(RBARCH).a
18endif
19
20ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN)
21OUTPUT=mkamsboot.exe
22CFLAGS+=-mno-cygwin
23else
24ifeq ($(findstring MINGW,$(shell uname)),MINGW)
25OUTPUT=mkamsboot.exe
26else
27ifeq ($(findstring mingw,$(CC)),mingw)
28OUTPUT=mkamsboot.exe
29else
30OUTPUT=mkamsboot
31endif
32endif
33endif
34
35ifdef RBARCH
36CFLAGS += -arch $(RBARCH)
37OBJDIR = $(TARGET_DIR)build/$(RBARCH)/
38else
39OBJDIR = $(TARGET_DIR)build/
40endif
41
42
43all: $(OUTPUT)
44
45# additional link dependencies for the standalone executable
46LIBUCL=$(OBJDIR)libucl$(RBARCH).a
47
48$(LIBUCL):
49 $(SILENT)$(MAKE) -C ../../tools/ucl/src TARGET_DIR=$(OBJDIR) libucl$(RBARCH).a
50 13
51# inputs 14# inputs
52LIBSOURCES := dualboot.c md5.c mkamsboot.c 15LIBSOURCES := dualboot.c md5.c mkamsboot.c
53SOURCES := $(LIBSOURCES) main.c 16SOURCES := $(LIBSOURCES) main.c
54OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES))) 17# additional link dependencies for the standalone executable
55LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(LIBSOURCES)))
56EXTRADEPS := $(LIBUCL) 18EXTRADEPS := $(LIBUCL)
57 19
20include ../libtools.make
58# explicit dependencies on dualboot.{c,h} and mkamsboot.h 21# explicit dependencies on dualboot.{c,h} and mkamsboot.h
59$(OBJDIR)mkamsboot.o: dualboot.h dualboot.c mkamsboot.c mkamsboot.h 22$(OBJDIR)mkamsboot.o: dualboot.h dualboot.c mkamsboot.c mkamsboot.h
60$(OBJDIR)main.o: dualboot.h dualboot.c main.c mkamsboot.h 23$(OBJDIR)main.o: dualboot.h dualboot.c main.c mkamsboot.h
61 24
62$(OBJDIR)%.o: %.c
63 @echo CC $<
64 $(SILENT)mkdir -p $(dir $@)
65 $(SILENT)$(CC) $(CFLAGS) -c -o $@ $<
66
67libmkamsboot$(RBARCH).a: $(TARGET_DIR)libmkamsboot$(RBARCH).a
68
69$(TARGET_DIR)libmkamsboot$(RBARCH).a: $(LIBOBJS)
70 @echo AR $(notdir $@)
71 $(SILENT)$(AR) rucs $@ $^
72
73# building the standalone executable
74$(OUTPUT): $(OBJS) $(EXTRADEPS)
75 @echo LD $@
76 $(SILENT)$(CC) $(CFLAGS) -o $(OUTPUT) $(OBJS) $(EXTRADEPS)
77
78# some trickery to build ppc and i386 from a single call
79ifeq ($(RBARCH),)
80$(TARGET_DIR)libmkamsbooti386.a:
81 make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libmkamsbooti386.a
82
83$(TARGET_DIR)libmkamsbootppc.a:
84 make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libmkamsbootppc.a
85endif
86
87libmkamsboot-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
91
92clean:
93 rm -f $(OBJS) $(OUTPUT) libmkamsboot.o $(TARGET_DIR)libmkamsboot*.a mkamsboot.dmg
94 rm -rf mkamsboot-* i386 ppc $(OBJDIR)
95
96mkamsboot-i386:
97 $(MAKE) RBARCH=i386
98 mv mkamsboot mkamsboot-i386
99
100mkamsboot-ppc:
101 $(MAKE) RBARCH=ppc
102 mv mkamsboot mkamsboot-ppc
103
104mkamsboot-mac: mkamsboot-i386 mkamsboot-ppc
105 $(SILENT)lipo -create mkamsboot-ppc mkamsboot-i386 -output mkamsboot-mac
106
107mkamsboot.dmg: mkamsboot-mac
108 mkdir -p mkamsboot-dmg
109 cp -p mkamsboot-mac mkamsboot-dmg
110 hdiutil create -srcfolder mkamsboot-dmg mkamsboot.dmg