diff --git a/mk/host.mk b/mk/host.mk index a92d10faf4b..f2ae5c6e647 100644 --- a/mk/host.mk +++ b/mk/host.mk @@ -45,8 +45,15 @@ $$(HLIB$(2)_H_$(4))/$$(CFG_CORELIB): \ $$(HLIB$(2)_H_$(4))/$$(CFG_RUNTIME) @$$(call E, cp: $$@) $$(Q)cp $$< $$@ +# Subtle: We do not let the shell expand $(CORELIB_DSYM_GLOB) directly rather +# we use Make's $$(wildcard) facility. The reason is that, on mac, when using +# USE_SNAPSHOT_CORELIB, we copy the core.dylib file out of the snapshot. +# In that case, there is no .dSYM file. Annoyingly, bash then refuses to expand +# glob, and cp reports an error because libcore-*.dylib.dsym does not exist. +# Make instead expands the glob to nothing, which gives us the correct behavior. +# (Copy .dsym file if it exists, but do nothing otherwise) $$(Q)cp -R $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_GLOB) \ - $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_DSYM_GLOB) \ + $$(wildcard $$(TLIB$(1)_T_$(4)_H_$(3))/$(CORELIB_DSYM_GLOB)) \ $$(HLIB$(2)_H_$(4)) $$(HLIB$(2)_H_$(4))/$$(CFG_STDLIB): \