Why is there no Makefile backend? #10124
-
Is there any reason why Meson doesn't support Makefiles (e.g. it goes against a strict design philosophy)? If there's not, and no one's gotten around to it, I'd like to submit a pull request implementing a Makefile backend. I would much prefer to use Ninja, but sometimes Make is unavoidable. Really don't want to have to switch to CMake just for Makefile support! Sorry, no idea why there is a duplicate discussion. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 4 replies
-
If we did generate a Makefile, it would have some requirements:
So we would need to use But, you'd have a Makefile that is only as good as build.ninja, except slower because ninja is heavily optimized for speed in return for sacrificing all the Makefile features we don't use anyway. So this leads to the question...
When is it unavoidable? ninja is pretty portable, and there's a POSIX rewrite of ninja in c99 that is even more portable and easier to build. In the worst case, you could almost certainly just build samurai first, and then run meson && samu. |
Beta Was this translation helpful? Give feedback.
-
At the same time you closed the issue and created a discussion, I clicked the "convert to discussion" button, sorry. |
Beta Was this translation helpful? Give feedback.
-
And just so there is no doubt: Meson will not have a Make backend. Even if someone implemented one and submitted it as a PR it would not be merged. |
Beta Was this translation helpful? Give feedback.
-
I'd personally prefer it to generate a Makefile; they're a POSIX standard, are easy to write and debug, and behave better with existing tools than ninja. Make might be slightly slower, but ninja is hardly blazing-fast. I'll have to search if someone has taken the time to write a conversion tool. |
Beta Was this translation helpful? Give feedback.
-
GPT does a decent 90% job of this. It is one of the primary use cases for https://cursor.sh/ a VS Code IDE: converting code from one language to another with the inline edit-replace function. An onboarding example is included which demonstrates the feature upon first launch. Samurai does not appear to have tests. A quick test of ckati reveals that it does not work for Makefiles with vpath. If you read Evan Martin on Ninja, https://neugierig.org/software/blog/2020/05/ninja.html I have found that the addition of Makefile generators further complicates things. Cheers, |
Beta Was this translation helpful? Give feedback.
If we did generate a Makefile, it would have some requirements:
So we would need to use
MAKEFLAGS = --no-builtin-rules --no-builtin-variables
(these define slow junk we don't use and don't rely on), and then map the existing ninja build edges as Makefile rules.But, you'd have a Makefile that is only as good as build.ninja, except slower because ninja is heavily optimized for speed in return for sacrificing all the Makefile features we don't use anyway.
So this leads to the question...
When is it unavoidable? ninja is pretty portabl…