Search code examples
python-3.xmakefilecompilationstdin

STDIN from Makefile with make run command


I have a program in which I'm trying to invoke the following command:

make run {FILE} e.g filename.txt

How can I create my Makefile so it can execute this program and accept any filename through STDIN.

My Makefile looks like the following:

run:
   python execute.py --filename {ANY FILENAME}

Solution

  • The arguments to make are targets. There's no special relationship between run and {FILE} in your initial example. If you want to force the run prefix, it'll have to be part of the target name, instead of space separated:

    run-%:
        python execute.py --filename $*