Live data from Hacker News

How I stopped worrying and loved Makefiles

gagor.pro

41–50 of 144 posts

Re: How I stopped worrying and loved Makefiles

#41

Makefiles fill that great need for a high-level 'scripting DSL', where you have a lot of different programs (or scripts), with a loose set of dependencies or order of operation, and you want a very simple way to call them, with some very simple logic determining the order, arguments to pass, parallelization, etc. Their ubiquity on all platforms makes it even easier to use them. I much prefer Make to alternatives like…

Seeing people reinvent make every 10 years is very frustrating. Just learn make!

Practically any language will do for running a set of tasks to compile a program. Unless you already love this "wheel" intimately, just learn a real language and use that.

Re: How I stopped worrying and loved Makefiles

#45

What's the rationale for using makefiles as script runners over just having a directory with scripts inside? Not for compiling, just as script runner. I see this practice often and I haven't found a good reason

Likely a declarative way to specify dependencies. But not sure if make as a tool for that is the best option in general.

Re: How I stopped worrying and loved Makefiles

#46

What's the rationale for using makefiles as script runners over just having a directory with scripts inside? Not for compiling, just as script runner. I see this practice often and I haven't found a good reason

Dependency management and automatic parallelization (via `make -j`).

Re: How I stopped worrying and loved Makefiles

#48

What's the rationale for using makefiles as script runners over just having a directory with scripts inside? Not for compiling, just as script runner. I see this practice often and I haven't found a good reason

Dependency management, definitely. Loads of scripts don't work until X has been done, and X, Y, Z, and sometimes QWERTY have to be done first, and they take minutes and a ton of bandwidth so you don't want to do them unless you have to...

... and if your scripts do all that, they've basically rebuilt make, but it's undocumented and worse.

(I say this as someone with LOTS of experience with make, and am not really a fan because I know too much and it's horrifying. But I dislike custom crippled versions even more.)

Re: How I stopped worrying and loved Makefiles

#49

What's the rationale for using makefiles as script runners over just having a directory with scripts inside? Not for compiling, just as script runner. I see this practice often and I haven't found a good reason

It can help abstract the differences you may have across projects. If you're on a team with many projects/repositories, having conventions across them all helps improve onboarding, cross-teamwork and promotes better dev ux. A really simple way to do this is make. It lets you have the common targets and convert them to the relevant target. This can become more useful as you write automation for CI and deployments for all your projects.
Post reply on HN