On Fri, 2020-04-24 at 12:15 +0800, Glen Huang wrote: > remote-bin-host%: bin > scp $< host$*:$< > touch $@ > > to update files in remote hosts. > > It works for remote-bin-host1, remote-bin-host2, etc, but not remote- > bin-host. It seems % won’t match empty string.
Another option is to match one extra character: remote-bin-hos%: bin ... Of course this also matches targets like remote-bin-hosX etc. If you can't live with that then your only option is to declare both rules and either duplicate the recipe or put the recipe in a variable and use that in both rules, as Philip mentioned.