I'm trying to use jq within a Makefile to generate a json file. Here is a sample Makefile
foo.json:
jq -n --arg x "bar" '{"foo": "$$x"}' > foo.json
@cat foo.json
@rm foo.json
When I run this with GNU Make v4.3 and jq v1.6 I get the following
make
jq -n --arg x "bar" '{"foo": "$x"}' > foo.json
{
"foo": "$x"
}
Notice that $x shows up literally and doesn't get interpolated by jq. How do I achieve the following...
make
jq -n --arg x "bar" '{"foo": "$x"}' > foo.json
{
"foo": "bar"
}