On 7 April 2014 16:30, Markus Armbruster <arm...@redhat.com> wrote:
> Peter Maydell <peter.mayd...@linaro.org> writes:
>
>> On 5 April 2014 15:25, Michael Tokarev <m...@tls.msk.ru> wrote:
>>>  ifneq ($(CONFIG_MODULES),)
>>>         $(INSTALL_DIR) "$(DESTDIR)$(qemu_moddir)"
>>>         for s in $(patsubst %.mo,%$(DSOSUF),$(modules-m)); do \
>>> -               $(INSTALL_PROG) $(STRIP_OPT) $$s 
>>> "$(DESTDIR)$(qemu_moddir)/$${s//\//-}"; \
>>> +               $(INSTALL_PROG) $(STRIP_OPT) $$s 
>>> "$(DESTDIR)$(qemu_moddir)/$$(echo $$s | tr / -)"; \
>>>         done
>>>  endif
>>>  ifneq ($(HELPERS-y),)
>>
>> Reviewed-by: Peter Maydell <peter.mayd...@linaro.org>
>>
>> Paolo, Fam: does this patch look ok to you? I propose
>> to apply it for 2.0...
>
> I don't understand the quoting in the old version offhand (leaning
> toothpick syndrome)

Yeah, it took me a while to figure out too, but:
  $${s//\//-}
$$ is quoting a '$' for Make, so the shell sees:
  ${s//\//-}
and the bash syntax for this substitution is:
  ${parameter/pattern/string}
where if 'pattern' starts with a '/' it means 'replace
all matches', like sed's 'g' modifier
So we have:
  parameter: s
  pattern: /\/
  string: -
and the pattern is the 'global replace' modifier
plus an escaped forward slash. So it's $s (the shell
variable) with all the forward slashes converted to hyphens.

thanks
-- PMM

Reply via email to