Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
[dupe] The Language Agnostic, All-Purpose, Incredible, Makefile (2019) (mindlessness.life)
35 points by lelf on Jan 26, 2020 | hide | past | favorite | 4 comments



I realized how much I love Makefiles when I had to build a go project, dockerize it, push to registry, package it with helm, push to artifactory, and clean up all the mess what was created on the way. The way the already created (touched) artifacts are not created again makes working with Makefiles super easy. Yes, your $FAVORITE_BUILD_SYSTEM knows this too, but while that might not be installed on every host in your dev ecosystem, make is.

Another reason why I got to love make even more is because I didn't have to remember all these diferent tools parametrization, even better, the Makefile itself documented how to use these different parts of the tooling.

"But this should be done in your CI/CD, right?" and yes, it's right, until your colleagues also wan to test and build and dockerize and etc... on their localhost. I wrote the Makefile, tested it thoroughly and guess what, jenkins can also run make docker_image and make helm_package just as fine.

Makefile is an ooooooold but certainly not legacy technology. I haven't mastered it yet myself but it certainly saved already a lot of time and effort for me.


Make is great, and I use it all the time for task orchestration.

I wouldn't use a hand-written Makefile as the top-level build tool on a library or program - CMake or Autotools is a much better fit there. But on a build that pulls down and compiles a few libraries and then a final package, Make is a great wrapper around the usual "cd $SUBDIR && ./configure && make && make install" kind of thing I have to do all the time.

Make is just a fantastic tool for managing builds that look something like "Run other some weird project-specific build tool, then take the outputs and do some post-processing and copying." I also use it for automating deployment tasks, and for automating one-off "do some things to a bunch of files" kinds of tasks such as resizing images.

Make is available everywhere, and it's very lightweight. It integrates nicely with the shell. It comes with out-of-the-box tab completion. It provides dependency management, and is more standardized than a pile of "build.sh, install.sh, deploy.sh, etc". You can trigger Make's tasks one-at-a-time and trust Make to deal with whatever dependencies it needs to fill.

Make (especially GNU Make) is a weird language with some weird features. And yes - we can all complain about tab delimited fields and other oddities of the language and tool. The tradeoffs are totally worth it in my opinion. Also, getting good at Make will really level you up in your ability to script and orchestrate shell tasks.

GNU Make 4.3 just came out with some cool new features. I hope Make continues to be maintained and used - it's really a fantastic tool for a lot of use-cases.


Make is very nice, but I wouldn't call it language-agnostic. In particular, it has quite a few shortcuts for languages like C and Fortran.

https://www.gnu.org/software/make/manual/html_node/Catalogue...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: