Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 2
    That suggests that your generated.sub.Makefile recipe doesn’t allow Make to determine whether it needs to be updated; could you edit your question to show that? Commented May 28 at 21:07
  • @StephenKitt Exactly. The only way I want it to be updated if I say so. I even have a conditional $(error Please run a make something) to handle the case that it does not exist yet. It also gets the solution with it. something became a .PHONY target, creating also generated.sub.Makefile, but there is no more generated.sub.Makefile: target. It can not be built. If make would really complain, then I would create a recipe for him from a single touch command. Commented May 28 at 21:11
  • I'm sure I'm preaching to the choir here and this is for a legacy codebase, but: I found, without fail, that the moment I needed to create Makefiles programmatically, make alone in itself was simply not the right tool. Been there a couple of times – generating figures for TeX documents, preparing data archives for compilation, packaging things for Python, doing different things depending on which version of Boost is installed on a system – and every single time I did things in Makefiles, I ended up discarding my complicated Makefiles and going for a specialized tool for the job. Commented May 29 at 8:47
  • In the case of TeX, that was latexmk, in the case of C++/Boost trouble it was meson or CMake, in Python it was setuptools / poetry, and the same is probably true for anything else: Makefiles have a pretty ad-hoc declarative language, and if you need to create rules on the fly because that language and the tooling isn't good enough, you have just exceeded make's usefulness and should go back to using it as a build tool, not as a configure tool. It's simply not its job nor scope. Plus, the more advanced your usage, the less stable it is. (seriously, every GNU make release breaks smth). Commented May 29 at 8:51