i should probably learn how makefiles work some day
-
i should probably learn how makefiles work some day
-
i should probably learn how makefiles work some day
@eniko I have done that learning part multiple times. It is knowledge that just pours out of my brain after not using it for 15 minutes.
-
i should probably learn how makefiles work some day
@eniko noooooooo
-
@eniko I have done that learning part multiple times. It is knowledge that just pours out of my brain after not using it for 15 minutes.
@orva @eniko I think there is perhaps a two-digit number of people in the world who are actually good at Make. For everyone else, we learn just enough of it to do whatever it is we need in that moment, and then promptly forget/repress it.
This is one reason why most makefiles are awful.
*) Footnote: I know one of the people who is actually good at Make. He has written and maintained the most delightful and crazy things with it.
-
i should probably learn how makefiles work some day
@eniko like how they're implemented or how to use them
-
i should probably learn how makefiles work some day
-
@eniko like how they're implemented or how to use them
-
i should probably learn how makefiles work some day
@eniko A few months ago I wouldβve said βdonβt, itβs not worth it.β
But I love using them as basically shell scripts. Theyβre really flexible and a good universal tool for building simple projects in any language.
Anything more complexβ¦. nah, I reach for a more modern build tool.
-
i should probably learn how makefiles work some day
@eniko, meanwhile you cane make a game using CMake, I suppose. The ray tracing part is already there.
-
i should probably learn how makefiles work some day
@eniko bash shell scripts or death ;)
-
-
i should probably learn how makefiles work some day
@eniko I LOVE make! AMA.
-
@eniko the most important thing is make is a jobs system based on file dependencies.
a makefile is a series of jobs, which will produce a file (which is supposed to be the name of the job) with a list of tasks (individual commands to generate said file). a job sometimes though will depend on other jobs, and those also have dependencies noted by file.
when make runs a job, it will get the date of the file produced by that job. then, look at all dependencies. if any dependency has been updated since (it will try to run those jobs, and look at all the dependencies, it might not actually run any command), then it will actually launch the tasks
-
@eniko the most important thing is make is a jobs system based on file dependencies.
a makefile is a series of jobs, which will produce a file (which is supposed to be the name of the job) with a list of tasks (individual commands to generate said file). a job sometimes though will depend on other jobs, and those also have dependencies noted by file.
when make runs a job, it will get the date of the file produced by that job. then, look at all dependencies. if any dependency has been updated since (it will try to run those jobs, and look at all the dependencies, it might not actually run any command), then it will actually launch the tasks
@eniko it's a bit abstract, so it's easier with an example: you have a makefile with three jobs, two for two c files, lib.o and main.o, which depend respectively on lib.c and main.c, and one that will link the two together into an executable (say, prog)
lib.o: lib.c
gcc -c lib.c
main.o: main.c
gcc -c main.c
prog: lib.o main.o
gcc -o prog lib.o main.ohere, when you run
make prog, make will first check wether lib.o needs updating. maybe it wasn't updated manually, but it is a job in make, and that job also gets checked. if the c file was modified, then lib.o will be regenerated, otherwise, it won't. then, make will do the same with main.o (and main.c).if any of them was updated, then prog will run its own tasks, and produce the prog binary, and otherwise, will just tell you there's nothing to do.
-
i should probably learn how makefiles work some day
@eniko They're nice when you want more than a shell one-liner but don't want a fancy build system. (I basically never want a fancy build system.)|
-
@eniko it's a bit abstract, so it's easier with an example: you have a makefile with three jobs, two for two c files, lib.o and main.o, which depend respectively on lib.c and main.c, and one that will link the two together into an executable (say, prog)
lib.o: lib.c
gcc -c lib.c
main.o: main.c
gcc -c main.c
prog: lib.o main.o
gcc -o prog lib.o main.ohere, when you run
make prog, make will first check wether lib.o needs updating. maybe it wasn't updated manually, but it is a job in make, and that job also gets checked. if the c file was modified, then lib.o will be regenerated, otherwise, it won't. then, make will do the same with main.o (and main.c).if any of them was updated, then prog will run its own tasks, and produce the prog binary, and otherwise, will just tell you there's nothing to do.
@eniko make also has some niceties to handle configurability of the build, and to reduce boilerplate, but those are just for that, reducing boilerplate, and aren't fundamentally necessary to how make works. a fair few systems will also just generate makefiles or ninja files (which are basically the same but stripped down, which can improve compile performance for large projects) because configurability in make is generally a mess, and is done more easily with an external tool, like meson or cmake or autoconf
-
@eniko make also has some niceties to handle configurability of the build, and to reduce boilerplate, but those are just for that, reducing boilerplate, and aren't fundamentally necessary to how make works. a fair few systems will also just generate makefiles or ninja files (which are basically the same but stripped down, which can improve compile performance for large projects) because configurability in make is generally a mess, and is done more easily with an external tool, like meson or cmake or autoconf
@eniko people really make it to be more complex than it really is, but honestly the parts that are hardest to deal with are the configurability and boilerplate reduction parts, which ... yeah, messy is the nicest way i can describe them
-
@eniko A few months ago I wouldβve said βdonβt, itβs not worth it.β
But I love using them as basically shell scripts. Theyβre really flexible and a good universal tool for building simple projects in any language.
Anything more complexβ¦. nah, I reach for a more modern build tool.
-
i should probably learn how makefiles work some day
Wait. Is cmake make? Or are they different things
-
Wait. Is cmake make? Or are they different things
@eniko completely different, but cmake can generate make files.