I've created a set of nifty set of Makefiles for repeating the steps to provision and maintain many AWS clusters.
The benefits of make have been:
- the bulk of the execution are various shell commands These are clearly specified and easy to maintain within make.
- the whole process fails if any individual step fails (unlike bash)
- I can bake parameterized commands into make recipes (with hackery)
- I can specify dependencies to these commands (with hackery)
However, through much of this I've been feeling like make is a poor match for the task. Parameterized commands are a terrible hack implemented by calling make calling itself again with new parameters. Conditional execution is horrible in make. Simple tasks like if CHECK_SERVER_STARTED(params) then START_SERVER(params); COLLECT_DATA_FILES(params) if server_was_stopped_at_the_start(params) then STOP_SERVER(params);
Also, dependency tracking using files is a terrible idea.
There must be a better way. Is there a good language I can have:
- shell commands trivially run (ideally part of the language) (i.e. not Python, Perl)
- conditionals, branching, failure-case handling, etc... are all built in
- local variables (or at least something like a stack, so that I can call a function and not have thing piss all over my global variables).