THE definitive makefile for simple c++ projects, without scassamento di maroni!
This simple makefile compiles all your c++ projects automatically.
It looks recursively into the folder tree for headers and sources.
It constructs the dependency rules, compiles them and links the main code in the base directory.
Basic usage:
- Place the Makefile in the same folder as the
main.cppfile. - Edit the location of the dependency files (default is
SRC_DIRS = .) - Edit executable name, compiler flags and the like (optional)
- Run
make all
Other commands:
makeshows a default help message;make arlinks all sources into a static library (default islib.a) and collects all headers into theincludefolder;make cleanremoves all object files, dependency files, archive and executable.
This project runs on unix systems.
It requires a version of the g++ compiler supporting the -MMD flags and uses gcc-ar for generating the archive.