Dear Sergey,
Thank you for your reply!
Am Di., 7. Sept. 2021 um 21:39 Uhr schrieb Sergey Matveev
<stargrave_AT_stargrave.org>:
> Just out of curiosity, why POSIX shell abilities are not enough for that task?
>
> read D < "$2".d
> redo-ifchange ${D#* }
>
> POSIX "read" out-of-box understands \-newlines that can appear in those
> .d-Makefiles and read the whole .d file as a single line, where you just
> have to strip the first word ("target:").
This is quite embarrassing. I was not aware that 'read' was able to
understand backslash-escaped newlines.
That does indeed make using only POSIX shell features a viable option.
Still, I'm personally a bit wary of such an approximate solution since
it only superficially aligns with Makefile syntax.
My implementation keeps relatively true to the way real make
implementations parse Makefiles, and as such
there are much less chances for things to break.
For example, it is also able to properly recognize:
- comments
- spaces in filenames, escaped by preceding backslash (common
extension, but not part of POSIX make)
- dollar signs in filenames, escaped by preceding dollar sign
I have to admit, these concerns are mostly esoteric.
But I do think there are situations were these things are useful, for
example when users have weird symbols, like spaces,
in their build paths, because their Unix user name contains them too
(sadly happens pretty often).
Cheers,
Thomas Oltmann
> --
> Sergey Matveev (http://www.stargrave.org/)
> OpenPGP: CF60 E89A 5923 1E76 E263 6422 AE1A 8109 E498 57EF
>
Received on Tue Sep 07 2021 - 22:57:03 CEST