Note:
- The current version is tailored for C projects.
- A C++ version is not in development yet.
Just follow these straightforward steps:
-
Learn about GNU Make 📚: If you're not familiar with the ins and outs of GNU Make, take a moment to acquaint yourself with its wonders. A quick skim through the documentation should do the trick.
-
Fetch the Makefile 💾: Secure your very own copy of Makefile by downloading it to your local directory. Simply use the following
wget
command:wget "https://github.com/raw/tesla33io/awesome_makefile/main/Makefile"
-
Customize as needed ✒️: Open the Makefile in your preferred text editor and make any necessary adjustments. Be sure to fill in any empty variables to tailor it to your specific needs.
-
Initiate the Magic 🧙♂️: Now it's time to put Makefile to work! Execute the following command in your terminal:
make
Watch as your code transforms like magic ✨, thanks to the power of make.
Default: clang
Default:
-Wall: Enable all compiler warnings
-Werror: Treat all warnings as errors
-Wextra: Enable extra compiler warnings
-pedantic: Issue all the warnings demanded by strict ISO C and ISO C++
-O3: Optimize code for speed
If DEBUG
environmental variable exists with value 1
next flags added to CFLAGS
:
-g3: Enables maximum debug information generation for advanced debugging capabilities
-O0: Disables all optimization, maintaining a one-to-one correspondence between source code and machine instructions for easier debugging
Default: -Iinc/
Default: src/
Default: SRC_FILES += main.c
Note
Use += to append additional source files
Default: obj/
Note
List of object files generated from list of source files by replacing .c
with .o
Default: dep/
Note
List of dependencies generated from list of objects in similar way.
-include $(DEPENDS)
- good explanation
Default: all