summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/lib/Makefile83
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
10CC = sh-elf-gcc
11LD = sh-elf-ld
12AR = sh-elf-ar
13AS = sh-elf-as
14OC = sh-elf-objcopy
15
16FIRMWARE = ../../../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
21INCLUDES=-I../.. -I.. -I. -I$(FIRMWARE)/include -I$(FIRMWARE)/export \
22 -I$(FIRMWARE)/common -I$(FIRMWARE)/drivers
23
24CFLAGS = -W -Wall -O -m1 -nostdlib -ffreestanding -Wstrict-prototypes \
25$(INCLUDES) $(TARGET) $(EXTRA_DEFINES) -DMEM=${MEM}
26
27ifndef MEM
28 # if MEM is not set, assume 2MB
29 MEM=2
30endif
31
32ifdef DEBUG
33CFLAGS += -g -DDEBUG
34else
35CFLAGS += -fomit-frame-pointer -fschedule-insns
36endif
37
38SRC := $(wildcard *.c)
39
40OBJS := $(SRC:%.c=$(OBJDIR)/%.o)
41DEPS:=.deps
42DEPDIRS:=$(DEPS)
43
44DIRS = $(subst $(DEPS),".",$(DEPDIRS))
45
46OUTPUT = $(OBJDIR)/libplugin.a
47
48ifndef OBJDIR
49no_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"
55endif
56
57all: $(OUTPUT)
58
59$(OUTPUT): $(OBJS)
60 $(AR) ruv $@ $+
61
62$(OBJDIR)/%.o: %.c
63 @mkdir -p `dirname $@`
64 $(CC) $(CFLAGS) -c $< -o $@
65
66tags:
67 @$(SHELL) -c 'for d in $(DIRS); do { etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; }; done'
68
69clean:
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
80ifdef OBJDIR
81 -include $(SRC:%.c=$(OBJDIR)/$(DEPS)/%.d)
82endif
83