sed dollar sign substitution in Makefile

Oliver Mahmoudi o.mahmoudi at gmx.de
Tue Nov 6 20:17:29 UTC 2018


Hello,

I am currently working on a port, where I need to make the following sed substitution in Makefile: turn "print $1" into "print $4".

Therefore, in Makefile I set: ${REINPLACE_CMD} 's|print $1|print $4|g' file_to_be_changed

However, when invoking the build with make, the shell never performs the transformation. The build just runs:
/usr/bin/sed -i.bak 's|print | print |g' file_to_be_changed
and nothing happens.

At the same time, when simply running the same sed command above on the command line, the substitution actually gets performed.

I could imagine, that this has to do with the shell viewing the dollar expressions as arguments being passed to the script.

Any ideas as to how I can get about this one?


More information about the freebsd-ports mailing list