News for hackers. Stuff that matters.
Re:Tired of Makefiles by willcipriano on Monday May 13, 2024 @06:13PM (#40349149)
I like makefiles not as a build tool but as a way to put better ui around long difficult to type/remember commands on the repo

make up

make down

make clean

make upgrade

make migrate

Easier than having to think about it

Re:Tired of Makefiles by deathanatos on Monday May 13, 2024 @06:29PM (#40349307)
I find `just` to be better suited than `make` for this use case: https://github.com/casey/just

The sibling's comment (re. just shell in files) is good too, and often I'll put all the various commands into a subdir, and `just` is just an interface to that, particularly so if a given script/command gets complex.

Then, `just` is really a signal "hey, this repo supports this interface" and things like `just -l` for discoverability.

Re:Tired of Makefiles by cassianoleal on Monday May 13, 2024 @06:43PM (#40349434)
I have never used just, but one major advantage of make is that it pretty much exists everywhere - I can assume it's present and I'll be right almost every time.
Re:Tired of Makefiles by eikenberry on Monday May 13, 2024 @06:57PM (#40349544)
Just looks nice but isn't very prevalent yet. One of make's strengths is that it is everywhere.
Re:Tired of Makefiles by banish-m4 on Tuesday May 14, 2024 @01:27AM (#40351907)
Sigh. The problem is just isn't as portable and doesn't do cached file dependencies. It tries to be better than make but it's a step backwards, more like yet another shell language.
Re:Tired of Makefiles by timw4mail on Tuesday May 14, 2024 @09:25AM (#40354999)
The lack of cached dependencies is an advantage in most non-compiled languages, though.
Re:Tired of Makefiles by massysett on Monday May 13, 2024 @06:17PM (#40349188)
Couldn’t you do this with shell scripts? Make just runs commands anyway. If you’re not using make’s dependency-tracking features, might as well just use the shell directly and use the simplest tool for the job.
Re:Tired of Makefiles by xmprt on Monday May 13, 2024 @06:33PM (#40349355)
make still has a better UI than shell scripts. With shell scripts you have to maintain multiple files whereas a Makefile has all the scripts in a single file.
Re:Tired of Makefiles by SahAssar on Monday May 13, 2024 @06:49PM (#40349484)
No you don't. I like makefiles because of the dependencies between targets but for simple multi-target things I still do shell scripts like

    mything() {
      # ...
    }

    otherthing() {
      # ...
    }

    if [ $# -eq 0 ]; then
        echo "Usage: ./run.sh [mything, otherthing]"
        exit 1
    fi

    "$@"
Re:Tired of Makefiles by collinvandyck76 on Monday May 13, 2024 @07:09PM (#40349651)
I've been writing scripts like this but with a case/esac at the bottom to map $1 to the right command. Have never thought about doing this instead. thank you for opening my eyes!
Re:Tired of Makefiles by banish-m4 on Tuesday May 14, 2024 @01:31AM (#40351926)
Been There, Done That, Bought The T-Shirt and leads to unmaintainable shit. One script per action. The end.
Re:Tired of Makefiles by collinvandyck76 on Tuesday May 14, 2024 @10:12AM (#40355427)
Maybe for your usecase, sure, but my usecase is my own dotfiles which has some of these helper scripts and it's a good fit there.
Re:Tired of Makefiles by SahAssar on Tuesday May 14, 2024 @04:43PM (#40359946)
You express no nuance and only say that something is wrong without explaining why. Your communication skills lack "skill" and "communication". Your absolutism makes me convinced that you are are either wrong or incapable to explain why you would be right.
Re:Tired of Makefiles by edflsafoiewq on Monday May 13, 2024 @06:45PM (#40349448)
Why is that a better UI?
Re:Tired of Makefiles by t3rra on Monday May 13, 2024 @06:44PM (#40349445)
wth. makefile can include other makefiles.
Re:Tired of Makefiles by banish-m4 on Tuesday May 14, 2024 @01:30AM (#40351920)
That's a god function antipattern and rapidly becomes non-portable.

Each lifecycle hook should be a an executable of some sort like "scripts/{{command}}", be it a shell script or something else.

Re:Tired of Makefiles by cassianoleal on Monday May 13, 2024 @06:42PM (#40349426)
I'm not GP but:

Make gives me a single, predictable and stable interface to the repo.

From the root of the repo, I can type `make <tab>` and get a list of available tasks. Alternatively, there's a Makefile on the root.

With scripts, I need to type... what? `./<tab>` and look for clues? Maybe the scripts are in `scripts/`, maybe they're in `build/`, maybe they're in `ci/`...

Even if I know where the scripts are, `make task` is quicker and easier to type than `./scripts/task.sh`.

One could just use a make task to call a script, which I have done, but in most cases if you do that, what's the point of the script?

Re:Tired of Makefiles by chuckadams on Monday May 13, 2024 @07:46PM (#40349934)
> what's the point of the script?

For starters, not having to indent every line with a tab, put backslashes at the end of each line, or double every $ sigil in the script. Being able to transparently replace it with perl or python or some other non-shell-script is an occasional bonus.

Re:Tired of Makefiles by fuzztester on Monday May 13, 2024 @10:30PM (#40351055)
Re:Tired of Makefiles by cassianoleal on Tuesday May 14, 2024 @04:09AM (#40352752)
You picked the least important point I made, stripped it out of context and argued against it. This is a strawman. Feel free to use it as a piñata, I don't care.
Re:Tired of Makefiles by FrenchyJiby on Monday May 13, 2024 @07:44PM (#40349910)
Totally, I describe it as "shorthand for most used commands + lightweight documentation".

I made an entire presentation about this[1], trying to sell it to work mates.

[1]: https://jiby.tech/presentation/makefiles/makefiles.html

Re:Tired of Makefiles by nrr on Tuesday May 14, 2024 @04:06AM (#40352732)
I use a build system (and means of running project tasks) other than make, and I nonetheless usually include a Makefile in the root that does nary more than say something to the effect of, "What you're likely looking for is elsewhere," to accommodate this behavior.