mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
Use a static pattern rule to restrict the dependency on [pluginname].o to single-file plugins. This allows the pattern rule for %.rock (with all dependencies defined elsewhere) to pick up multi-file plugins with no [pluginname].o file, and get rid of the duplication in (doom|midi|reversi).make.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20205 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
67c6f6048e
commit
f82c944912
4 changed files with 10 additions and 40 deletions
|
@ -34,18 +34,6 @@ else
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(DOOMBUILDDIR)/doom.rock: $(DOOM_OBJ)
|
$(DOOMBUILDDIR)/doom.rock: $(DOOM_OBJ)
|
||||||
# for some reason, this doesn't match the implicit rule in plugins.make,
|
|
||||||
# so we have to duplicate the link command here
|
|
||||||
$(call PRINTS,LD $(@F))
|
|
||||||
$(SILENT)$(CC) $(PLUGINFLAGS) -o $*.elf \
|
|
||||||
$(filter %.o, $^) \
|
|
||||||
$(filter %.a, $^) \
|
|
||||||
-lgcc $(PLUGINLDFLAGS)
|
|
||||||
ifdef SIMVER
|
|
||||||
$(SILENT)cp $*.elf $@
|
|
||||||
else
|
|
||||||
$(SILENT)$(OC) -O binary $*.elf $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
# new rule needed to use extra compile flags
|
# new rule needed to use extra compile flags
|
||||||
$(DOOMBUILDDIR)/%.o: $(DOOMSRCDIR)/%.c
|
$(DOOMBUILDDIR)/%.o: $(DOOMSRCDIR)/%.c
|
||||||
|
|
|
@ -21,18 +21,6 @@ OTHER_SRC += $(MIDI_SRC)
|
||||||
MIDICFLAGS = $(PLUGINFLAGS) -O2
|
MIDICFLAGS = $(PLUGINFLAGS) -O2
|
||||||
|
|
||||||
$(MIDIBUILDDIR)/midi.rock: $(MIDI_OBJ)
|
$(MIDIBUILDDIR)/midi.rock: $(MIDI_OBJ)
|
||||||
# for some reason, this doesn't match the implicit rule in plugins.make,
|
|
||||||
# so we have to duplicate the link command here
|
|
||||||
$(call PRINTS,LD $(@F))
|
|
||||||
$(SILENT)$(CC) $(PLUGINFLAGS) -o $*.elf \
|
|
||||||
$(filter %.o, $^) \
|
|
||||||
$(filter %.a, $^) \
|
|
||||||
-lgcc $(PLUGINLDFLAGS)
|
|
||||||
ifdef SIMVER
|
|
||||||
$(SILENT)cp $*.elf $@
|
|
||||||
else
|
|
||||||
$(SILENT)$(OC) -O binary $*.elf $@
|
|
||||||
endif
|
|
||||||
|
|
||||||
# new rule needed to use extra compile flags
|
# new rule needed to use extra compile flags
|
||||||
$(MIDIBUILDDIR)/%.o: $(MIDISRCDIR)/%.c
|
$(MIDIBUILDDIR)/%.o: $(MIDISRCDIR)/%.c
|
||||||
|
|
|
@ -10,8 +10,10 @@
|
||||||
# single-file plugins:
|
# single-file plugins:
|
||||||
PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES)
|
PLUGINS_SRC = $(call preprocess, $(APPSDIR)/plugins/SOURCES)
|
||||||
OTHER_SRC += $(PLUGINS_SRC)
|
OTHER_SRC += $(PLUGINS_SRC)
|
||||||
ROCKS := $(PLUGINS_SRC:.c=.rock)
|
ROCKS1 := $(PLUGINS_SRC:.c=.rock)
|
||||||
ROCKS := $(subst $(ROOTDIR),$(BUILDDIR),$(ROCKS))
|
ROCKS1 := $(subst $(ROOTDIR),$(BUILDDIR),$(ROCKS1))
|
||||||
|
|
||||||
|
ROCKS := $(ROCKS1)
|
||||||
|
|
||||||
# libplugin.a
|
# libplugin.a
|
||||||
PLUGINLIB := $(BUILDDIR)/apps/plugins/libplugin.a
|
PLUGINLIB := $(BUILDDIR)/apps/plugins/libplugin.a
|
||||||
|
@ -44,6 +46,10 @@ OTHER_INC += -I$(APPSDIR)/plugins -I$(APPSDIR)/plugins/lib
|
||||||
# special compile flags for plugins:
|
# special compile flags for plugins:
|
||||||
PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
|
PLUGINFLAGS = -I$(APPSDIR)/plugins -DPLUGIN $(CFLAGS)
|
||||||
|
|
||||||
|
# single-file plugins depend on their respective .o
|
||||||
|
$(ROCKS1): $(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
|
||||||
|
|
||||||
|
# dependency for all plugins
|
||||||
$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
|
$(ROCKS): $(APPSDIR)/plugin.h $(PLUGINLINK_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
|
||||||
|
|
||||||
$(PLUGINLIB): $(PLUGINLIB_OBJ)
|
$(PLUGINLIB): $(PLUGINLIB_OBJ)
|
||||||
|
@ -83,7 +89,7 @@ else
|
||||||
OVERLAYLDFLAGS = -T$(OVERLAYREF_LDS) -Wl,--gc-sections -Wl,-Map,$*.refmap
|
OVERLAYLDFLAGS = -T$(OVERLAYREF_LDS) -Wl,--gc-sections -Wl,-Map,$*.refmap
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(BUILDDIR)/%.rock: $(BUILDDIR)/%.o
|
$(BUILDDIR)/%.rock:
|
||||||
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
|
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o $(BUILDDIR)/$*.elf \
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
|
@ -94,7 +100,7 @@ else
|
||||||
$(SILENT)$(OC) -O binary $(BUILDDIR)/$*.elf $@
|
$(SILENT)$(OC) -O binary $(BUILDDIR)/$*.elf $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$(BUILDDIR)/%.refmap: $(BUILDDIR)/%.o $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
|
$(BUILDDIR)/%.refmap: $(APPSDIR)/plugin.h $(OVERLAYREF_LDS) $(PLUGINLIB) $(PLUGINBITMAPLIB)
|
||||||
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \
|
$(call PRINTS,LD $(@F))$(CC) $(PLUGINFLAGS) -o /dev/null \
|
||||||
$(filter %.o, $^) \
|
$(filter %.o, $^) \
|
||||||
$(filter %.a, $+) \
|
$(filter %.a, $+) \
|
||||||
|
|
|
@ -19,15 +19,3 @@ REVERSI_OBJ := $(call c2obj, $(REVERSI_SRC))
|
||||||
OTHER_SRC += $(REVERSI_SRC)
|
OTHER_SRC += $(REVERSI_SRC)
|
||||||
|
|
||||||
$(REVERSIBUILDDIR)/reversi.rock: $(REVERSI_OBJ)
|
$(REVERSIBUILDDIR)/reversi.rock: $(REVERSI_OBJ)
|
||||||
# for some reason, this doesn't match the implicit rule in plugins.make,
|
|
||||||
# so we have to duplicate the link command here
|
|
||||||
$(call PRINTS,LD $(@F))
|
|
||||||
$(SILENT)$(CC) $(PLUGINFLAGS) -o $*.elf \
|
|
||||||
$(filter %.o, $^) \
|
|
||||||
$(filter %.a, $^) \
|
|
||||||
-lgcc $(PLUGINLDFLAGS)
|
|
||||||
ifdef SIMVER
|
|
||||||
$(SILENT)cp $*.elf $@
|
|
||||||
else
|
|
||||||
$(SILENT)$(OC) -O binary $*.elf $@
|
|
||||||
endif
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue