2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
16 FIRMWARE
:= ..
/firmware
18 INCLUDES
= -I
$(FIRMWARE
)/include -I
$(FIRMWARE
) -I
$(FIRMWARE
)/common
-I
$(FIRMWARE
)/drivers
-I
$(FIRMWARE
)/malloc
20 # Pick a target to build for
21 #TARGET = -DARCHOS_PLAYER=1
22 TARGET
= -DARCHOS_PLAYER_OLD
=1
23 #TARGET = -DARCHOS_RECORDER=1
25 # store output files in this directory:
28 CFLAGS
= -O
-W
-Wall
-m1
-nostdlib
-Wstrict-prototypes
-fomit-frame-pointer
-fschedule-insns
$(INCLUDES
) $(TARGET
) $(DEFINES
) -DAPPSVERSION
=\"$(VERSION
)\" $(EXTRA_DEFINES
)
29 AFLAGS
+= -small
-relax
34 LDS
:= $(FIRMWARE
)/gdb.lds
36 ifeq ($(TARGET
),-DARCHOS_RECORDER
)
37 LDS
:= $(FIRMWARE
)/app.lds
39 LDS
:= $(FIRMWARE
)/player.lds
43 SRC
:= $(wildcard *.c
)
45 ifeq ($(TARGET
),-DARCHOS_RECORDER
)
46 SRC
+= $(wildcard recorder
/*.c
)
53 OBJS
:= $(SRC
:%.c
=$(OBJDIR
)/%.o
)
55 all : $(OBJDIR
)/$(OUTNAME
)
57 $(OBJDIR
)/librockbox.a
:
58 make
-C
$(FIRMWARE
) TARGET
=$(TARGET
) DEBUG
=$(DEBUG
) OBJDIR
=$(OBJDIR
)
60 $(OBJDIR
)/archos.elf
: $(OBJS
) $(LDS
) $(OBJDIR
)/librockbox.a
61 $(CC
) -Os
-nostdlib
-o
$(OBJDIR
)/archos.elf
$(OBJS
) -L
$(OBJDIR
) -lrockbox
-lgcc
-L
$(FIRMWARE
) -T
$(LDS
) -Wl
,-Map
,$(OBJDIR
)/archos.map
63 $(OBJDIR
)/archos.bin
: $(OBJDIR
)/archos.elf
64 $(OC
) -O binary
$(OBJDIR
)/archos.elf
$(OBJDIR
)/archos.bin
66 $(OBJDIR
)/archos.asm
: $(OBJDIR
)/archos.bin
67 ..
/tools
/sh2d
-sh1
$(OBJDIR
)/archos.bin
> $(OBJDIR
)/archos.asm
69 $(OBJDIR
)/$(OUTNAME
) : $(OBJDIR
)/archos.bin
70 ..
/tools
/scramble
$(OBJDIR
)/archos.bin
$(OBJDIR
)/$(OUTNAME
)
73 @mkdir
-p
`dirname $@`
74 $(CC
) $(CFLAGS
) -c
$< -o
$@
77 tar czvf
dist.
tar.gz Makefile main.c start.s app.lds
80 -rm -f
$(OBJS
) $(OBJDIR
)/$(OUTNAME
) $(OBJDIR
)/archos.asm \
81 $(OBJDIR
)/archos.bin
$(OBJDIR
)/archos.elf
$(OBJDIR
)/archos.map
82 -$(RM
) -r
$(OBJDIR
)/$(DEPS
)
85 DEPDIRS
:=$(DEPS
) $(DEPS
)/recorder
87 DIRS
= $(subst $(DEPS
),".",$(DEPDIRS
))
90 @
$(SHELL
) -c
'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'
92 $(OBJDIR
)/$(DEPS
)/%.d
: %.c
93 @
$(SHELL
) -c
'for d in $(DEPDIRS); do { if [ ! -d $(OBJDIR)/$$d ]; then mkdir $(OBJDIR)/$$d; fi; }; done'
94 @echo
"Updating dependencies for $(OBJDIR)/$<"
95 @
$(SHELL
) -ec
'$(CC) -MM $(CFLAGS) $< \
96 |sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
97 [ -s $@ ] || rm -f $@'
99 -include $(SRC
:%.c
=$(OBJDIR
)/$(DEPS
)/%.d
)