1 Overview

Rscons is an open-source build system for developers. It supports the following features:

At its core, Rscons is mainly an engine to:

Along the way, Rscons provides a concise syntax for specifying common types of build steps, but also provides an extensible framework for performing custom build operations as well.

Rscons takes inspiration from:

Rscons is written in Ruby. The only requirement to run Rscons is that the system has a Ruby interpreter installed.

1.1 Design Principles

1.1.1 Build Correctness

The number one design principle in Rscons is build correctness. This means that a target will be built when Rscons cannot determine that a build target is already up-to-date. A build target will be built whenever:

Importantly, Rscons uses the content of a source (dependency) file to determine whether a rebuild is necessary, not simply the timestamp of the file. This is because relying solely on the timestamp of the file can lead to an incorrect decision being made to not rebuild when a rebuild is necessary.

1.1.2 Build Flexibility

Rscons supports multiple configurations of compilation flags or build options across multiple environments or build variants to build output files in different ways according to the user's desire. For example, the same source files can be built into a release executable, but also compiled with different compilation flags or build options into a test executable. Rscons also supports build hooks, which allow the user to further fine-tune the build system's operation. A build hook, for example, can be used to set a build option for only source files coming from a particular source directory.

1.1.3 Build Efficiency

Rscons will automatically determine the number of threads to use based on the host CPU configuration, and will schedule jobs as efficiently as possible across the available threads in order to complete the build in as little time as possible. As development occurs and builders are executed, Rscons makes use of a cache file in order to avoid rebuilding a target when it is already up to date.

1.1.4 Build Directory

Rscons was designed to store temporary build artifacts (for example, object files, dependency files, etc...) and build system metadata in a "build directory". This keeps files generated by the build cleanly separated from user-controlled source files.

In contrast to other build systems or build system generators, rscons executes from the project base directory (up to the user) rather than executing from within the build directory. This keeps any file paths printed by compilers (such as in warning or error messages) accurate relative to the project directory, so that the user does not need to translate any paths to the correct path within a terminal or editor application, for example.

By default a build directory named "build" is used, but this can be overridden by the user by using the -b/--build command-line option.

1.2 Getting Started

To use Rscons on your project, you must:

  1. Install the rscons script in your project (See Installation).
  2. Write the Rsconscript build script for your project (See The Build Script).
  3. Use the rscons command in your project (See Command-Line Operation).