3 ms·
These days, most of my projects have a Makefile with four or five simple commands that _just work_ regardless of the language, runtime or operating system in us
by rcarmo 9y ago
These days, most of my projects have a Makefile with four or five simple commands that _just work_ regardless of the language, runtime or operating system in use:
- make deps to setup/update dependencies
- make serve to start a local server
- make test to run automated tests
- make deploy to package/push to production
- make clean to remove previously built containers/binaries/whatever
There are usually a bunch of other more specific commands or targets (like dynamically defined targets to, say, scale-frontends-5 and other trickery), but this way I can switch to any project and get it running without bothering to lookup the npm/lein/Python incantation du jour.
Having sane, overridable (?=) defaults for environment variables is also great, and makes it very easy to do stuff like FOOBAR=/opt/scratch make serve for one-offs.
Dependency management is a much deeper and broader topic, but the usefulness of Makefiles to act as a living document of how to actually run your stuff (including documenting environment settings and build steps) shouldn't be ignored.
(Edit: mention defaults)
- MyPseudonym 9y agoThere are other projects than just web apps you know.
- rcarmo 9y agoI use the above for database imports, ETL and Azure template deployments too. And who says "serve" launches an HTTP server? :)