mkg is a CLI tool that generates GNU Make-based projects for C and C++.
This project is no longer maintained and will not receive further updates.
The reason is not technical, but conceptual:
A generic project generator is not a good abstraction for C/C++ ecosystems.
After building and using mkg, I concluded that:
- There is no single project structure that fits all scenarios
- Build systems, toolchains, and workflows vary significantly across projects
- Customization quickly becomes user-specific rather than general-purpose
- The real complexity lies after project creation, not in the boilerplate itself
Because of this, maintaining a general-purpose project generator does not provide enough value.
Instead of using a generator, a more practical approach is:
Maintain a small set of personal boilerplate repositories and reuse them.
For example, I created:
- https://github.com/cwchentw/c-boilerplate-application
- https://github.com/cwchentw/c-boilerplate-library
- https://github.com/cwchentw/cpp-boilerplate-application
- https://github.com/cwchentw/cpp-boilerplate-library
- https://github.com/cwchentw/objc-boilerplate-application
- https://github.com/cwchentw/objc-boilerplate-library
You can equally create your own boilerplates. It takes much less time than you might expect.
Although mkg is no longer maintained, this repository may still be useful if you are interested in:
- Designing a CLI tool
- Implementing a project generator
- Understanding why such tools often fail in practice
You can treat this repository as a reference implementation and a case study.
To use mkg-generated projects, you need:
- A C (or C++) compiler
- GNU Make
To compile mkg from source, you need:
- A Go compiler
Pre-compiled executables are available here: https://github.com/cwchentw/mkg/releases
Move the mkg executable to any directory in your system PATH.
Or install via Go:
go get github.com/cwchentw/mkg
Batch mode:
mkg [option] path/to/project
Interactive mode (recommended defaults):
mkg
Interactive mode (full customization):
mkg --custom
mkg generates projects using the system's default C/C++ compiler
(e.g. GCC, Clang, MSVC). You can override this via environment variables.
Example:
mkg myapp
Customized example:
mkg -cpp --library --flat mylib
Interactive mode:
mkg
(Interactive prompts omitted for brevity)
-v,--version-h,--help--licenses--standards
--program--author--brief--output--license
-c,-cpp--standard--console,--library--nested,--flat--force(dangerous)--custom
--source--include--dist--test--example
mkg was designed with the following goals:
- Simple: Use plain Makefiles instead of introducing another DSL
- Portable: Works across major desktop platforms
- Lightweight: No external runtime dependencies
It was inspired by tools like:
- Autotools
- CMake
- Bakefile
However, the conclusion of this project is that:
The problem is not the lack of tools, but the lack of a universal workflow.
Copyright (c) 2018–2020 Michelle Chen.
mkg is licensed under MIT.
Projects generated by mkg are not restricted and may use any license.