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)
|
2009-01-24 03:47:09 +00:00
|
|
|
# include gcc-support routines for linking first if in SOURCES
|
|
|
|
ifneq "$(findstring gcc-support.c,$(PLUGINLIB_SRC))" ""
|
|
|
|
GCCSUPPORT_OBJ := $(BUILDDIR)/apps/plugins/lib/gcc-support.o
|
|
|
|
endif
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
PLUGINLIB_OBJ := $(PLUGINLIB_SRC:.c=.o)
|
|
|
|
PLUGINLIB_OBJ := $(PLUGINLIB_OBJ:.S=.o)
|
|
|
|
PLUGINLIB_OBJ := $(subst $(ROOTDIR),$(BUILDDIR),$(PLUGINLIB_OBJ))
|
|
|
|
|
|
|
|
### build data / rules
|
2009-02-09 18:31:56 +00:00
|
|
|
ifndef SIMVER
|
2008-11-20 11:27:31 +00:00
|
|
|
PLUGIN_LDS := $(APPSDIR)/plugins/plugin.lds
|
|
|
|
PLUGINLINK_LDS := $(BUILDDIR)/apps/plugins/plugin.link
|
2009-03-02 00:16:44 +00:00
|
|
|
OVERLAYREF_LDS := $(BUILDDIR)/apps/plugins/overlay_ref.link
|
2009-02-09 18:31:56 +00:00
|
|
|
endif
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2009-03-02 00:16:44 +00:00
|
|
|
# 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))
|
|
|
|
|
2009-01-12 21:56:46 +00:00
|
|
|
OTHER_INC += -I$(APPSDIR)/plugins -I$(APPSDIR)/plugins/lib
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
# special compile flags for plugins:
|
2009-03-02 00:16:44 +00:00
|
|
|
PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2009-03-02 00:16:44 +00:00
|
|
|
$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
$(PLUGINLIB): $(PLUGINLIB_OBJ)
|
2008-11-20 16:49:55 +00:00
|
|
|
$(SILENT)$(shell rm -f $@)
|
2009-03-01 09:04:15 +00:00
|
|
|
$(call PRINTS,AR $(@F))$(AR) rcs $@ $^ >/dev/null
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
$(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))
|
|
|
|
|
2009-03-02 00:16:44 +00:00
|
|
|
$(OVERLAYREF_LDS): $(PLUGIN_LDS)
|
|
|
|
$(call PRINTS,PP $(@F))
|
|
|
|
$(shell mkdir -p $(dir $@))
|
|
|
|
$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=0)
|
|
|
|
|
2008-11-20 11:27:31 +00:00
|
|
|
$(BUILDDIR)/credits.raw credits.raw: $(DOCSDIR)/CREDITS
|
|
|
|
$(call PRINTS,Create credits.raw)perl $(APPSDIR)/plugins/credits.pl < $< > $(BUILDDIR)/$(@F)
|
|
|
|
|
|
|
|
# special dependencies
|
2009-03-02 00:16:44 +00:00
|
|
|
$(BUILDDIR)/apps/plugins/wav2wv.rock: $(BUILDDIR)/apps/codecs/libwavpack.a $(PLUGINLIB)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2009-03-03 08:28:50 +00:00
|
|
|
# special pattern rule for compiling plugin lib (with function and data sections)
|
2008-11-20 11:27:31 +00:00
|
|
|
$(BUILDDIR)/apps/plugins/lib/%.o: $(ROOTDIR)/apps/plugins/lib/%.c
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
2009-03-03 08:28:50 +00:00
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -ffunction-sections -fdata-sections -c $< -o $@
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
# 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
|
2009-03-02 00:16:44 +00:00
|
|
|
OVERLAYLDFLAGS = -T$(OVERLAYREF_LDS) -Wl,--gc-sections -Wl,-Map,$*.refmap
|
2008-11-20 11:27:31 +00:00
|
|
|
endif
|
|
|
|
|
2009-03-02 00:16:44 +00:00
|
|
|
$(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
|
2008-11-20 11:27:31 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
|
|
|
|
$(filter %.o, $^) \
|
2009-03-02 00:16:44 +00:00
|
|
|
$(filter %.a, $+) \
|
2008-11-20 11:27:31 +00:00
|
|
|
-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 $@
|
2009-03-02 00:16:44 +00:00
|
|
|
endif
|
|
|
|
|
2009-03-02 08:16:36 +00:00
|
|
|
$(BUILDDIR)/%.refmap: $(BUILDDIR)/%.o $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
|
2009-03-02 00:16:44 +00:00
|
|
|
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \
|
|
|
|
$(filter %.o, $^) \
|
2009-03-02 08:16:36 +00:00
|
|
|
$(filter %.a, $+) \
|
2009-03-02 00:16:44 +00:00
|
|
|
-lgcc $(OVERLAYLDFLAGS)
|