Makefiles
Last updated: 1/9/2025
But writing the lines to compile all of my source files takes so long 😩 Makefile has got you covered 😎
Basically, it is a way to "make" your project based on seeing which files are older/newer than other files. It uses rules like this:


Since Makefile is a programming language, you can use variables to simplify things!

But the power of makefiles do not end here!
You can make phony targets (using .PHONY) in order to use make to type out and keep track of long-ass commands for you:

Here are some cool variables:

./src/%.cc: ./includes/%.cc %@Which will mark all of the source files as modified whenever you change any of the headers, which is SUPER useful for keeping everything up-to-date
See Also
- compilation-and-execution-in-c
- [[computer-science]]