4 ms·
Makefiles are actually great! Just not as a build system. If you have a project where you need to do a thing, you can instead make a Makefile to do the thing:
by millstone 6y ago
Makefiles are actually great! Just not as a build system.
If you have a project where you need to do a thing, you can instead make a Makefile to do the thing:
thing:
some shell command
that's it, now you get to type `make thing`.
The power is the generality: it can wrap any command, from jq to curl to whatever. It's perfect for small, weird workflows which don't naturally fit into other build systems.
But don't use it for C++!
- bbatha 6y agoIf that’s all you use make for just write a shell script with functions! Then you can take arguments and only have to worry about shells weird syntax instead of make + shells weird syntax.
- pjmlp 6y agoNeither do use them for C. Everyone that equates UNIX with Linux, apparently misses out how much fun (it was not) was writing portable makefiles across all major UNIXes and other non-UNIX platforms during the 90's up to the .COM first wave.
- slavik81 6y agoIf you run it in a directory that contains a file named `thing`, the command will not execute. You should be marking thing as `.PHONY`. It's really easy to specify things incorrectly in a Makefile and not notice for a very long time.