Originally posted on my blog
Introduction
You want to become more productive, automate your workflow, there are many tools to help you ...
For further actions, you may consider blocking this person and/or reporting abuse
I love Makefiles and use them in almost all my projects, but I think the main benefits of them is walking DAGs of dependencies, which the article doesn't really mention.
For example, if your toolchain generates files:
Then you can define some Makefile targets:
Then the command 'make final-file' will run tool-b to generate the intermediate file, and knows that it first needs to run tool-a to generate the intermediate-file, and (the clever bit) it only runs each step if the output of the step is older than any of its inputs.
This means you eliminate needless typing (from running a tree of pre-requisite steps), and you eliminate needless (and possibly slow) rebuilding of files which don't need it. This is the core value of make, and if you can't take advantage of this, then there isn't much value over a set of script files.
I'd classify my current employer (Canonical) as high on the technically savvy scale, and my team uses a Makefile or two on every project. Even in cases where we can't make use of the above dependency analysis, it's nice for us to standardize on one approach to controlling how to build/test/etc projects.
Very interesting, thanks.
I added some missing "dependencies" (the parts after the colon) in my Makefile example.
Great article, i use to handle some of those task with custom django commands... but it really depends on what the task has to achieve, for example initializing app with default data... but it's a good idea to use makefile also.
But i am not sure if it can do everything, for example can it help you to deploy on remote server via SSH like fabfile ?
Thank you, friend.
Yes, you can do that.
I use this file to deploy my app to a docker container or Heroku server.
yeah i use it also but for VPS deployment and sometime on EC2....
TABS! Make sure you mention you need to use tabs not spaces to indent the start of a command. That is something that still gets me two decades of using Makefile's later.
Good to know.
Thank you.
But you don’t really save time though since the commands are short already. I question the productivity improvements here and would use bash aliases instead.
Make was invented for compiling (C/C++) codebases which involves a lot of long commands for compiler, linker, finding libraries, dependency tracking, etc. And it’s still a pain in the ass to maintain makefiles for those purposes. Nowadays I see less and less makefiles at work and in the opensource community.
Hi, yeah, the example is a little bit too simplistic, however with a bit more involved example, one can start seeing the benefits:
what I see is that makefiles are less used with some languages, but are still quite heavily used with others.
Though I agree that I also haven't seen complex makefile in a while, but that is probably because more and more languages have their own tooling.
Can't tell for the rest, these are the ones I am familiar with.
Small updates:
PYTHON:
Fabric was used for this in it's 1.x version.
Since version 2.0 Fabric was split essentially into 2 packages with separate functionalities:
GENERIC:
There is now another tool, that is generic and can be used for many languages, it is even cross-platform
Haven't used it though, in most cases I go with language native solution and if there is none, I usually either:
What do you have inside your Makefile.settings?
Hi,
The code in this file is probably a bit more involved and harder to decipher, but it is just parsing functions really.
To get useful data from docker and/or env variables
Makefile.settings
:Just the first 3 lines are worth it
Great content, Thank you.
Thank you,
I find this very interesting.
I have thought about this a while ago, and Make seems to be both quite standard, and preinstalled (if not using Windows).
Makefiles and alternatives?
Pacharapol Withayasakpunt ・ May 13 ・ 1 min read
Great article! I'm trying it for a workflow for Node apps :)
Great.
Thank you.
It's an interesting approach, but why use make for a bash script's job?