tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: make variable expansion oddity



Am 27.05.2016 um 21:35 schrieb Edgar Fuß:
> Is there a variant of the SUBST framework that converts foo.in to foo instead 
> of working on foo?

No, there isn't. Currently, you would have to emulate in your own code
what subst.mk does.

Given that it were implemented, how would you like to use this feature,
using the following example?

SUBST_CLASSES+=    in
SUBST_STAGE.in=    pre-configure
SUBST_FILES.in=    *.in
SUBST_VARS.in=     PREFIX docdir

I could think of these possibilities:

1. SUBST_RENAME.in= s,.in$$,,

This would cover all situations that can be expresses with sed(1)
regular expressions. Expressing the renaming in this way has prior art
in pax(1), where it is used to rename or exclude files.

2. SUBST_RENAME.in= $${file%.in}

This would expose the implementation detail of the shell variable $file,
but may be more familiar to write. It is more restricted that the
regular expression, since multiple transformations cannot be chained.

3. SUBST_RENAME_CMD.in= ${MV} "$$file" "$${file%.in}"

Probably too much line noise, and it assumes that the original file is
overwritten at the point the ${MV} is executed.

Roland


Home | Main Index | Thread Index | Old Index