Initial commit

This commit is contained in:
Corentin 2020-11-13 21:00:02 +09:00
commit 1571f570bf
6 changed files with 281 additions and 0 deletions

53
README.md Normal file
View file

@ -0,0 +1,53 @@
# µmake
µmake is a small python script to easily and quickly compile small or medium-sized C/C++ projects. It is very light and designed to be modified to adapt to specific usage.
The advantages of this tool are :
* recursive search of all header/source files in their respective directories (like makefile wildcards)
* multiple binary output made easy (`app1` will be linked from `app1.cpp`, etc, without conflicts)
* hash system to avoid time check issues (same file content, remote files problems, etc)
## Use
This repository is meant to be used as a submodule of a C/C++ project.
* Use `git submodule add` to include this tool anywhere in your project.
* Copy `makefile` and `make.py` templates in your project root folder.
* Update `UMAKE_PATH` in the copied `makefile` with the path to this submodule.
* In `make.py` update the `Config` template with the desired flags and options.
By default 3 targets can be used `make` (or `make all` as usual default of makefiles), `make debug` and `make clean`.
**Be careful** : `clean` will delete the object and binary output directories defined in `make.py`.
## How it works
### Project layout
µmake expects all the header and source files to be place in a directories specified in the configuration (in `make.py`).
Object files and final binaries are outputed also in directories specified in the configuration but objects files in `debug` and `release` (default) are separated.
The separation of objects files is meant to switch mode quickly (only binaries are rebuilt).
To determine if a source file needs to be recompiled an hash is saved. The hashed are saved in a JSON file at the root of the object files directory (there are in fact 2 seperate files respectively in `debug` oand `release`).
If any header file changes every source files will be recompiled to avoid any issue (hence the small or medium-size project target for this tool). This could be address in the future if needed.
### Caveats
* Header files dependencies is not implemented (any change triggers all compilation)
* Knowing python is recommended to understand the tool for any usage above configuration change.
* Targets management is not yet implemented (building all binaries), this can be easily address knowing python. A generic solution should be possible in the future.
* Template configuration is meant for C++ files (cpp/hpp) for now.