Added "check that the bug isnt already fixed".
[kugel-rb.git] / firmware / Makefile
blob38bcd4cc86708858c50992c36be8ee634c0da02a
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
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
16 INCLUDES=-Iinclude -I. -Iexport -Icommon -Idrivers
18 CFLAGS = -W -Wall -O -m1 -nostdlib -ffreestanding -Wstrict-prototypes $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM}
20 ifndef MEM
21 # if MEM is not set, assume 2MB
22 MEM=2
23 endif
25 ifdef DEBUG
26 CFLAGS += -g -DDEBUG
27 else
28 CFLAGS += -fomit-frame-pointer -fschedule-insns
29 endif
31 SRC := $(wildcard drivers/*.c common/*.c *.c)
32 SRC_S := $(wildcard drivers/*.S common/*.S *.S)
34 OBJS := $(SRC:%.c=$(OBJDIR)/%.o) $(SRC_S:%.S=$(OBJDIR)/%.o)
35 DEPS:=.deps
36 DEPDIRS:=$(DEPS) $(DEPS)/drivers $(DEPS)/common $(DEPS)/malloc
38 DIRS = $(subst $(DEPS),".",$(DEPDIRS))
40 OUTPUT = $(OBJDIR)/librockbox.a
42 ifeq (RECORDER,$(findstring RECORDER, $(CFLAGS)))
43 OBJS += $(OBJDIR)/sysfont.o
44 endif
46 ifndef OBJDIR
47 no_configure:
48 @echo "Don't run make here. Run the tools/configure script from your own build"
49 @echo "directory, then run make there."
50 @echo
51 @echo "More help on how to build rockbox can be found here:"
52 @echo "http://rockbox.haxx.se/docs/how_to_compile.html"
53 endif
55 ifndef TOOLSDIR
56 TOOLSDIR=../tools
57 endif
59 all: $(TOOLSDIR)/convbdf $(OUTPUT) $(EXTRA_TARGETS)
61 $(TOOLSDIR)/convbdf:
62 $(MAKE) -C $(TOOLSDIR)
64 $(OUTPUT): $(OBJS)
65 $(AR) ruv $@ $+
67 $(OBJDIR)/%.o: %.c
68 @mkdir -p `dirname $@`
69 $(CC) $(CFLAGS) -c $< -o $@
71 $(OBJDIR)/%.o: %.S
72 @mkdir -p `dirname $@`
73 $(CC) $(CFLAGS) -c $< -o $@
75 tags:
76 @$(SHELL) -c 'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'
78 clean:
79 rm -f $(OBJS) $(OUTPUT) $(OBJDIR)/sysfont.c
80 rm -rf $(OBJDIR)/$(DEPS)
82 # Special targets
83 $(OBJDIR)/thread.o: thread.c export/thread.h
84 $(CC) -c -O -fomit-frame-pointer $(CFLAGS) $< -o $@
86 $(OBJDIR)/sysfont.o: fonts/clR6x8.bdf
87 $(TOOLSDIR)/convbdf -c -o $(OBJDIR)/sysfont.c $<
88 $(CC) $(CFLAGS) -c $(OBJDIR)/sysfont.c -o $@
90 $(OBJDIR)/$(DEPS)/%.d: %.c
91 @$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $(OBJDIR)/$$d ]; then mkdir $(OBJDIR)/$$d; fi; }; done'
92 @echo "Updating dependencies for $<"
93 @$(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \
94 |sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \
95 [ -s $@ ] || rm -f $@'
97 ifdef OBJDIR
98 -include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
99 endif