summaryrefslogtreecommitdiff
path: root/apps/plugins/plugins.make
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2008-11-20 11:27:31 +0000
committerBjörn Stenberg <bjorn@haxx.se>2008-11-20 11:27:31 +0000
commitc6b3d38a156dd624760a8eb1bb374affd43b4f2a (patch)
tree493eba929e2396d86cf4f077709aa09fe172cd35 /apps/plugins/plugins.make
parentf66c30346783a400a029bedcd60ab67c81c34a07 (diff)
downloadrockbox-c6b3d38a156dd624760a8eb1bb374affd43b4f2a.tar.gz
rockbox-c6b3d38a156dd624760a8eb1bb374affd43b4f2a.zip
New makefile solution: A single invocation of 'make' to build the entire tree. Fully controlled dependencies give faster and more correct recompiles.
Many #include lines adjusted to conform to the new standards. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19146 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/plugins.make')
-rw-r--r--apps/plugins/plugins.make76
1 files changed, 76 insertions, 0 deletions
diff --git a/apps/plugins/plugins.make b/apps/plugins/plugins.make
new file mode 100644
index 0000000000..2e266cb190
--- /dev/null
+++ b/apps/plugins/plugins.make
@@ -0,0 +1,76 @@
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id: Makefile 19082 2008-11-10 23:54:24Z zagor $
8#
9
10# single-file plugins:
11PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES)
12OTHER_SRC += $(PLUGINS_SRC)
13ROCKS := $(PLUGINS_SRC:.c=.rock)
14ROCKS := $(subst $(ROOTDIR),$(BUILDDIR),$(ROCKS))
15
16# libplugin.a
17PLUGINLIB := $(BUILDDIR)/apps/plugins/libplugin.a
18PLUGINLIB_SRC = $(call preprocess, $(APPSDIR)/plugins/lib/SOURCES)
19OTHER_SRC += $(PLUGINLIB_SRC)
20
21PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o)
22PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o)
23PLUGINLIB_OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(PLUGINLIB_OBJ))
24
25# multifile plugins (subdirs):
26PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
27
28# include <dir>.make from each subdir (yay!)
29$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
30
31### build data / rules
32PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds
33PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
34
35OTHER_INC += -I$(APPSDIR)/plugins
36
37# special compile flags for plugins:
38PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
39
40$(ROCKS): $(PLUGINLIB) $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINBITMAPLIB)
41
42$(PLUGINLIB): $(PLUGINLIB_OBJ)
43 $(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
44
45$(PLUGINLINK_LDS): $(PLUGIN_LDS)
46 $(call PRINTS,PP $(@F))
47 $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
48
49$(BUILDDIR)/credits.raw credits.raw: $(DOCSDIR)/CREDITS
50 $(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F)
51
52# special dependencies
53$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a
54
55# special pattern rule for compiling plugin lib (with -ffunction-sections)
56$(BUILDDIR)/apps/plugins/lib/%.o: $(ROOTDIR)/apps/plugins/lib/%.c
57 $(SILENT)mkdir -p $(dir $@)
58 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -ffunction-sections -c $< -o $@
59
60# special pattern rule for compiling plugins with extra flags
61$(BUILDDIR)/apps/plugins/%.o: $(ROOTDIR)/apps/plugins/%.c $(PLUGINBITMAPLIB)
62 $(SILENT)mkdir -p $(dir $@)
63 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -c $< -o $@
64
65ifdef SIMVER
66 PLUGINLDFLAGS = $(SHARED_FLAG) # <-- from Makefile
67else
68 PLUGINLDFLAGS = -T$(PLUGINLINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map
69endif
70
71$(BUILDDIR)/%.rock: $(BUILDDIR)/%.o $(PLUGINLINK_LDS)
72 $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
73 $(filter %.o, $^) \
74 $(filter %.a, $^) \
75 -lgcc $(PLUGINLDFLAGS)
76 $(SILENT)$(OC) -O binary $(BUILDDIR)/$*.elf $@