patsubst: Whitespaces are not replaced by spaces | Possible issue in make or the documentation
Marek Küthe <[email protected]> Wed, 30 Apr 2025 12:15:18 +0000
| Newsgroups | gmane.comp.gnu.make.bugs,gmane.comp.gnu.make.general |
|---|---|
| Message-ID | <20250430121518.7b90f398@ciel> |
Hello, I am currently taking a closer look at the `patsubst` function in `make`. The documentation [1] says > Whitespace between words is folded into single space characters; leading and trailing whitespace is discarded. I have now created a example file (see attachment): ``` code := $(patsubst ,, int index = 10; // Hier wird x auf 10 gesetzt ) beispiel_zeigen: echo "$(code)" .PHONY: beispiel_zeigen ``` However, the result contains the original whitespaces: ``` echo " char index = 10; // Hier wird x auf 10 gesetzt " char index = 10; // Hier wird x auf 10 gesetzt ``` My make version: ``` $ make --version GNU Make 4.4.1 Built for x86_64-pc-linux-gnu Copyright (C) 1988-2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. ``` Is this a bug, an issue in the documentation or am I doing something wrong? I would appreciate an answer! Regards Marek Küthe [1] https://www.gnu.org/software/make/manual/html_node/Text-Functions.html -- Marek Küthe [email protected] er/ihm he/him
Makefile
(text/x-makefile, 133 B)
code := $(patsubst ,, int index = 10; // Hier wird x auf 10 gesetzt ) beispiel_zeigen: echo "$(code)" .PHONY: beispiel_zeigen
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEmqKBWfzrPNg7whIBfoaRRmmRCMcFAmgSFFYACgkQfoaRRmmR CMckbw/8DnbFEyd+Lt5LHzBqJiYUCn6qCjNe9ifuaV7MFF8svmn+oXBp/ttiODCf 8TuRxh5mV1u7GrCuDWgjWAIOwECXAZFc5J7RlpypjZBkA0a56kt//ZhtQmX8Af3s 9lqqa+zMzhPQ4L8Cb4fE0mip6C5CiDDm14MwXYvMCrNaxlZM1ejohQPTBr0DYG5o /o/vlddFKgEL6gALGtFynpJ1q1MPw8WAlHCNiOm1IdEvJ2OhRtKI91IwvpTQaHoX HtzNfrMpqw7n2O/Tv9ie7S52b84n9RSJ1u8MK4EnbtenVeQJ5XiSgcJ/VOQK2bAp clbZAg1Y/otkRbZJ7LAiuFf0MseiaAtF6bEtYHM7zin6RAdlEIMyhXWS7Y1uS2XI dUTW8AIYHZTl7k2R5glomIWsnjKPovZMKvyCDX+nP3Hy3frMmWBNeHLvWz/+WKOc tyGmtU4xCVXDi71FtdGO5VVSZJ4QyFKzNUF4W1d/xzZ9VXBrKFHJyOsp1ZXeB+7o wwYyJenTrr03JipWQgCPqjcmhrSgZj5EHjuk2MwC6HOifJi6pFhvkbmrMiW8LbpU vYzJ7FO467hI5J9IT6FgOTSF1JvIKEJWpbQhypFV9g87kiPMO8rytmKAeCmQ6ACN IgM6laysWspwyxbkgLAi1oqglkOEk57vwh/3WRG2IZ2jufSA8MM= =mJbc -----END PGP SIGNATURE-----