Email or username:

Password:

Forgot your password?
Devine Lu Linvega

That's it. I'm learning how makefiles work, today.

49 comments
Bad Diode

@neauoire nice! I will be happy if we switch the build.sh to a Makefile on uxn :P

I have some notes here if you wanna take a look: badd10de.dev/notes/makefiles.h

Devine Lu Linvega

@bd yeah that's the goal! Thanks for the notes :) I'll send it over for review once I've got something I'm proud of.

mcc

@neauoire Apropos of nothing: I think if you take away the parts that are due to unfortunate backward-compat/bug-compat with versions of the program written in 1972, make actually has a very powerful and useful underlying model! Awhile back I attempted to make a clone of make that used python snippets for the "shell language" instead of shell snippets and had some promising results with it.

Alex McLean

@neauoire I remember that hard tabs are either forbidden or mandatory (but can't remember which)

✨jes✨

@neauoire inb4 devine writes a smaller, better version of make :3

Kartik Agaram

@neauoire Any reason in particular? I think it's easy to overuse make..

Devine Lu Linvega

@akkartik curiosity, also my build shell scripts are bordering absolute madness. I'd like people to clone, make run, make clean, etc.. Not have to dissect my shell script to figure out my naming conventions

kelp

@neauoire I'd rather have the shell-based build system. cmake and make don't gurantee a clean build, and shell scripts are a common tool that most unix-minded people can easily grok.

Peter Roe 🪶

@neauoire Only one person has ever written a makefile. The rest of us have just been endlessly copying it ever since.

Justin Miller

@neauoire Have fun with white space, biggest trip up.

evolbug

@neauoire interesting how many people are opposed to make in this thread. definitely smells like distaste born of generated makefiles (autotools, cmake) and makefiles that try to be too clever with magic calls.

make at it's core provides a very simple yet very powerful mechanism of dependency based shell execution, which alone makes it very easy to reason about and write 'recipes' for any common tasks (not just builds) you want to do in a project without reinventing half of it in shell.

Devine Lu Linvega

@evolbug I'm not deterred, my use of it will be pretty basic. I just want folks to be able to make run in the repo, and have a uxn build.

Devine Lu Linvega

I'm very frustrated that I can't figure out how to make makefiles do very simple things. This is beyond me, who the hell came up with this madness

DELETED

@neauoire like most unix things, it was created as a simple hack to solve an immediate problem and accidentally started getting used by other people.

as a result it is a thing that was definitely not designed to be used by people for doing things

the original creator has acknowledged that if he knew that would happen, he would have made it not suck so much

Devine Lu Linvega

@zens haha, that explains so much. Yeah, I thought I could somehow simplify it for people by using make, I think I might just stick with shell scripts a while longer afterall

DELETED

@neauoire i do appreciate the simplicity of having the build instructions for projects be *consistent*

so i write makefiles even for web things, that might just trigger another build too, just for the benefit of
make build
working as expected

⛧ esoterik ⛧

@neauoire while i have been able to get makefiles to work before i sympathize. it's a needlessly annoying format with some frustrating limitations

William D. Jones

@neauoire The exceptionally shitty thing about Make is that there are SO many variants that extend the original make program written by Feldman in incompatible ways.

Feldman wrote a paper in '78 on how his original make works. Knowing that you like portability, this is probably the make variant you want to target:

ewald.cas.usf.edu/teaching/200

William D. Jones

@neauoire You're very welcome. I've been in your position before ("what subset of make is the safest to target?"), so I know where to look for info :D!

You can actually get somewhat far w/ 1978 make. I miss the lack of include files (to put user-settings in w/o checking it into version control), but I'm sure you'll manage :D!

Aeáro, a SeaWyrm :elfstar:

@neauoire

If it's helpful, here's the guide I generally use: cs.colby.edu/maxwell/courses/t

It starts out with a very basic example and then complicates it step by step. I guess so that people can follow it to their desired level of complication. 🙃

Bad Diode

@neauoire yeah I can never remember the syntax for anything, which is what I made my standard makefile that I copy and adapt between projects. I wanted to have all my build outputs be on a separate folder and to avoid as much unnecessary rebuilding as possible. The former is not straightforward to do at all.

Rob Landley

@neauoire The nonsense with the hard tabs is particularly annoying.

people yelled at python for years about its significant whitespace, but grandfathered in make...

web.archive.org/web/2003091620

Jonas

@neauoire Along with all the good resources everyone gave, there's also the GNU Make book on Nostarch (there's a sale running for the weekend for the whole site with the 31DEFCON code)

nostarch.com/gnumake

Kototama

@neauoire there was this joke that every Makefile is copied from another since the first one was created because nobody can remember or grasp all the syntax.

Devine Lu Linvega

@kototama well I wrote mine from scratch! so there's two now

Moffin'tosh

@neauoire TFW the biggest reason I'm using rust is because of cargo

Go Up