Live data from Hacker News

Makefiles for web work

rosszurowski.com

1–10 of 58 posts

Re: Makefiles for web work

#4
I haven't played around with the make-alikes, but I have also taken to using make for this sort of thing.

My blog, for example, has make targets for things like making a production build, publishing, cleaning out generated artifacts, and running a dev build (with drafts) + bringing up the test server.

Last year I wrote a little post about how I also use make + nix-shell to supply dependencies for Makefile tasks without needing to have them on my PATH: https://t-ravis.com/post/nix/nix-make/

Re: Makefiles for web work

#5
post #2

Just [0] was discussed on HN. I think I'll give that a shot next time I have to write something like this. .PHONY is lame. [0] https://news.ycombinator.com/item?id=34315779

I really like how easy it is with Just to make it self-documenting.

There's some good things about Makefiles, yes, but there's also a lot of weird legacy functionality. Make was meant to create files and directories, and the .PHONY functionality seems to be a workaround added to make it usable as a general-purpose task runner.

Re: Makefiles for web work

#6
I realize that I have been using shell scripts for this. I just copy-paste commands and add a selector. It has the benefit that I didn't need to learn a new syntax.

Re: Makefiles for web work

#9
post #3

My main problem with make: When you want to write sophisticated build processes, the syntax is bizarre and difficult to work with.

The creator of Make actually apologized for it, as far as I have read.

I'm very happy with Make, though I have to agree, the syntax could be better. I don't mind using tabs, but why are spaces not OK as well? It would also be good to be able to not have to break long lines or multiline things with backslashes all the time. Yes you can set that oneshell thingy, but that is inconvenient in other ways, because it is for the whole file instead of a single command or a single target.

So it could be better, definitely, but it does the job of doing DAGs well and it is available on most systems, so I don't have to add some huge tree of dependencies just to run tasks.

Re: Makefiles for web work

#10
It is at least much better than having tasks and their dependencies merely specified as plain strings in a package.json file, as unstructured data, out of which the tool (npm) does not have any knowledge about dependencies and simply runs all strings as commands. This is done by countless web projects and it is embarrassing. I would rather have a package.json script that calls Make, than define my steps in the package.json itself.
Post reply on HN