I need to get some external data to form an output file name in a Makefile.
In GNU Make I can do something like this :
NAME=$(shell some_commands)
$(NAME).out: file.in
compile "$<" -o "$@"
Some other rules have $(NAME).out
as a prerequisite so I need $(NAME).out
as a target. I can't use substitution+quotes here as this is not interpreted by a shell.
I see from the BSD Make man page that on Mac OS X I should be able to do something like this (I could not test it yet, though) :
NAME!=some_commands
$(NAME).out: file.in
compile "$<" -o "$@"
Is there a hack to do this kind of things in a portable way?
I do not want to generate the Makefile and clutter the build process. I though of includes, but they also have a different syntax across Make versions.