This project provides a custom Makefile build system for C and C++ projects. It offers developers a flexible and efficient solution for compiling and managing their source code. The build system supports various commands that facilitate different stages of the development process, including building the project, generating a release version, and cleaning the build folders.
To use this project, follow the steps below:
- Clone the repository:
git clone https://github.com/m1ad3n/make-template.git
- Change to the project's directory:
cd make-template
- Clone only the Makefile
curl https://raw.githubusercontent.com/m1ad3n/make-template/master/Makefile > Makefile
Before using this project, make sure you have the following dependencies installed:
gcc
: The GNU Compiler Collection, required for compiling the C and C++ source code.make
: A build automation tool used to compile and manage the project using the Makefile.findutils
: A collection of utilities used to search for files and directories. It is often pre-installed on Unix-like systems.
Make sure you have these dependencies installed on your system before proceeding with the usage of this project.
To build and run the project, make sure you have the necessary dependencies installed. Then, follow the steps below:
-
Open a terminal and navigate to the project's directory.
-
Execute the
make
command to build the project:
make
- Execute the generated executable:
./target/debug/project
To build the release version of the project, execute the following command:
make release
- Execute the generated release executable:
./target/release/project
Make sure to replace project
with the actual name of the directory
To build shared library from your source code run:
make library
This will generate target/lib/lib{project}.so
- {project}: Name of the project directory
To install release binaries, header files and shared library run:
make install
The following commands are available for the Makefile build system:
make
: Builds the project.make release
: Builds the release version of the project.make library
: Compiles object files into one single shared librarymake install
: Installs release binary, header files and shared librarysmake clean
: Cleans the target folder, removing all generated object files and executables.
Additionally, the Makefile includes various forms of clean functions such as:
make clean-rel
: Delete only the release foldermake clean-deb
: Delete only the debug foldermake clean-lib
: Delete only the lib folder
Feel free to modify the Makefile to suit your specific project needs.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the project's GitHub repository.
This project is licensed under the MIT License. You are free to modify and distribute this project as per the license terms.