Fix typo in german translation.
[maemo-rb.git] / apps / plugins / plugins.make
blob12344ae59084cce123747ad0d8160937d7b73f47
1 # __________ __ ___.
2 # Open \______ \ ____ ____ | | _\_ |__ _______ ___
3 # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4 # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5 # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6 # \/ \/ \/ \/ \/
7 # $Id$
10 # single-file plugins:
11 is_app_build =
12 ifdef APP_TYPE
13 ifneq ($(APP_TYPE),sdl-sim)
14 is_app_build = yes
15 endif
16 endif
18 ifdef is_app_build
19 PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES.app_build)
20 else
21 PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES)
22 endif
23 OTHER_SRC += $(PLUGINS_SRC)
24 ROCKS1 := $(PLUGINS_SRC:.c=.rock)
25 ROCKS1 := $(subst $(ROOTDIR),$(BUILDDIR),$(ROCKS1))
27 ROCKS := $(ROCKS1)
29 ROCKS1 := $(ROCKS1:%.lua=)
31 # libplugin.a
32 PLUGINLIB := $(BUILDDIR)/apps/plugins/libplugin.a
33 PLUGINLIB_SRC = $(call preprocess, $(APPSDIR)/plugins/lib/SOURCES)
34 OTHER_SRC += $(PLUGINLIB_SRC)
36 PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o)
37 PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o)
38 PLUGINLIB_OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(PLUGINLIB_OBJ))
40 ### build data / rules
41 ifndef APP_TYPE
42 CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h
43 PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds
44 PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
45 OVERLAYREF_LDS := $(BUILDDIR)/apps/plugins/overlay_ref.link
46 endif
47 OTHER_SRC += $(ROOTDIR)/apps/plugins/plugin_crt0.c
48 PLUGIN_CRT0 := $(BUILDDIR)/apps/plugins/plugin_crt0.o
49 # multifile plugins (subdirs):
50 ifdef is_app_build
51 PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS.app_build)
52 else
53 PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
54 endif
56 PLUGIN_LIBS := $(EXTRA_LIBS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
58 # include <dir>.make from each subdir (yay!)
59 $(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
61 OTHER_INC += -I$(APPSDIR)/plugins -I$(APPSDIR)/plugins/lib
63 # special compile flags for plugins:
64 PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
66 # single-file plugins depend on their respective .o
67 $(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
69 # dependency for all plugins
70 $(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS) $(PLUGIN_CRT0)
72 $(PLUGINLIB): $(PLUGINLIB_OBJ)
73 $(SILENT)$(shell rm -f $@)
74 $(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
76 $(PLUGINLINK_LDS): $(PLUGIN_LDS) $(CONFIGFILE)
77 $(call PRINTS,PP $(@F))
78 $(shell mkdir -p $(dir $@))
79 $(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
81 $(OVERLAYREF_LDS): $(PLUGIN_LDS)
82 $(call PRINTS,PP $(@F))
83 $(shell mkdir -p $(dir $@))
84 $(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=0)
86 $(BUILDDIR)/credits.raw credits.raw: $(DOCSDIR)/CREDITS
87 $(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F)
89 # special dependencies
90 $(BUILDDIR)/apps/plugins/wav2wv.rock: $(RBCODEC_BLD)/codecs/libwavpack.a $(PLUGIN_LIBS)
92 # Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim
93 ifeq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
94 PLUGINLIBFLAGS = $(PLUGINFLAGS)
95 else
96 PLUGINLIBFLAGS = $(PLUGINFLAGS) -ffunction-sections -fdata-sections
97 endif
99 # special pattern rule for compiling plugin lib (with function and data sections)
100 $(BUILDDIR)/apps/plugins/lib/%.o: $(ROOTDIR)/apps/plugins/lib/%.c
101 $(SILENT)mkdir -p $(dir $@)
102 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINLIBFLAGS) -c $< -o $@
104 # special pattern rule for compiling plugins with extra flags
105 $(BUILDDIR)/apps/plugins/%.o: $(ROOTDIR)/apps/plugins/%.c
106 $(SILENT)mkdir -p $(dir $@)
107 $(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -c $< -o $@
109 ifdef APP_TYPE
110 PLUGINLDFLAGS = $(SHARED_LDFLAG) -Wl,-Map,$*.map
111 PLUGINFLAGS += $(SHARED_CFLAGS) # <-- from Makefile
112 else
113 PLUGINLDFLAGS = -T$(PLUGINLINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map
114 OVERLAYLDFLAGS = -T$(OVERLAYREF_LDS) -Wl,--gc-sections -Wl,-Map,$*.refmap
115 endif
116 PLUGINLDFLAGS += $(GLOBAL_LDOPTS)
118 $(BUILDDIR)/%.rock:
119 $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
120 $(filter %.o, $^) \
121 $(filter %.a, $+) \
122 -lgcc $(PLUGINLDFLAGS)
123 $(SILENT)$(call objcopy,$(BUILDDIR)/$*.elf,$@)
125 $(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua
126 $(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/plugins/
128 $(BUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(PLUGIN_LIBS) $(PLUGIN_CRT0)
129 $(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \
130 $(filter %.o, $^) \
131 $(filter %.a, $+) \
132 -lgcc $(OVERLAYLDFLAGS)