diff options
Diffstat (limited to 'apps/plugins/lib')
-rw-r--r-- | apps/plugins/lib/Makefile | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/apps/plugins/lib/Makefile b/apps/plugins/lib/Makefile new file mode 100644 index 0000000000..3fbd812c23 --- /dev/null +++ b/apps/plugins/lib/Makefile | |||
@@ -0,0 +1,83 @@ | |||
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 | # ../.. for the plugin.h in the apps dir | ||
19 | # .. for stuff in the plugins dir | ||
20 | # . for stuff in the pluginlib dir | ||
21 | INCLUDES=-I../.. -I.. -I. -I$(FIRMWARE)/include -I$(FIRMWARE)/export \ | ||
22 | -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers | ||
23 | |||
24 | CFLAGS = -W -Wall -O -m1 -nostdlib -ffreestanding -Wstrict-prototypes \ | ||
25 | $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM} | ||
26 | |||
27 | ifndef MEM | ||
28 | # if MEM is not set, assume 2MB | ||
29 | MEM=2 | ||
30 | endif | ||
31 | |||
32 | ifdef DEBUG | ||
33 | CFLAGS += -g -DDEBUG | ||
34 | else | ||
35 | CFLAGS += -fomit-frame-pointer -fschedule-insns | ||
36 | endif | ||
37 | |||
38 | SRC := $(wildcard *.c) | ||
39 | |||
40 | OBJS := $(SRC:%.c=$(OBJDIR)/%.o) | ||
41 | DEPS:=.deps | ||
42 | DEPDIRS:=$(DEPS) | ||
43 | |||
44 | DIRS = $(subst $(DEPS),".",$(DEPDIRS)) | ||
45 | |||
46 | OUTPUT = $(OBJDIR)/libplugin.a | ||
47 | |||
48 | ifndef OBJDIR | ||
49 | no_configure: | ||
50 | @echo "Don't run make here. Run the tools/configure script from your own build" | ||
51 | @echo "directory, then run make there." | ||
52 | @echo | ||
53 | @echo "More help on how to build rockbox can be found here:" | ||
54 | @echo "http://rockbox.haxx.se/docs/how_to_compile.html" | ||
55 | endif | ||
56 | |||
57 | all: $(OUTPUT) | ||
58 | |||
59 | $(OUTPUT): $(OBJS) | ||
60 | $(AR) ruv $@ $+ | ||
61 | |||
62 | $(OBJDIR)/%.o: %.c | ||
63 | @mkdir -p `dirname $@` | ||
64 | $(CC) $(CFLAGS) -c $< -o $@ | ||
65 | |||
66 | tags: | ||
67 | @$(SHELL) -c 'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done' | ||
68 | |||
69 | clean: | ||
70 | rm -f $(OBJS) $(OUTPUT) | ||
71 | rm -rf $(OBJDIR)/$(DEPS) | ||
72 | |||
73 | $(OBJDIR)/$(DEPS)/%.d: %.c | ||
74 | @$(SHELL) -c 'for d in $(DEPDIRS); do { if [ ! -d $(OBJDIR)/$$d ]; then mkdir $(OBJDIR)/$$d; fi; }; done' | ||
75 | @echo "Updating dependencies for $<" | ||
76 | $(SHELL) -ec '$(CC) -MM $(CFLAGS) $< \ | ||
77 | |sed '\''s|\($*\)\.o[ :]*|$(OBJDIR)/\1.o $(<:%.c=%.d) : |g'\'' > $@; \ | ||
78 | [ -s $@ ] || rm -f $@' | ||
79 | |||
80 | ifdef OBJDIR | ||
81 | -include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d) | ||
82 | endif | ||
83 | |||