I want to use a temp directory that will be unique to this build. How can I get the pid of my make command in the Makefile?
I tried:
TEMPDIR = /tmp/myprog.$$$$
but this seems to store TEMPDIR as /tmp/myprog.$$ and then eval as a new pid for every command which refs this! How do I get one pid for all of them (I’d prefer the make pid, but anything unique will do).
Thanks in advance.
Try mktemp for creating unique temporary filenames. The
-doption will create a directory instead of a file.Note the colon. (Editor’s note: This causes make to evaluate the function once and assign its value instead of re-evaluating the expression for every reference to $(TEMPDIR).)