4 ms·
Do we still need makefiles :(? What’s the alternative?
by baby 4y ago
Do we still need makefiles :(? What’s the alternative?
- shepherdjerred 4y agoI've found Earthly[0] to be a good alternative. Its syntax is reminiscent of both Make and Dockerfiles. I still heavily use Makefiles at my workplace. It seems to be common with Go projects. [0]: https://earthly.dev/ https://earthly.dev/
- maccard 4y agoI still use makefiles for a wrapper around the build steps. How else do you handle the magic incantation for aws ecr get-login-password --region region | docker login --username AWS --password-stdin aws_account_id.dkr.ecr.region.amazonaws.com docker push <...> No suggestions on better alternatives though unfortunately
- epistasis 4y agoI have used make extensively for two decades, and every year I come to love it more. It doesn't work well with some language designs, like Java, but Java is its own world and doesn't want to play with anything else, so that's fine. I use it a lot to make one-off data analyses somewhat reproducible. To make them fully reproducible I use docker run for each command invocation, but sometimes I skip that step. Something like airflow is way too verbose and clunky compared to make for my use cases.
- yjftsjthsd-h 4y ago> Do we still need makefiles :(? Yes, because > What’s the alternative? There are endless alternatives - none of which are even remotely as ubiquitous, most of which are more complex, less portable, make aggressive tradeoffs, aren't as flexible, etc. Make is everywhere and provides a decent baseline.
- shepherdjerred 4y ago> less portable Makefiles being portable is an illusion. Make itself has multiple flavors. Running standard POSIX utilities like `find` or `sed` will have different outputs depending on if you're on macOS, or regular Linux. There are so many implicit dependencies that aren't codified. It's true that Makefiles are often portable. I'm always very happy when a GitHub repo has a Makefile and I can do something like `make install` to have a binary on my system. This is because my system happens to have the required compilers and libraries, but there have also been plenty of times where I needed to install something without it being clear.
- dwheeler 4y agoThe question isn't "do we need makefiles". The question is, what is the problem you're trying to solve? There are lots of cases where make and makefiles are a great solution. A few pointers though: * In most cases, just use GNU make, don't try to stick to just POSIX make. POSIX make is too feature-poor for many situations. * If you have more than a few files, automatically generate the dependencies (e.g., in deps/DIRS/FILE.d files). In practice that often means you need to use GNU make (or automake). Doing that by hand for a few files is fine, but if you try to scale that up, it will become a large always-wrong mess. It's pretty easy to do once you know how - it's just a few lines - but it will save endless headaches. Many compilers already have built-in support for make, so in many cases make is the easy path. * Don't use recursive make (re-execute make in each subdirectory). Run "make" once, and give it all the correct info. It seems like this would be slow, but it's faster & easier to maintain. I routinely get executions of 0.07 seconds on 1000 files when there's no work to do (a really tiny overhead). There are definitely alternatives. I routinely use rake, which calls ruby instead of shell as the command language. Rake can be quite useful, but I don't think it's an automatic win over make at all.