uVisor: Fix 'publish' and core libs dependencies

The 'TARGET_M%' rules depend on files generated by the 'rsync' target,
so make this dependency explicit by setting 'rsync' as a pre-requisite
of 'TARGET_M%'. The 'rsync' dependency was removed from 'publish' to
avoid the case where make would select one of the 'TARGET' rules before
completing 'rsync', which would cause the build to fail.

Additionally, also moved the core libs selection in the 'TARGET_M%'
pattern rule from the pre-requisites into the rule's recipe. This is
required because when the wildcard expression used before as a
pre-requisite is expanded (make's 1st phase), it won't find any files
(not built yet via 'rsync' target), so it won't create the associated
'TARGET_M%' rules, finally causing the 'publish' target building to fail
due to missing rules for 'TARGET_M3' and 'TARGET_M4'.

With this change and the previous one, it is ensured that 'rsync' is
done before executing the recipe for 'TARGET_M%', so the required core
libs are already available and can be used from withing the recipe. The
same wildcard pattern is used as before.

The issues being fixed are visible with GNU Make 4.2.1, but not seen
with GNU Make 3.81.

Fixes issue #3905.
pull/3906/head
Ricardo Silva 2017-03-08 00:49:53 +00:00
parent b2726470f6
commit 5b059821d4
1 changed files with 5 additions and 4 deletions

View File

@ -89,12 +89,13 @@ rsync:
# Copying licenses
cp $(UVISOR_DIR)/LICENSE* $(TARGET_SUPPORTED)
TARGET_M%: $(TARGET_SUPPORTED)/*/*/*_cortex_m%*.a
TARGET_M%: TARGET_LIBS_FIND=$(wildcard $(TARGET_SUPPORTED)/*/*/*_cortex_m$(subst TARGET_M,,$@)*.a)
TARGET_M%: rsync
@printf "#\n# Copying $@ files...\n"
mkdir $(foreach file,$^,$(dir $(file))$@)
$(foreach file,$^,mv $(file) $(dir $(file))$@/lib$(notdir $(file));)
mkdir $(foreach file,$(TARGET_LIBS_FIND),$(dir $(file))$@)
$(foreach file,$(TARGET_LIBS_FIND),mv $(file) $(dir $(file))$@/lib$(notdir $(file));)
publish: rsync TARGET_M3 TARGET_M4
publish: TARGET_M3 TARGET_M4
#
# Rename release directorires to TARGET_RELEASE filters...
$(foreach dir, $(TARGET_LIST_RELEASE),mv $(dir) $(dir $(dir))TARGET_RELEASE;)