diff options
Diffstat (limited to 'apps/Makefile')
-rw-r--r-- | apps/Makefile | 64 |
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 | |||
10 | CC = sh-elf-gcc | ||
11 | LD = sh-elf-ld | ||
12 | AR = sh-elf-ar | ||
13 | AS = sh-elf-as | ||
14 | OC = sh-elf-objcopy | ||
15 | |||
16 | FIRMWARE := ../firmware | ||
17 | |||
18 | INCLUDES= -I$(FIRMWARE) -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers | ||
19 | |||
20 | # Pick a target to build for | ||
21 | TARGET = -DARCHOS_PLAYER=1 | ||
22 | #TARGET = -DARCHOS_PLAYER_OLD=1 | ||
23 | #TARGET = -DARCHOS_RECORDER=1 | ||
24 | |||
25 | CFLAGS = -Os -W -Wall -m1 -nostdlib -Wstrict-prototypes -fomit-frame-pointer -fschedule-insns $(INCLUDES) $(TARGET) -DDEBUG | ||
26 | AFLAGS += -small -relax | ||
27 | |||
28 | SRC := $(wildcard drivers/*.c common/*.c *.c) | ||
29 | OBJS := $(SRC:%.c=%.o) crt0.o | ||
30 | |||
31 | all : archos.mod # archos.asm | ||
32 | |||
33 | archos.elf : $(OBJS) $(FIRMWARE)/app.lds | ||
34 | $(CC) -nostdlib -o archos.elf $(OBJS) -lgcc -lc -T$(FIRMWARE)/app.lds -Wl,-Map,archos.map | ||
35 | |||
36 | archos.bin : archos.elf | ||
37 | $(OC) -O binary archos.elf archos.bin | ||
38 | |||
39 | archos.asm: archos.bin | ||
40 | ../tools/sh2d -sh1 archos.bin > archos.asm | ||
41 | |||
42 | archos.mod : archos.bin | ||
43 | ../tools/scramble archos.bin archos.mod | ||
44 | |||
45 | dist: | ||
46 | tar czvf dist.tar.gz Makefile main.c start.s app.lds | ||
47 | |||
48 | clean: | ||
49 | -rm -f *.x *.i *.o *.elf *.bin *.map *.mod *.bak *~ | ||
50 | -$(RM) -r $(DEPS) | ||
51 | |||
52 | crt0.o: $(FIRMWARE)/crt0.S | ||
53 | |||
54 | DEPS:=.deps | ||
55 | DEPDIRS:=$(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) | ||