GenericMakefile

一个通用的makefile,用于小型/中型C和C++项目。「A generic makefile for use with small/medium C and C++ projects.」

  • 所有者: mbcrawfo/GenericMakefile
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

GenericMakefile

A generic makefile for use with small/medium C and C++ projects. Allows for
easy project setup without the need to create tedious build rules or
dependency lists. The c directory contains a makefile configured for C, while
the makefile in the cpp directory is configured for C++.

Features

  • Automatically finds and compiles all source files within the source directory.
  • Compiles most recently modified files first, to hopefully find problems earlier.
  • Automatically generates dependecies as files are compiled, ensuring that files are correctly recompiled when dependecies have updated.
  • Includes configurations for normal (release) build and debug build suitable for GDB debugging.
  • Times the compilation of each file and the entire build.
  • Generates version numbers based on git tags (see below), which are passed the compiler as preprocessor macros.
  • By default, builds in a "quiet" mode that only lists the actions being performed. By passing V=true to make, you can compile in verbose mode to see the full compiler commands being issued.

Versioning

Tags should be made in the format vMAJOR.MINOR.PATCH[-description], where MAJOR, MINOR, and PATCH are numeric. The following macros will be generated and passed to the preprocessor:

  • VERSION_MAJOR (int) - The major version number from the most recent tag.
  • VERSION_MINOR (int) - The minor version number from the most recent tag.
  • VERSION_PATCH (int) - The patch version number from the most recent tag.
  • VERSION_REVISION (int) - The number of commits since the most recent tag.
  • VERSION_HASH (string) - The SHA of the current commit. Includes the "-dirty" suffix if there are uncommited changes.

If the makefile is not used in a git repository, or is in a repository with no tags, the version macros are not created.

Limitations

  • Assumes GNU make.
  • Timing does not work correctly with MacOS. See issue #6 for a workaround patch that allows timing in seconds on Mac.
  • Doesn't really support multiple types of source files in the same project.
  • No easy way to exclude files from the build. You can either change the
    extension of files to be excluded, or use preprocessor flags for
    conditional compilation.

Thanks to

  • My friend Jay and people on Stack Overflow for help with regex to parse the version info.
  • The residents of /r/programming for suggesting numerous tweaks and improvements.

主要指标

概览
名称与所有者mbcrawfo/GenericMakefile
主编程语言Makefile
编程语言Makefile (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2014-03-27 03:11:19
推送于2020-10-04 04:22:30
最后一次提交2017-07-01 10:32:47
发布数0
用户参与
星数1.7k
关注者数71
派生数317
提交数35
已启用问题?
问题数13
打开的问题数2
拉请求数8
打开的拉请求数0
关闭的拉请求数3
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?