Skip to content

A simple makefile template to get your C and C++ projects up and running fast!

License

Notifications You must be signed in to change notification settings

reyncode/boilerplate-makefile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boilerplate Makefile

A simple Makefile for medium to large projects that supports resolution of 3rd party dependencies.

Requirements

Linux

Installation commands are relative to your distributions package repository. Ubuntu for example would require sudo apt install pkgconf.

  • GNU Make
  • GCC or Clang
  • pkg-config or pkgconf (optional)
    • This would be required if you were using 3rd party libraries in your code such as the ncurses development libraries.

Windows

You will need to replace the usage of make with mingw32-make. The work around is to alias mingw32-make as make in your .bashrc (or similar) file.

Usage

To use this template, run make (mingw32-make on Windows) in the same directory as the Makefile. This will compile, link and resolve the project dependencies (if there are any) and output your named executable in the bin directory.

Simple Directory Structure

Right out of the box this Makefile supports a src, bin layout structure but it can be easily modified if you prefer to keep your header files separate or use a different structure.

bin
└ my-project-executable
src
├ main.c
├ my_lib.h
└ my_lib.c