make init creates the filesystem. make or make all just builds. re deletes objs and recompiles. make clean deletes objs. standard stuff.
it recursively gets all the .c files in src/ and its child folders
same with .h files. puts .o files in obj/ and the resulting binary in build/
nobody should go through the pain of learning makefile, ever. its against nature.
so feel free to roast, rate, copy and paste
(cont.)
btw, see the sed part?
its to remove ./ at the beggining of each path because makefile, a program specialized in dealing with paths and files and such gets btfod by "./" in the relative path.
not the relative path itself, mind you. just the fricking "./"
makefile has 100% been written by a fricking autist
it's 2024 and Rake remains the undisputed GOAT of build systems
The entire Ruby ecosystem is like the ruins of an advanced civilization that was driven to extinction by the Sea Peoples (Node.js)
Firstly, it's all Ruby code - no half-baked DSL shat out by some sperg high on foot fungus
`task` is a function that declares a target, which in this case is for compressing a collection of text files. FileList is a Ruby class and you can look up documentation for its `ext` method using the `rdoc` CLI tool. ext replaces the file extension of its receiver. So it's defining the dependencies of the compress target.
`rule` is another function that defines how to derive .txt.gz files from .txt files. The stuff inside do ... end is a closure and t is the argument passed to the closure. It is an object with a bunch of methods, one of which is .source which returns the filename of the thing being operated upon. Basically, what that rule means is "whenever you have to convert a .txt file to a .txt.gz file, call this closure with the file as an argument".
You can split a Rakefile into any number of other Ruby scripts and with very large projects you can debug the entire build process with a real honest-to-god debugger.
If you aren't using NPM scripts to build all your code what are you doing? You can easily include any library with a simple 'npm install'. Wanna run a script? Easy! `npm run my-script`. A lot of time they even have little cute characters dancing in the command line to encourage your coding... Its 2024, write it in Javascript!
>make
>bash
They are 2 completely different things.
I can't believe you compare them.
>set -xe
they're now the same
Declarative vs imperative
most makefiles in the wild end up degenerating into unreadable undebuggable imperative demonware
to annoy you
also post your makefiles, im bored.
ill start:
NAME := sdl-test
CC := gcc
DDIR := build/
ODIR := obj/
IDIR := inc/
SDIR := src/
BUILD_DIRS := $(DDIR) $(ODIR) $(IDIR) $(SDIR)
SRCS := $(shell find $(SDIR) -name *.c | sed 's/^.///g')
OBJS := $(addsuffix .o, $(basename $(SRCS*~~
DEPS := $(shell find $(IDIR) -name *.h| sed 's/^.///g')
VPATH := %.o obj
FLAGS := -I $(IDIR) -O3
%.o: %.c $(DEPS)
@mkdir -p $(ODIR)$(dir $@)
$(CC) -c -o $(ODIR)$@ $< $(FLAGS)
all : clear_console _all
_all : message_build $(OBJS)
$(CC) -o $(NAME) $(addprefix $(ODIR), $(OBJS)) $(FLAGS)
mkdir -p $(DDIR)
mv $(NAME) $(DDIR)
clean : clear_console _clean
_clean :
@echo ---clearing objects
rm -f $(shell find $(ODIR) -name *.o)
re : clear_console _clean _all
message_build :
@echo ---building
clear_console: clear_destination
@clear
clear_destination:
@echo ---clearing destination
rm -f $(DDIR)*
init: clear_console
@echo ---initializing
mkdir -p $(BUILD_DIRS)
make init creates the filesystem. make or make all just builds. re deletes objs and recompiles. make clean deletes objs. standard stuff.
it recursively gets all the .c files in src/ and its child folders
same with .h files. puts .o files in obj/ and the resulting binary in build/
nobody should go through the pain of learning makefile, ever. its against nature.
so feel free to roast, rate, copy and paste
(cont.)
btw, see the sed part?
its to remove ./ at the beggining of each path because makefile, a program specialized in dealing with paths and files and such gets btfod by "./" in the relative path.
not the relative path itself, mind you. just the fricking "./"
makefile has 100% been written by a fricking autist
>not doing unity build
kys
file1: file2 file3
touch file1
vs
if ! test -e file1 || test file2 -nt file1 || test file3 -nt file1; then
touch file1
fi
nta but you can do functions
or you could write a build system with less autistic syntax and inbuilts in any other language
don't care and not interested in troony nonsense, find someone else
being a homosexual IS troony nonsense, frog
>build systems are useless
>uses bash, doesn't script with /bin/sh
You just outed yourself as a techlet.
>bash
>bin/sh
you sure?
it's 2024 and Rake remains the undisputed GOAT of build systems
The entire Ruby ecosystem is like the ruins of an advanced civilization that was driven to extinction by the Sea Peoples (Node.js)
what is "do |t|"?
scratch that
can you walk me through that code?
Firstly, it's all Ruby code - no half-baked DSL shat out by some sperg high on foot fungus
`task` is a function that declares a target, which in this case is for compressing a collection of text files. FileList is a Ruby class and you can look up documentation for its `ext` method using the `rdoc` CLI tool. ext replaces the file extension of its receiver. So it's defining the dependencies of the compress target.
`rule` is another function that defines how to derive .txt.gz files from .txt files. The stuff inside do ... end is a closure and t is the argument passed to the closure. It is an object with a bunch of methods, one of which is .source which returns the filename of the thing being operated upon. Basically, what that rule means is "whenever you have to convert a .txt file to a .txt.gz file, call this closure with the file as an argument".
You can split a Rakefile into any number of other Ruby scripts and with very large projects you can debug the entire build process with a real honest-to-god debugger.
It would take me time to absorb the new symbols, but that sounds impressive
bsd make is infinitely better
If you aren't using NPM scripts to build all your code what are you doing? You can easily include any library with a simple 'npm install'. Wanna run a script? Easy! `npm run my-script`. A lot of time they even have little cute characters dancing in the command line to encourage your coding... Its 2024, write it in Javascript!
https://gagor.pro/2024/02/how-i-stopped-worrying-and-loved-makefiles/
https://makefiletutorial.com/
>When I was invited for my first job interview in the IT, I’ve been asked such question
Frick off, Gurvinder.
>what is the point of compiling new software when a shell script can do what you want
moronic yet brilliant