summaryrefslogtreecommitdiff
path: root/apps/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/Makefile')
-rw-r--r--apps/Makefile37
1 files changed, 23 insertions, 14 deletions
diff --git a/apps/Makefile b/apps/Makefile
index 68ea23a21a..9c2b961a5a 100644
--- a/apps/Makefile
+++ b/apps/Makefile
@@ -26,6 +26,11 @@ AFLAGS += -small -relax
26# Check if this is a kind of Recorder 26# Check if this is a kind of Recorder
27ANYREC = $(findstring RECORDER, $(TARGET)) 27ANYREC = $(findstring RECORDER, $(TARGET))
28 28
29ifndef MEM
30 # if MEM is not set, assume 2MB
31 MEM=2
32endif
33
29ifdef DEBUG 34ifdef DEBUG
30 DEFINES := -DDEBUG 35 DEFINES := -DDEBUG
31 CFLAGS += -g 36 CFLAGS += -g
@@ -52,6 +57,8 @@ endif
52 57
53OBJS := $(OBJDIR)/lang.o $(SRC:%.c=$(OBJDIR)/%.o) 58OBJS := $(OBJDIR)/lang.o $(SRC:%.c=$(OBJDIR)/%.o)
54 59
60LINKFILE = $(OBJDIR)/linkage.lds
61
55ifndef OBJDIR 62ifndef OBJDIR
56no_configure: 63no_configure:
57 @echo "Don't run make here. Run the tools/configure script from your own build" 64 @echo "Don't run make here. Run the tools/configure script from your own build"
@@ -66,17 +73,22 @@ all : $(OBJDIR)/$(OUTNAME)
66$(OBJDIR)/librockbox.a: 73$(OBJDIR)/librockbox.a:
67 make -C $(FIRMWARE) TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR) 74 make -C $(FIRMWARE) TARGET=$(TARGET) DEBUG=$(DEBUG) OBJDIR=$(OBJDIR)
68 75
69$(OBJDIR)/archos.elf : $(OBJS) $(LDS) $(OBJDIR)/librockbox.a 76# MEM should be passed on to this makefile with the chosen memory size given
70 $(CC) -Os -nostdlib -o $(OBJDIR)/archos.elf $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMWARE) -T$(LDS) -Wl,-Map,$(OBJDIR)/archos.map 77# in number of MB
78$(LINKFILE): $(LDS)
79 cat $< | $(CC) -DMEMORYSIZE=$(MEM) -E -P - >$@
71 80
72$(OBJDIR)/archos.bin : $(OBJDIR)/archos.elf 81$(OBJDIR)/rockbox.elf : $(OBJS) $(LINKFILE) $(OBJDIR)/librockbox.a
73 $(OC) -O binary $(OBJDIR)/archos.elf $(OBJDIR)/archos.bin 82 $(CC) -Os -nostdlib -o $(OBJDIR)/rockbox.elf $(OBJS) -L$(OBJDIR) -lrockbox -lgcc -L$(FIRMWARE) -T$(LINKFILE) -Wl,-Map,$(OBJDIR)/rockbox.map
74 83
75$(OBJDIR)/archos.asm: $(OBJDIR)/archos.bin 84$(OBJDIR)/rockbox.bin : $(OBJDIR)/rockbox.elf
76 ../tools/sh2d -sh1 $(OBJDIR)/archos.bin > $(OBJDIR)/archos.asm 85 $(OC) -O binary $(OBJDIR)/rockbox.elf $(OBJDIR)/rockbox.bin
77 86
78$(OBJDIR)/$(OUTNAME) : $(OBJDIR)/archos.bin 87$(OBJDIR)/rockbox.asm: $(OBJDIR)/rockbox.bin
79 ../tools/scramble $(SCRAMBLE_OPT) $(OBJDIR)/archos.bin $(OBJDIR)/$(OUTNAME) 88 ../tools/sh2d -sh1 $(OBJDIR)/rockbox.bin > $(OBJDIR)/rockbox.asm
89
90$(OBJDIR)/$(OUTNAME) : $(OBJDIR)/rockbox.bin
91 ../tools/scramble $(SCRAMBLE_OPT) $(OBJDIR)/rockbox.bin $(OBJDIR)/$(OUTNAME)
80 92
81$(OBJDIR)/credits.raw: $(DOCSDIR)/CREDITS 93$(OBJDIR)/credits.raw: $(DOCSDIR)/CREDITS
82 perl credits.pl < $< > $@ 94 perl credits.pl < $< > $@
@@ -96,14 +108,11 @@ $(OBJDIR)/lang.o: $(OBJDIR)/build.lang ../tools/genlang
96 perl -s ../tools/genlang -p=$(OBJDIR)/lang $< 108 perl -s ../tools/genlang -p=$(OBJDIR)/lang $<
97 $(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@ 109 $(CC) $(CFLAGS) -c $(OBJDIR)/lang.c -o $@
98 110
99dist:
100 tar czvf dist.tar.gz Makefile main.c start.s app.lds
101
102clean: 111clean:
103 -rm -f $(OBJS) $(OBJDIR)/$(OUTNAME) $(OBJDIR)/archos.asm \ 112 -rm -f $(OBJS) $(OBJDIR)/$(OUTNAME) $(OBJDIR)/rockbox.asm \
104 $(OBJDIR)/archos.bin $(OBJDIR)/archos.elf $(OBJDIR)/archos.map \ 113 $(OBJDIR)/rockbox.bin $(OBJDIR)/rockbox.elf $(OBJDIR)/rockbox.map \
105 $(OBJDIR)/lang.o $(OBJDIR)/build.lang $(OBJDIR)/lang.[ch] \ 114 $(OBJDIR)/lang.o $(OBJDIR)/build.lang $(OBJDIR)/lang.[ch] \
106 $(OBJDIR)/credits.raw 115 $(OBJDIR)/credits.raw $(LINKFILE)
107 -$(RM) -r $(OBJDIR)/$(DEPS) 116 -$(RM) -r $(OBJDIR)/$(DEPS)
108 117
109DEPS:=.deps 118DEPS:=.deps