0

I have a run target defined in my Makefile, which is really just there so I don't need to type it all the time. It looks like this:

proto: ...
    # generate protobuf python definitions from proto files

.PHONY: run

run: proto
    $(shell python examples/run_simulation.py)

But make run yields

make: Nothing to be done for `run'.

I was under the assumption that the .PHONY thing makes make think the target is always out of date (various SO answers state this), but it does not seem to work. What am I missing?

oarfish
  • 4,116
  • 4
  • 37
  • 66
  • 4
    It's a big anti-pattern to use `$(shell ...)` functions in your recipes. Take that out and just invoke `python` directly. Then see if you get other errors. Are you sure that you are correctly indenting the recipe line with a TAB character? You will get that message if the `run` target has no recipe. – MadScientist May 17 '19 at 15:45
  • It's questionable to use `$(shell ...)` *at all*, since it's specific to the GNU implementation of `make`. GNU `make` is terrific, but relying on extensions should be avoided unless you know exactly why you're doing it, and you're willing to pay the price in (non-)portability. – John Bollinger May 17 '19 at 17:35
  • It's likely tabs instead of spaces as @MadScientist suggested. The `$(shell...)`, would be interpreted by make at at parse time, and so long as the output of the python command is blank (or parsable by make), you would not get any other error. Note that if you typed in `make blah`, it would still run your python command. – HardcoreHenry May 17 '19 at 19:53
  • It seems this was false alarm. Before I posted this question, I had the plain python invocation in the definition of `run`, but `make´ would just print the command and do nothing. It's back to working now, however. – oarfish May 20 '19 at 05:39
  • Does this answer your question? [make: Nothing to be done for \`all'](https://stackoverflow.com/questions/8561640/make-nothing-to-be-done-for-all) – tripleee Jun 29 '20 at 06:01

0 Answers0