5 ms·
If you're using Make as a command runner or a "standard entry point" to a project, instead of using it as a build system that tracks dependencies between files,
by cytzol 5y ago
If you're using Make as a command runner or a "standard entry point" to a project, instead of using it as a build system that tracks dependencies between files, I highly recommend using `just` instead: https://github.com/casey/just https://github.com/casey/just
It has this functionality built-in, and avoids a lot of Make's idiosyncrasies. (Not affiliated, just a fan.)
- delusional 5y agoI think part of the appeal of make as a script runner is the ubiquity.
- GordonS 5y agoWas going to say the same thing. Make is fiddly, has gotchas and is far from perfect, from the development side - but it's certainly "good enough", and it's great once you've got your Makefile done. And it's available, or at least easily attainable, pretty much everywhere. I even use it on Windows.
- davidjfelix 5y agoYeah, but if you follow the advice FTA, you now have to rely on a usable python version and make. Still fairly common, but what if I use node instead? I think the point is -- the more usability you add the more you potentially dilute how ubiquitous it is. I think it's okay to point to new tools in the space that shake things up and add usability for the purposes Make currently is used for. Ubiquity doesn't happen over night.
- Arnavion 5y agoEven if I followed the advice in the article (I don't really plan to), python3 is very likely to already be there in a Linux distro for other reasons, whereas node.js is very likely to not be there. If you're on another OS where neither make nor python3 nor node.js are there by default, then sure you're already going to manually install make, so the choice of python3 or node.js is basically identical.
- kazinator 5y agoMultiple comments show how to do this with an awk, grep or sed one liner in the Makefile.
- 1vuio0pswjnm7 5y agoAnother part might be parallel execution, running multiple shells at the same time https://github.com/rofl0r/jobflow https://github.com/rofl0r/jobflow
- Arnavion 5y agoAlso, if you add a new target that would benefit from tracking dependencies between files, then make is already ready to do that. I use makefiles for my Rust code with just default+test+install targets that do no dependency tracking (since Rust's build system already does that much better). But if I need to add a target for, say, validating some OpenAPI spec that only needs to run if the spec file updates, then that can go in the same Makefile.
- lights0123 5y agoI wanted to use Just at one point, but was disappointed that it doesn't support parallel execution. I ended up making a quick tool to convert a ZSH file into a Ninja file to take advantage of its pool feature.
- andreineculau 5y agoFrom GNU Make webpage: > GNU Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files. What is idiosyncratic is to think Make is first a command runner, and only after a file generator, and complain that it is doing a poor job at the former when it clearly says it is focusing on the latter. I read the "idiosyncrasies" section on the just README and they are all performance related targeting file generation. All of those can be learned in one minute, as part of "I'll always find Makefiles in the wild, it's good to know the basics".