Update README.md
This commit is contained in:
50
README.md
50
README.md
@@ -1,25 +1,37 @@
|
|||||||
**makemake** is a pure POSIX-compliant (`.POSIX`), multi-threaded build template for C projects. It utilizes a dynamic build graph generator, requires zero GNU or BSD extensions, and runs natively on any standard UNIX shell (`/bin/sh`).
|
**Basic Overview**
|
||||||
|
This is a lightweight/dependency free C build system built entirely around standard POSIX tools. It introduces a python style virtual environment for your C projects using a simple shell script. It tracks your compiler, linker flags, and build options in a local state file without needing cmake or other heavy build generators.
|
||||||
|
|
||||||
**Quick Start**
|
**Example Use**
|
||||||
|
To get started with a fresh project create your directory and run the initialization command.
|
||||||
|
|
||||||
* Place `.c` files in `source_code/` and `.h` files in `includes/`.
|
make init
|
||||||
* Run `make init` once to bootstrap the project layout.
|
|
||||||
* Run `make -j8 debug` to compile incrementally and in parallel.
|
|
||||||
|
|
||||||
**Make Targets**
|
Next activate your virtual environment by sourcing the configuration script into your current shell session.
|
||||||
|
|
||||||
| Target | Description |
|
. config/activate (or source config/activate) the former is simply POSIX compliant.
|
||||||
| --- | --- |
|
|
||||||
| `make` / `make help` | Prints basic usage instructions and target overviews. |
|
|
||||||
| `make init` | Creates required project directories (`source_code`, `includes`, `output`, `config`) and starter templates. |
|
|
||||||
| `make debug` | Dynamically builds a parallel-safe dependency graph and compiles using `DEBUG_FLAGS` (`-g3`, `-O0`, UBSan). |
|
|
||||||
| `make fast` | Compiles an optimized release build using `RELEASE_FLAGS` (`-O2`, `-s`, `NDEBUG`) without modifying the version string. |
|
|
||||||
| `make release` | Bumps the version using an automated timestamp (`_YY.DAY.HH.MMSS`) and compiles an optimized release binary. |
|
|
||||||
| `make clean` | Wipes the `output/` directory and temporary build scripts inside `config/`. |
|
|
||||||
|
|
||||||
**Customization Guide**
|
Once you are inside the environment you can run your builds and clean up whenever you want.
|
||||||
|
|
||||||
* **How to change the compiler:** Edit the `CC = gcc` variable at the top of the file to use `clang` or other compilers.
|
`make debug`
|
||||||
* **How to change the C standard being used:** Locate `CFLAGS` and modify `-std=c17` to your preferred standard (e.g., `-std=c11`, `-std=c99`) etc.
|
`make build`
|
||||||
* **Modifying Warning Strictness:** Add, or remove specific flags within the `CFLAGS` block. Removing `-Werror` will allow compilation to continue past warnings.
|
`make release`
|
||||||
* **Linking External Libraries (e.g., Raylib):** Locate the `debug`, `fast`, and `release` targets in the Makefile. Find the final linking step (`$(CC) $(CFLAGS) ... -o $$OUT $$OBJS`) and append your static library paths or system link flags (e.g., `-lraylib -lGL -lm -lpthread -ldl -lrt -lX11`).
|
`make clean`
|
||||||
|
|
||||||
|
**What Each Build Target Does**
|
||||||
|
|
||||||
|
* init sets up the required folder structure and generates the activation script
|
||||||
|
* debug compiles your code with debug symbols enabled and optimization turned off
|
||||||
|
* build compiles your code for regular development use using your custom flags
|
||||||
|
* release updates the internal version timestamp and compiles an optimized production binary
|
||||||
|
* clean removes all intermediate object files and generated makefiles
|
||||||
|
|
||||||
|
**Example env_set Commands**
|
||||||
|
You can adjust your toolchain and compiler options dynamically using the `env_set` function while the environment is active.
|
||||||
|
Example uses:
|
||||||
|
```
|
||||||
|
env_set CC cc
|
||||||
|
env_set CFLAGS -std=c17 -pedantic -Wall -Wextra
|
||||||
|
env_set DEBUG_FLAGS -g3 -O0
|
||||||
|
env_set RELEASE_FLAGS -O2 -DNDEBUG
|
||||||
|
env_set LIBS -lm
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user