Giter VIP home page Giter VIP logo

makefile_c_cpp's Introduction

OS OS Status

MAKEFILE C/C++

Makefile template for small to medium sized C/C++ projects, for Linux and Windows.

You can build the project in two modes : Release or Debug.

By default, the build is in Debug mode.

Declare all the source files you want to compile in the src/__sources.mk.

Please follow recommended project layout.


Table of Contents


PROJECT LAYOUT

To use this makefile template properly, please follow the project layout bellow.

──┬─[ Project ]
  │
  ├──── Makefile
  ├──── README.md
  ├──── LICENSE.md
  │
  ├──┬─[ src ]
  │  ├──── __sources.mk   # Important: declare in that file all the source files to compile
  │  │
  │  ├──── main.c / main.cpp
  │  ├──── *.c / *.cpp
  │  ├──── *.h / *.hpp
  │  │
  │  ├──┬─[ module ]
  │  │  ├──── *.c / *.cpp
  │  │  └──── *.h / *.hpp
  │  └...
  │
  └...

Note that this layout of the src directory, including __sources.mk is automatically created when execution the command :

make init

INSTALLATION

Clone this repository :

git clone https://github.com/RaphaelCausse/Makefile_C_Cpp.git

Move to the cloned directory :

cd Makefile_C_Cpp

Copy the Makefile in your project at root level of your project directory.

cp Makefile <path_to_your_project>
cd <path_to_your_project>

Initialize the project layout, in your project directory :

make init

USAGE

Update the src/__sources.mk file with the sources files to compile.

Update the Makefile for compiler and linker options, check the variables in the #### PATHS #### and #### COMPILER #### sections.

Build the project in Release mode :

make release

Build the project in Debug mode :

make debug

Run the program in Release mode (with optional arguments) :

make run
make run ARGS="your arguments"

Run the program in Debug mode (with optional arguments) :

make run_debug
make run_debug ARGS="your arguments"

FEATURES

Clean the project by removing objects files :

make clean

Display info about the project :

make info

Display help message:

make help

AUTHOR

Raphael CAUSSE.

makefile_c_cpp's People

Contributors

raphaelcausse avatar

Watchers

 avatar

Forkers

legjo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.