r3make


Namer3make JSON
Version 2025.2.8 PyPI version JSON
download
home_pageNone
SummarySimple JSON-based CLI build tool for C!!!
upload_time2025-08-11 01:32:09
maintainerNone
docs_urlNone
authorr3shape
requires_python>=3.8
licenseMIT
keywords cli c build compiler json tool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # r3make

![PyPi Package version](https://img.shields.io/pypi/v/r3make?style=for-the-badge\&logo=pypi\&logoColor=white\&label=r3make\&labelColor=black\&color=white)

**r3make** is a minimal, fast, and readable JSON-based build tool for C projects. It handles basic compilation and linking tasks with zero setup complexity, making it ideal for small-to-medium codebases that don't need the overhead of tools like CMake.

---

## Features

* **Straightforward JSON Config** – All build logic lives in a clean, intuitive JSON file.
* **Multi-Target Support** – Define any number of build targets in a single file.
* **Flexible Output** – Supports building executables, shared libraries, and static libraries.
* **Cross-Compiler** – Works with GCC, Clang, Emscripten, and MSVC.
* **Cross-Platform (Work in Progress)** – Windows is fully supported, with Linux and macOS planned.
* **Optional `--run` Flag** – Automatically run the built executable target after compilation.

---

## Why r3make?

Makefile and CMake are powerful but overly complex for many use cases. `r3make` gives you:

* A single clean JSON file.
* No scripts or Makefile DSL.
* Easier cross-compilation setup.
* Simpler onboarding for contributors.

---

## Getting Started

### 1. Create a `r3make.json` file in your project root

A minimal example utilizing all config fields:

```json
{
    "MyApp": {
        "defines": ["MYAPP_BUILD"],
        "flags": ["-Wall", "-Werror", "-std=c99"],

        "includes": ["include"],
        "sources": ["src/*.c"],
        
        "libraries": {"gdi32": null, "SSDK": null},
        "gitdeps": ["r3shape/SSDK"],

        "name": "App",
        "type": "exe",
        "dest": "bin"
    }
}
```

## Building a Project

Run this from the directory containing `r3make.json`:

```bash
r3make --target MyApp
```

To run an executable immediately after building:

```bash
r3make --target MyApp --run
```
| <b>NOTE:  
| If the `name` field is not present in a r3make target, the target name is used.  
| r3make configuration files may have a target named "main", this is the default target when calling `r3make` with no `--target` flag. </b>

---

## Fetching Remote Libraries
Consider the following program:

```c
#include <include/SSDK/SSDK.h>

int main() {
    ssdkInitLog();
    saneLog->log(SANE_LOG_DUMP, "Hello, World!");
    ssdkExitLog();
    return 0;
}
```

The above code is using the [SSDK](https://github.com/r3shape/SSDK) library, but we have not installed [SSDK](https://github.com/r3shape/SSDK) ourselves.
We can let `r3make` take care of installation, updates, and linking with [SSDK](https://github.com/r3shape/SSDK) via our configuration:

```json
{
    "main": {
        "sources": ["main.c"],
        
        "libraries": {"SSDK": null},
        "gitdeps": ["r3shape/SSDK"],
        
        "name": "app",
        "type": "exe",
        "dest": "build"
    }
}
```

With the above configuration, we can use the following command to build, link, and run `app.exe`:

```bash
r3make -r
```

You should see a log similar to `[INFO] Added library 'SSDK' from r3shape/SSDK` in the stream of output from `r3make`, verifying the successful clone/update, and build of the remote dep.

| <b>NOTE:</b>  
| A [WARNING] log might appear when utilizing the `gitdeps` field, as an <b>elevated shell</b> is required for OS-default path manipulation, which is where remote deps are installed to.

---

## Target Configuration Fields

| Field       | Required | Description                                        |
| ----------- | -------- | -------------------------------------------------- |
| `sources`   | Yes      | List of glob patterns or file paths to `.c` files. |
| `type`      | Yes      | `exe`, `dll`, or `lib` (shared/static libraries).  |
| `dest`      | Yes      | Output directory for built files.                  |
| `name`      | No       | The name of the output artifact.                   |
| `flags`     | No       | Additional compiler flags.                         |
| `defines`   | No       | List of preprocessor defines.                      |
| `gitdeps`   | No       | List of remote linked libraries.                   |
| `includes`  | No       | List of include directories.                       |
| `libraries` | No       | Linked libraries, optionally with paths.           |

---

## CLI Flags
| Short Flag | Long Flag     | Description                                                                 |
| ---------- | ------------- | --------------------------------------------------------------------------- |
| `-t`       | `--target`    | Name of the target to build (e.g., `-t MyApp`). Required unless defaulting. |
| `-v`       | `--verbose`   | Enables verbose output (shows full commands and file list).                 |
| `-f`       | `--file`      | Path to the `r3make.json` config file (defaults to `r3make.json` in current dir).   |
| `-nf`      | `--nofiles`   | Disables file discovery; skips glob expansion (useful for debugging).       |
| `-be`      | `--buildeach` | Forces compilation of all sources individually, even if a library.          |
| `-r`       | `--run`       | Runs the target after a successful build (only works for `exe` targets).    |

---

## Installation

Install via pip:

```bash
pip install r3make
```

---

## Roadmap

* [ ] Incremental builds (skip unchanged files).
* [ ] Parallel compilation.
* [ ] Better error messages and diagnostics.
* [ ] Linux/macOS support.
* [✔️] Remote dependency fetching (`gitdeps` config field).

---

## Contributing

Issues and pull requests are welcome! If you find a bug, want to suggest a feature, or improve documentation, visit [github.com/r3shape/r3make](https://github.com/r3shape/r3make).

---

## License

MIT License. See [LICENSE](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "r3make",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "cli, c, build, compiler, json, tool",
    "author": "r3shape",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/67/5b/a9c7ad20356c6b9c00c60c36a527e77b01628a808232065ed4c87c7ad100/r3make-2025.2.8.tar.gz",
    "platform": null,
    "description": "# r3make\r\n\r\n![PyPi Package version](https://img.shields.io/pypi/v/r3make?style=for-the-badge\\&logo=pypi\\&logoColor=white\\&label=r3make\\&labelColor=black\\&color=white)\r\n\r\n**r3make** is a minimal, fast, and readable JSON-based build tool for C projects. It handles basic compilation and linking tasks with zero setup complexity, making it ideal for small-to-medium codebases that don't need the overhead of tools like CMake.\r\n\r\n---\r\n\r\n## Features\r\n\r\n* **Straightforward JSON Config** \u2013 All build logic lives in a clean, intuitive JSON file.\r\n* **Multi-Target Support** \u2013 Define any number of build targets in a single file.\r\n* **Flexible Output** \u2013 Supports building executables, shared libraries, and static libraries.\r\n* **Cross-Compiler** \u2013 Works with GCC, Clang, Emscripten, and MSVC.\r\n* **Cross-Platform (Work in Progress)** \u2013 Windows is fully supported, with Linux and macOS planned.\r\n* **Optional `--run` Flag** \u2013 Automatically run the built executable target after compilation.\r\n\r\n---\r\n\r\n## Why r3make?\r\n\r\nMakefile and CMake are powerful but overly complex for many use cases. `r3make` gives you:\r\n\r\n* A single clean JSON file.\r\n* No scripts or Makefile DSL.\r\n* Easier cross-compilation setup.\r\n* Simpler onboarding for contributors.\r\n\r\n---\r\n\r\n## Getting Started\r\n\r\n### 1. Create a `r3make.json` file in your project root\r\n\r\nA minimal example utilizing all config fields:\r\n\r\n```json\r\n{\r\n    \"MyApp\": {\r\n        \"defines\": [\"MYAPP_BUILD\"],\r\n        \"flags\": [\"-Wall\", \"-Werror\", \"-std=c99\"],\r\n\r\n        \"includes\": [\"include\"],\r\n        \"sources\": [\"src/*.c\"],\r\n        \r\n        \"libraries\": {\"gdi32\": null, \"SSDK\": null},\r\n        \"gitdeps\": [\"r3shape/SSDK\"],\r\n\r\n        \"name\": \"App\",\r\n        \"type\": \"exe\",\r\n        \"dest\": \"bin\"\r\n    }\r\n}\r\n```\r\n\r\n## Building a Project\r\n\r\nRun this from the directory containing `r3make.json`:\r\n\r\n```bash\r\nr3make --target MyApp\r\n```\r\n\r\nTo run an executable immediately after building:\r\n\r\n```bash\r\nr3make --target MyApp --run\r\n```\r\n| <b>NOTE:  \r\n| If the `name` field is not present in a r3make target, the target name is used.  \r\n| r3make configuration files may have a target named \"main\", this is the default target when calling `r3make` with no `--target` flag. </b>\r\n\r\n---\r\n\r\n## Fetching Remote Libraries\r\nConsider the following program:\r\n\r\n```c\r\n#include <include/SSDK/SSDK.h>\r\n\r\nint main() {\r\n    ssdkInitLog();\r\n    saneLog->log(SANE_LOG_DUMP, \"Hello, World!\");\r\n    ssdkExitLog();\r\n    return 0;\r\n}\r\n```\r\n\r\nThe above code is using the [SSDK](https://github.com/r3shape/SSDK) library, but we have not installed [SSDK](https://github.com/r3shape/SSDK) ourselves.\r\nWe can let `r3make` take care of installation, updates, and linking with [SSDK](https://github.com/r3shape/SSDK) via our configuration:\r\n\r\n```json\r\n{\r\n    \"main\": {\r\n        \"sources\": [\"main.c\"],\r\n        \r\n        \"libraries\": {\"SSDK\": null},\r\n        \"gitdeps\": [\"r3shape/SSDK\"],\r\n        \r\n        \"name\": \"app\",\r\n        \"type\": \"exe\",\r\n        \"dest\": \"build\"\r\n    }\r\n}\r\n```\r\n\r\nWith the above configuration, we can use the following command to build, link, and run `app.exe`:\r\n\r\n```bash\r\nr3make -r\r\n```\r\n\r\nYou should see a log similar to `[INFO] Added library 'SSDK' from r3shape/SSDK` in the stream of output from `r3make`, verifying the successful clone/update, and build of the remote dep.\r\n\r\n| <b>NOTE:</b>  \r\n| A [WARNING] log might appear when utilizing the `gitdeps` field, as an <b>elevated shell</b> is required for OS-default path manipulation, which is where remote deps are installed to.\r\n\r\n---\r\n\r\n## Target Configuration Fields\r\n\r\n| Field       | Required | Description                                        |\r\n| ----------- | -------- | -------------------------------------------------- |\r\n| `sources`   | Yes      | List of glob patterns or file paths to `.c` files. |\r\n| `type`      | Yes      | `exe`, `dll`, or `lib` (shared/static libraries).  |\r\n| `dest`      | Yes      | Output directory for built files.                  |\r\n| `name`      | No       | The name of the output artifact.                   |\r\n| `flags`     | No       | Additional compiler flags.                         |\r\n| `defines`   | No       | List of preprocessor defines.                      |\r\n| `gitdeps`   | No       | List of remote linked libraries.                   |\r\n| `includes`  | No       | List of include directories.                       |\r\n| `libraries` | No       | Linked libraries, optionally with paths.           |\r\n\r\n---\r\n\r\n## CLI Flags\r\n| Short Flag | Long Flag     | Description                                                                 |\r\n| ---------- | ------------- | --------------------------------------------------------------------------- |\r\n| `-t`       | `--target`    | Name of the target to build (e.g., `-t MyApp`). Required unless defaulting. |\r\n| `-v`       | `--verbose`   | Enables verbose output (shows full commands and file list).                 |\r\n| `-f`       | `--file`      | Path to the `r3make.json` config file (defaults to `r3make.json` in current dir).   |\r\n| `-nf`      | `--nofiles`   | Disables file discovery; skips glob expansion (useful for debugging).       |\r\n| `-be`      | `--buildeach` | Forces compilation of all sources individually, even if a library.          |\r\n| `-r`       | `--run`       | Runs the target after a successful build (only works for `exe` targets).    |\r\n\r\n---\r\n\r\n## Installation\r\n\r\nInstall via pip:\r\n\r\n```bash\r\npip install r3make\r\n```\r\n\r\n---\r\n\r\n## Roadmap\r\n\r\n* [ ] Incremental builds (skip unchanged files).\r\n* [ ] Parallel compilation.\r\n* [ ] Better error messages and diagnostics.\r\n* [ ] Linux/macOS support.\r\n* [\u2714\ufe0f] Remote dependency fetching (`gitdeps` config field).\r\n\r\n---\r\n\r\n## Contributing\r\n\r\nIssues and pull requests are welcome! If you find a bug, want to suggest a feature, or improve documentation, visit [github.com/r3shape/r3make](https://github.com/r3shape/r3make).\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT License. See [LICENSE](LICENSE).\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Simple JSON-based CLI build tool for C!!!",
    "version": "2025.2.8",
    "project_urls": null,
    "split_keywords": [
        "cli",
        " c",
        " build",
        " compiler",
        " json",
        " tool"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "95990cffe04f23e4d4f075649a26ebf9a6532b380adf404154a4598f2f43ca54",
                "md5": "c4c82d1686c43ce620e71e9f6b6c509a",
                "sha256": "5433a4ba5ef849ef9560d208738c9c327355b16d39ea7322e1bdcc62a0e9b2c9"
            },
            "downloads": -1,
            "filename": "r3make-2025.2.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c4c82d1686c43ce620e71e9f6b6c509a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10115,
            "upload_time": "2025-08-11T01:32:07",
            "upload_time_iso_8601": "2025-08-11T01:32:07.800586Z",
            "url": "https://files.pythonhosted.org/packages/95/99/0cffe04f23e4d4f075649a26ebf9a6532b380adf404154a4598f2f43ca54/r3make-2025.2.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "675ba9c7ad20356c6b9c00c60c36a527e77b01628a808232065ed4c87c7ad100",
                "md5": "5024568b114e9c0ab26b7ec44a06991e",
                "sha256": "fd6cd59be2cda943b53753a1203962a682730261cc8929f45f9bba3250c48b96"
            },
            "downloads": -1,
            "filename": "r3make-2025.2.8.tar.gz",
            "has_sig": false,
            "md5_digest": "5024568b114e9c0ab26b7ec44a06991e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10827,
            "upload_time": "2025-08-11T01:32:09",
            "upload_time_iso_8601": "2025-08-11T01:32:09.736709Z",
            "url": "https://files.pythonhosted.org/packages/67/5b/a9c7ad20356c6b9c00c60c36a527e77b01628a808232065ed4c87c7ad100/r3make-2025.2.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-11 01:32:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "r3make"
}
        
Elapsed time: 0.84917s