Handling '=' in a filename together with $(eval )
Alejandro Colomar <[email protected]> Thu, 13 Feb 2025 15:46:18 +0100
| Newsgroups | gmane.comp.gnu.make.general |
|---|---|
| Message-ID | <7x552apoacmuycv7w23knnbtmxamq7b7khpmesz23ggw7a4i4r@s7cg5t5cnbpq> |
Hi! I'm trying to find a way to correctly handle files with a '=' in their name with make(1). I know I'm doing something in the edge of what's possible, so the answer may very well be "you can't", but if it's possible, I'd like to learn how. The reason is that the file exists in another project, and I'd like to use it with my Makefile; I can't fix the filename. I already found a trick some time ago for handling ':' in filenames, so I expected the same trick would work, but it doesn't. Consider this directory: $ tree . ├── Makefile ├── src └── tmp 3 directories, 1 file This is how I'm handling filenames with a ':'. I just add an escape: alx@devuan:~/tmp/symbolds$ cat Makefile obj := obj/asd\:fgh all: $(obj) $(info $(obj) : obj/% : src/%) $(eval $(obj) : obj/% : src/%) $(obj): touch $@ alx@devuan:~/tmp/symbolds$ make obj/asd\:fgh : obj/% : src/% make: *** No rule to make target 'src/asd:fgh', needed by 'obj/asd:fgh'. Stop. (The failure is intentional. That error message helps me see that make(1) did understand me; I just didn't provide the prerequisite.) When I try the same trick with a '=', I'm not sure what make(1) is interpreting, though: alx@devuan:~/tmp/symbolds$ cat Makefile obj := obj/asd\=fgh all: $(obj) $(info $(obj) : obj/% : src/%) $(eval $(obj) : obj/% : src/%) $(obj): touch $@ alx@devuan:~/tmp/symbolds$ make obj/asd\=fgh : obj/% : src/% touch obj/asd\=fgh touch: cannot touch 'obj/asd=fgh': No such file or directory make: *** [Makefile:9: obj/asd\=fgh] Error 1 It somehow think the prerequisites are met, but I didn't provide them. Somehow, make(1) is misunderstanding me. Can I workaround this in a different way? (The $(eval ) is necessary; if not, it would be easier.) Have a lovely day! Alex -- <https://www.alejandro-colomar.es/>
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmeuBbMACgkQnowa+77/ 2zKd5A//YzvWu6xB2acIGUEtzXSmfxVFnjbxrEmrL8z9H6g6JZAIYzHnB4uvhVDI ztQeIdRiTqYJz+jAyWDPaN9St88oQh6/ptWboZm3Dco/znp3Aw3gztyxHfNzQs6I u2w34RyQZogtYuuxsGMOzEiuhza6vk8USVbgK/cAQ3Nj0aJegNL+6SyACqijJRw5 17pnCC01oa3JHfkJOIe+Sx2KISXrTFZ1lBRq4Kc7utwqF+rV/nEIxF9kD6o22ca2 ljkH9ujYubiHnTzR8mbCkh4mZ41GYByLSsDiwvTWSKwYNq4wLMpHsWqNQqXExvVp hTu7u6Ev8uPw2dwDjdxyAbinFOq6gKdMpfkVsM+2+UOXDpJ1adPpaV5PERuakIv9 k66dBbaFCn3VvF4Vw4K+6ayMdT7i/TJyaaYTtYqyCsTsCf+aE3dK9ykLHkctnuyJ KauhGEIsxgjUBxJEZ1VVYbn/6nVfZnRJefQKFM4DG8jXJedx4szwy0VueiVgSpxl HQHil/cyLyl93O46nPpFA9VOk7bKrzB0a9KAGO1iSLBfgp84FNDC3kSv3XQVO9+4 swcPo2kmMx3WTHam9HmtQZNZLa9F1XT/XmxxdveesW7Nac7zBTwK4SJyoNGadfLT M4d2wswY/RpEEfax3jFiheoCxig+OQgY+Jq843ejtrM63IRvCfA= =AR8f -----END PGP SIGNATURE-----