mkgen is a lightweight Makefile generator designed for my everyday C and C++ workflow.
I often start with a small C or C++ file. Then it grows. Suddenly there are multiple .c / .cpp files, header files, and sometimes a graphical library involved. At that point, compiling manually or rewriting a Makefile becomes repetitive and annoying.
So I built mkgen.
It’s written in Python and focuses on C and C++ projects, with optional support for graphical libraries when needed.
- I like coding in C and C++
- Small projects tend to grow faster than expected
- Writing Makefiles over and over is tiring
- Linking multiple source files and libraries manually is error‑prone
mkgen automates the boring part so I can focus on writing code.
- Automatically generates a Makefile for C and C++ projects
- Detects multiple source files and header files
- Supports both C and C++ compilation
- Designed to scale from tiny projects to larger ones
- Optional / conditional support for graphical libraries
- Simple and minimal by design
- Start a small C or C++ project
- Add more
.c/.cppfiles over time - Add headers, maybe a graphical library
- Run
mkgen generate - Get a ready‑to‑use Makefile after the interactive menu
No manual compilation. No rewriting Makefiles.
mkgen is not meant to replace advanced build systems like CMake or Meson.
It is meant to be:
- Simple
- Fast
- Opinionated toward C/C++
- Easy to understand and modify
It exists because I needed it.
- Python 3.x
- A C compiler (
gcc,clang, etc.) - or a C++ compiler (
g++,clang++)
- Clone the repository:
git clone https://github.com/gtRZync/mkgen.gitcd mkgen- Install globally for convenience:
pip install .- You're finally ready to generate your Makefiles on the go :
mkgen generateor
mkgen generate <system>or even
mkgen generate --cross-platform- Follow the interactive menu and boom a Makefile will appear at the specified output path or current working directory
| Argument | Description | Default |
|---|---|---|
target_system |
Specify the system/OS for which the Makefile should be generated (e.g., linux, windows, macos). --cross-platform. |
Current system/OS |
| Argument | Description | Default |
|---|---|---|
--cross-platform |
Generate a Makefile that works across multiple systems. target_system. |
Disabled |
-l, --lang |
Specify the programming language to use. Supported: C or C++. |
None |
-c, --compiler |
Specify the compiler to use. This value will be written into the generated Makefile. | None |
-std, --standard |
Specify the language standard to use (e.g., c11, c17, c++11, c++17, c++20). Added to compiler flags in the Makefile. | None |
--use-gui-lib |
Include GUI library flags in compilation. Supported libs: SDL2, SFML, RAYLIB. |
Disabled |
-o, --output |
Specify the output directory for the Makefile. Defaults to current working directory if path is invalid. | ./ |
--binary-name |
Specify the name of the output binary/executable. The Makefile will use this name for the compiled program. | None |
mkgen generatemkgen generate linuxmkgen generate linux --lang C++ -c clang++ -std c++17 --use-gui-lib -o ./build --binary-name my_appmkgen generate --cross-platform --lang CThis is a personal tool built for real projects. Features may evolve as my workflow evolves.
