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:
|
2011-02-24 23:35:16 +00:00
|
|
|
is_app_build =
|
|
|
|
ifdef APP_TYPE
|
|
|
|
ifneq ($(APP_TYPE),sdl-sim)
|
2014-08-30 11:15:53 +00:00
|
|
|
is_app_build = yes
|
|
|
|
endif
|
2011-02-24 23:35:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
ifdef is_app_build
|
|
|
|
PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES.app_build)
|
|
|
|
else
|
2008-11-20 11:27:31 +00:00
|
|
|
PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES)
|
2011-02-24 23:35:16 +00:00
|
|
|
endif
|
2008-11-20 11:27:31 +00:00
|
|
|
OTHER_SRC += $(PLUGINS_SRC)
|
2009-03-04 23:41:58 +00:00
|
|
|
ROCKS1 := $(PLUGINS_SRC:.c=.rock)
|
2019-07-28 16:44:23 +00:00
|
|
|
ROCKS1 := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(ROCKS1))
|
2009-03-04 23:41:58 +00:00
|
|
|
|
|
|
|
ROCKS := $(ROCKS1)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2009-10-28 22:48:22 +00:00
|
|
|
ROCKS1 := $(ROCKS1:%.lua=)
|
|
|
|
|
2008-11-20 11:27:31 +00:00
|
|
|
# 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)
|
2019-07-28 16:44:23 +00:00
|
|
|
PLUGINLIB_OBJ := $(call full_path_subst,$(ROOTDIR)/%,$(BUILDDIR)/%,$(PLUGINLIB_OBJ))
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
### build data / rules
|
2010-07-10 13:49:49 +00:00
|
|
|
ifndef APP_TYPE
|
2010-01-24 15:32:23 +00:00
|
|
|
CONFIGFILE := $(FIRMDIR)/export/config/$(MODELNAME).h
|
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
|
2010-10-17 11:40:39 +00:00
|
|
|
OTHER_SRC += $(ROOTDIR)/apps/plugins/plugin_crt0.c
|
2010-08-24 14:30:46 +00:00
|
|
|
PLUGIN_CRT0 := $(BUILDDIR)/apps/plugins/plugin_crt0.o
|
2009-03-02 00:16:44 +00:00
|
|
|
# multifile plugins (subdirs):
|
2011-02-24 23:35:16 +00:00
|
|
|
ifdef is_app_build
|
|
|
|
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS.app_build)
|
|
|
|
else
|
2009-03-02 00:16:44 +00:00
|
|
|
PLUGINSUBDIRS := $(call preprocess, $(APPSDIR)/plugins/SUBDIRS)
|
2011-02-24 23:35:16 +00:00
|
|
|
endif
|
2009-03-02 00:16:44 +00:00
|
|
|
|
2013-04-16 21:47:58 +00:00
|
|
|
PLUGIN_LIBS := $(PLUGINLIB) $(PLUGINBITMAPLIB) $(SETJMPLIB) $(FIXEDPOINTLIB)
|
2012-03-26 20:24:57 +00:00
|
|
|
|
2009-03-02 00:16:44 +00:00
|
|
|
# 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-04 23:41:58 +00:00
|
|
|
# single-file plugins depend on their respective .o
|
|
|
|
$(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
|
|
|
|
|
|
|
|
# dependency for all plugins
|
2012-03-26 20:24:57 +00:00
|
|
|
$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGIN_LIBS) $(PLUGIN_CRT0)
|
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
|
|
|
|
2010-01-24 15:32:23 +00:00
|
|
|
$(PLUGINLINK_LDS): $(PLUGIN_LDS) $(CONFIGFILE)
|
2008-11-20 11:27:31 +00:00
|
|
|
$(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)
|
|
|
|
|
2020-08-17 15:05:26 +00:00
|
|
|
$(BUILDDIR)/apps/plugins/open_plugins.opx:
|
|
|
|
$(call PRINTS,MK open_plugins.opx) touch $< $(BUILDDIR)/apps/plugins/open_plugins.opx
|
|
|
|
|
|
|
|
$(BUILDDIR)/apps/plugins/open_plugins.rock: $(BUILDDIR)/apps/plugins/open_plugins.opx
|
|
|
|
|
2008-11-20 11:27:31 +00:00
|
|
|
# special dependencies
|
2011-06-26 01:32:25 +00:00
|
|
|
$(BUILDDIR)/apps/plugins/wav2wv.rock: $(RBCODEC_BLD)/codecs/libwavpack.a $(PLUGIN_LIBS)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2011-09-07 19:21:57 +00:00
|
|
|
# Do not use '-ffunction-sections' and '-fdata-sections' when compiling sdl-sim
|
|
|
|
ifeq ($(findstring sdl-sim, $(APP_TYPE)), sdl-sim)
|
|
|
|
PLUGINLIBFLAGS = $(PLUGINFLAGS)
|
|
|
|
else
|
|
|
|
PLUGINLIBFLAGS = $(PLUGINFLAGS) -ffunction-sections -fdata-sections
|
|
|
|
endif
|
|
|
|
|
2021-11-13 01:50:20 +00:00
|
|
|
ROOT_PLUGINSLIB_DIR := $(ROOTDIR)/apps/plugins/lib
|
|
|
|
BUILD_PLUGINSLIB_DIR := $(BUILDDIR)/apps/plugins/lib
|
|
|
|
|
|
|
|
# action_helper #
|
|
|
|
ACTION_REQ := $(addprefix $(ROOT_PLUGINSLIB_DIR)/,action_helper.pl action_helper.h) \
|
|
|
|
$(BUILD_PLUGINSLIB_DIR)/pluginlib_actions.o
|
|
|
|
|
|
|
|
# special rule for generating and compiling action_helper
|
|
|
|
$(BUILD_PLUGINSLIB_DIR)/action_helper.o: $(ACTION_REQ)
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E -P \
|
|
|
|
$(ROOT_PLUGINSLIB_DIR)/pluginlib_actions.h - < /dev/null | $< > $(basename $@).c
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(ROOT_PLUGINSLIB_DIR) \
|
|
|
|
$(PLUGINLIBFLAGS) -c $(basename $@).c -o $@
|
|
|
|
|
|
|
|
# button_helper #
|
|
|
|
BUTTON_REQ := $(addprefix $(ROOT_PLUGINSLIB_DIR)/,button_helper.pl button_helper.h) \
|
|
|
|
$(BUILD_PLUGINSLIB_DIR)/action_helper.o
|
|
|
|
|
|
|
|
# special rule for generating and compiling button_helper
|
|
|
|
$(BUILD_PLUGINSLIB_DIR)/button_helper.o: $(BUTTON_REQ) $(ROOTDIR)/firmware/export/button.h
|
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -dM -E -P \
|
|
|
|
$(addprefix -include ,button-target.h button.h) - < /dev/null | $< > $(basename $@).c
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(ROOT_PLUGINSLIB_DIR) \
|
|
|
|
$(PLUGINLIBFLAGS) -c $(basename $@).c -o $@
|
|
|
|
|
2009-03-03 08:28:50 +00:00
|
|
|
# special pattern rule for compiling plugin lib (with function and data sections)
|
2021-11-13 01:50:20 +00:00
|
|
|
$(BUILD_PLUGINSLIB_DIR)/%.o: $(ROOT_PLUGINSLIB_DIR)/%.c
|
2008-11-20 11:27:31 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
2011-09-07 19:21:57 +00:00
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINLIBFLAGS) -c $< -o $@
|
2008-11-20 11:27:31 +00:00
|
|
|
|
|
|
|
# special pattern rule for compiling plugins with extra flags
|
2010-01-17 13:03:10 +00:00
|
|
|
$(BUILDDIR)/apps/plugins/%.o: $(ROOTDIR)/apps/plugins/%.c
|
2008-11-20 11:27:31 +00:00
|
|
|
$(SILENT)mkdir -p $(dir $@)
|
|
|
|
$(call PRINTS,CC $(subst $(ROOTDIR)/,,$<))$(CC) -I$(dir $<) $(PLUGINFLAGS) -c $< -o $@
|
|
|
|
|
2010-07-10 13:49:49 +00:00
|
|
|
ifdef APP_TYPE
|
2021-07-08 22:14:27 +00:00
|
|
|
PLUGINLDFLAGS = $(SHARED_LDFLAGS) -Wl,-Map,$*.map
|
2011-06-07 11:56:23 +00:00
|
|
|
PLUGINFLAGS += $(SHARED_CFLAGS) # <-- from Makefile
|
2008-11-20 11:27:31 +00:00
|
|
|
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
|
2010-07-03 20:58:22 +00:00
|
|
|
PLUGINLDFLAGS += $(GLOBAL_LDOPTS)
|
2008-11-20 11:27:31 +00:00
|
|
|
|
2010-08-24 14:30:46 +00:00
|
|
|
$(BUILDDIR)/%.rock:
|
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)
|
2012-04-04 19:43:22 +00:00
|
|
|
$(SILENT)$(call objcopy,$(BUILDDIR)/$*.elf,$@)
|
2009-03-02 00:16:44 +00:00
|
|
|
|
2009-10-28 22:48:22 +00:00
|
|
|
$(BUILDDIR)/apps/plugins/%.lua: $(ROOTDIR)/apps/plugins/%.lua
|
|
|
|
$(call PRINTS,CP $(subst $(ROOTDIR)/,,$<))cp $< $(BUILDDIR)/apps/plugins/
|
|
|
|
|
2012-03-26 21:41:38 +00:00
|
|
|
$(BUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(PLUGIN_LIBS) $(PLUGIN_CRT0)
|
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)
|