diff options
Diffstat (limited to 'rbutil/mkamsboot/Makefile')
-rw-r--r-- | rbutil/mkamsboot/Makefile | 96 |
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 | ||
9 | ifndef APPVERSION | ||
10 | APPVERSION=$(shell ../../tools/version.sh ../../) | ||
11 | endif | ||
12 | TARGET_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 |
14 | CFLAGS=-I../../tools/ucl/include -Wall -DVERSION=\"$(APPVERSION)\" | 9 | CFLAGS += -I../../tools/ucl/include -Wall |
15 | 10 | ||
16 | ifndef V | 11 | OUTPUT = mkamsboot |
17 | SILENT = @ | 12 | LIBUCL = libucl$(RBARCH).a |
18 | endif | ||
19 | |||
20 | ifeq ($(findstring CYGWIN,$(shell uname)),CYGWIN) | ||
21 | OUTPUT=mkamsboot.exe | ||
22 | CFLAGS+=-mno-cygwin | ||
23 | else | ||
24 | ifeq ($(findstring MINGW,$(shell uname)),MINGW) | ||
25 | OUTPUT=mkamsboot.exe | ||
26 | else | ||
27 | ifeq ($(findstring mingw,$(CC)),mingw) | ||
28 | OUTPUT=mkamsboot.exe | ||
29 | else | ||
30 | OUTPUT=mkamsboot | ||
31 | endif | ||
32 | endif | ||
33 | endif | ||
34 | |||
35 | ifdef RBARCH | ||
36 | CFLAGS += -arch $(RBARCH) | ||
37 | OBJDIR = $(TARGET_DIR)build/$(RBARCH)/ | ||
38 | else | ||
39 | OBJDIR = $(TARGET_DIR)build/ | ||
40 | endif | ||
41 | |||
42 | |||
43 | all: $(OUTPUT) | ||
44 | |||
45 | # additional link dependencies for the standalone executable | ||
46 | LIBUCL=$(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 |
52 | LIBSOURCES := dualboot.c md5.c mkamsboot.c | 15 | LIBSOURCES := dualboot.c md5.c mkamsboot.c |
53 | SOURCES := $(LIBSOURCES) main.c | 16 | SOURCES := $(LIBSOURCES) main.c |
54 | OBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(SOURCES))) | 17 | # additional link dependencies for the standalone executable |
55 | LIBOBJS := $(patsubst %.c,%.o,$(addprefix $(OBJDIR),$(LIBSOURCES))) | ||
56 | EXTRADEPS := $(LIBUCL) | 18 | EXTRADEPS := $(LIBUCL) |
57 | 19 | ||
20 | include ../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 | |||
67 | libmkamsboot$(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 | ||
79 | ifeq ($(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 | ||
85 | endif | ||
86 | |||
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 | ||
91 | |||
92 | clean: | ||
93 | rm -f $(OBJS) $(OUTPUT) libmkamsboot.o $(TARGET_DIR)libmkamsboot*.a mkamsboot.dmg | ||
94 | rm -rf mkamsboot-* i386 ppc $(OBJDIR) | ||
95 | |||
96 | mkamsboot-i386: | ||
97 | $(MAKE) RBARCH=i386 | ||
98 | mv mkamsboot mkamsboot-i386 | ||
99 | |||
100 | mkamsboot-ppc: | ||
101 | $(MAKE) RBARCH=ppc | ||
102 | mv mkamsboot mkamsboot-ppc | ||
103 | |||
104 | mkamsboot-mac: mkamsboot-i386 mkamsboot-ppc | ||
105 | $(SILENT)lipo -create mkamsboot-ppc mkamsboot-i386 -output mkamsboot-mac | ||
106 | |||
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 | ||