2008-11-20 11:27:31 +00:00
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
2008-11-25 19:54:23 +00:00
|
|
|
# $Id$
|
2008-11-20 11:27:31 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# single-file plugins:
|
|
|
|
PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES)
|
|
|
|
OTHER_SRC += $(PLUGINS_SRC)
|
|
|
|
ROCKS := $(PLUGINS_SRC:.c=.rock)
|
|
|
|
ROCKS := $(subst $(ROOTDIR),$(BUILDDIR),$(ROCKS))
|
|
|
|
|
|
|
|
# libplugin.a
|
|
|
|
PLUGINLIB := $(BUILDDIR)/apps/plugins/libplugin.a
|
|
|
|
PLUGINLIB_SRC = $(call preprocess, $(APPSDIR)/plugins/lib/SOURCES)
|
|
|
|
OTHER_SRC += $(PLUGINLIB_SRC)
|
|
|
|
|
|
|
|
PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o)
|
|
|
|
PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o)
|
|
|
|
PLUGINLIB_OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(PLUGINLIB_OBJ))
|
|
|
|
|
|
|
|
# multifile plugins (subdirs):
|
|
|
|
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
|
|
|
|
|
|
|
|
# include <dir>.make from each subdir (yay!)
|
|
|
|
$(foreach dir,$(PLUGINSUBDIRS),$(eval include $(dir)/$(notdir $(dir)).make))
|
|
|
|
|
|
|
|
### build data / rules
|
|
|
|
PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds
|
|
|
|
PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
|
|
|
|
|
|
|
|
OTHER_INC += -I$(APPSDIR)/plugins
|
|
|
|
|
|
|
|
# special compile flags for plugins:
|
|
|
|
PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
|
|
|
|
|
|
|
|
$(ROCKS): $(PLUGINLIB) $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINBITMAPLIB)
|
|
|
|
|
|
|
|
$(PLUGINLIB): $(PLUGINLIB_OBJ)
|
2008-11-20 16:49:55 +00:00
|
|
|
$(SILENT)$(shell rm -f $@)
|
2008-11-20 11:27:31 +00:00
|
|
|
$(call PRINTS,AR $(@F))$(AR) rs $@ $^ >/dev/null 2>&1
|
|
|
|
|
|
|
|
$(PLUGINLINK_LDS): $(PLUGIN_LDS)
|
|
|
|
$(call PRINTS,PP $(@F))
|
2008-11-20 16:07:01 +00:00
|
|
|
$(shell mkdir -p $(dir $@))
|
2008-11-20 11:27:31 +00:00
|
|
|
$(call preprocess2file,$<,$@,-DLOADADDRESS=$(LOADADDRESS))
|
|
|
|
|
|
|
|
$(BUILDDIR)/credits.raw credits.raw: $(DOCSDIR)/CREDITS
|
|
|
|
$(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F)
|
|
|
|
|
|
|
|
# special dependencies
|
|
|
|
$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a
|
|
|
|
|
|
|
|
# special pattern rule for compiling plugin lib (with -ffunction-sections)
|
|
|
|
$(BUILDDIR)/apps/plugins/lib/%.o: $(ROOTDIR)/apps/plugins/lib/%.c
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -ffunction-sections -c $< -o $@
|
|
|
|
|
|
|
|
# special pattern rule for compiling plugins with extra flags
|
|
|
|
$(BUILDDIR)/apps/plugins/%.o: $(ROOTDIR)/apps/plugins/%.c $(PLUGINBITMAPLIB)
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
ifdef SIMVER
|
|
|
|
PLUGINLDFLAGS = $(SHARED_FLAG) # <-- from Makefile
|
|
|
|
else
|
|
|
|
PLUGINLDFLAGS = -T$(PLUGINLINK_LDS) -Wl,--gc-sections -Wl,-Map,$*.map
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(BUILDDIR)/%.rock: $(BUILDDIR)/%.o $(PLUGINLINK_LDS)
|
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
|
|
|
|
$(filter %.o, $^) \
|
|
|
|
$(filter %.a, $^) \
|
|
|
|
-lgcc $(PLUGINLDFLAGS)
|
2008-11-20 12:09:36 +00:00
|
|
|
ifdef SIMVER
|
2008-11-20 12:44:49 +00:00
|
|
|
$(SILENT)cp $(BUILDDIR)/$*.elf $@
|
2008-11-20 12:09:36 +00:00
|
|
|
else
|
2008-11-20 11:27:31 +00:00
|
|
|
$(SILENT)$(OC) -O binary $(BUILDDIR)/$*.elf $@
|
2008-11-20 12:09:36 +00:00
|
|
|
endif
|