summaryrefslogtreecommitdiff
path: root/apps/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/Makefile')
-rw-r--r--apps/Makefile64
1 files changed, 64 insertions, 0 deletions
diff --git a/apps/Makefile b/apps/Makefile
new file mode 100644
index 0000000000..c8b87ae5eb
--- /dev/null
+++ b/apps/Makefile
@@ -0,0 +1,64 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10CC = sh-elf-gcc
11LD = sh-elf-ld
12AR = sh-elf-ar
13AS = sh-elf-as
14OC = sh-elf-objcopy
15
16FIRMWARE := ../firmware
17
18INCLUDES= -I$(FIRMWARE) -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers
19
20# Pick a target to build for
21TARGET = -DARCHOS_PLAYER=1
22#TARGET = -DARCHOS_PLAYER_OLD=1
23#TARGET = -DARCHOS_RECORDER=1
24
25CFLAGS = -Os -W -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) -DDEBUG
26AFLAGS += -small -relax
27
28SRC := $(wildcard drivers/*.c common/*.c *.c)
29OBJS := $(SRC:%.c=%.o) crt0.o
30
31all : archos.mod # archos.asm
32
33archos.elf : $(OBJS) $(FIRMWARE)/app.lds
34 $(CC) -nostdlib -o archos.elf $(OBJS) -lgcc -lc -T$(FIRMWARE)/app.lds -Wl,-Map,archos.map
35
36archos.bin : archos.elf
37 $(OC) -O binary archos.elf archos.bin
38
39archos.asm: archos.bin
40 ../tools/sh2d -sh1 archos.bin > archos.asm
41
42archos.mod : archos.bin
43 ../tools/scramble archos.bin archos.mod
44
45dist:
46 tar czvf dist.tar.gz Makefile main.c start.s app.lds
47
48clean:
49 -rm -f *.x *.i *.o *.elf *.bin *.map *.mod *.bak *~
50 -$(RM) -r $(DEPS)
51
52crt0.o: $(FIRMWARE)/crt0.S
53
54DEPS:=.deps
55DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common
56
57$(DEPS)/%.d: %.c
58 @$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $$d ]; then mkdir $$d; fi; }; done'
59 @echo "Updating dependencies for $<"
60 @$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
61 |sed '\''s|\($*\)\.o[ :]*|\1.o $(<:%.c=%.d) : |g'\'' > $@; \
62 [ -s $@ ] || rm -f $@'
63
64-include $(SRC:%.c=$(DEPS)/%.d)