|
|
|
|
|
by multani
642 days ago
|
|
I like Makefiles too :) I use them more or less as a command runner, not often to build new targets based on sources (sometimes still). In particular, I like: * The ubiquity: it's easily available almost everywhere I touch and if not, it's usually a package install away.
* The auto completion: I often define variables with default values at the top, but they can be both easily discoverable and their values can be changed just by typing `make VAR<tab>=foobar ...`
* Chaining commands: make targets can be chained with `make target1 target2 target3 ...`. They will execute in the order specified. If I run this too often, I can usually create a 'ew make target that chains them all. Make is definitely not perfect and could be simpler. My biggest griefs are: * The abscons list of built-in variable. I can only remember a few of them ("dollar duck `$<` being my favorite), but they are not great to search in the docs and my brain is limited.
* The "one line = one shell" is a bit of a PITA for the use case I have. I usually move more complicated script put of Makefiles. I thought I would have been bitten by the M4 indentation more often, but it's not really a problem for me anymore at this point (my editor _knows_ Makefiles since it's so ubiquitous and does the right thing) I have Just on my list of things to check, one day... |
|
We probably all should. But it is valuable a few different ways to have everything in a single file.
Even though it's an ugly mess having a script within another script, with make variables mixed with shell variables mixed with make logic mixed with shell logic mixed with child proc output... the task at hand wants bits from both worlds at the same time, so the mess is also the value.
You can rig up alternative answers for each of those, but really it just means make should probably have a more generic scripting language itself so you don't have to leave it to get something done, like how you don't have to leave awk to do non-record-processing stuff. People don't, but you can basically write anything you want in awk just like in shell or python.
Or it should have less, be intentionally so limited that you can't embed any significant logic in the makefile and so it all lives somewhere else, either way, so long as it's all together, either all in the makefile or all in something the makefile runs.