I split libg.a out into a sep target from libc.a for the main dir in
commit
f2b053f49ed2bd7b4da8cf4ed3a608dc2f425c2b ("newlib: separate out
libg from libc"), but missed the multilib dirs. That leads to an
uncommon parallel build failure:
- libc.a rule runs & finishes
- $(BUILD_MULTISUBDIR)/libc.a rule runs
-> failure due to libg.a not yet existing
- libg.a rule runs & finishes
Split the multilib libg rule out from libc too so it can depend on the
main libg directly and avoid this race.
ln $< $@ >/dev/null 2>/dev/null || cp $< $@
$(BUILD_MULTISUBDIR)/libc.a: libc.a $(BUILD_MULTISUBDIR)
- rm -f $@ $(BUILD_MULTISUBDIR)/libg.a
+ rm -f $@
+ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+
+$(BUILD_MULTISUBDIR)/libg.a: libg.a ${BUILD_MULTISUBDIR}
+ rm -f $@
ln $< $@ >/dev/null 2>/dev/null || cp $< $@
- ln libg.a $(BUILD_MULTISUBDIR)/libg.a >/dev/null 2>/dev/null || \
- cp libg.a $(BUILD_MULTISUBDIR)/libg.a
$(BUILD_MULTISUBDIR)/libm.a: libm.a $(BUILD_MULTISUBDIR)
rm -f $@
@HAVE_MULTISUBDIR_TRUE@ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
@HAVE_MULTISUBDIR_TRUE@$(BUILD_MULTISUBDIR)/libc.a: libc.a $(BUILD_MULTISUBDIR)
-@HAVE_MULTISUBDIR_TRUE@ rm -f $@ $(BUILD_MULTISUBDIR)/libg.a
+@HAVE_MULTISUBDIR_TRUE@ rm -f $@
+@HAVE_MULTISUBDIR_TRUE@ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
+
+@HAVE_MULTISUBDIR_TRUE@$(BUILD_MULTISUBDIR)/libg.a: libg.a ${BUILD_MULTISUBDIR}
+@HAVE_MULTISUBDIR_TRUE@ rm -f $@
@HAVE_MULTISUBDIR_TRUE@ ln $< $@ >/dev/null 2>/dev/null || cp $< $@
-@HAVE_MULTISUBDIR_TRUE@ ln libg.a $(BUILD_MULTISUBDIR)/libg.a >/dev/null 2>/dev/null || \
-@HAVE_MULTISUBDIR_TRUE@ cp libg.a $(BUILD_MULTISUBDIR)/libg.a
@HAVE_MULTISUBDIR_TRUE@$(BUILD_MULTISUBDIR)/libm.a: libm.a $(BUILD_MULTISUBDIR)
@HAVE_MULTISUBDIR_TRUE@ rm -f $@