A simple and convenient build-and-run system for C and C++.
Project description
smake
Smake is a simple and convenient build-and-run system for C and C++ projects.
Why make another build system?
CMake and GNU Make are great build systems. However, as the project gets larger, and as there are increasingly many types of builds (e.g. a builds for debugging), it becomes tedious to add duplicate code.
Smake solves this problem with its target-mode-build hierarchy. In this system, every project has a set of targets, and each target has a set of build modes. When smake is run on a target with a specific build mode, it will run the build corresponding to that mode.
Each mode also has a post-build script that can be run. For most builds, this will
simply be executing the target object file, but in some cases, the user may want
to run a different command (i.e. gdb
or valgrind
) with the object file.
Install
Smake can be installed easily with pip install smake
.
One can also simply clone the source and link the smake
executable.
How does it work?
Smake searches for a smake.yaml
file in the current directory and creates configurations for each target, including all modes and their
corresponding builds and post-build scripts, etc.
The structure of an smake
configuration file is as follows (in no strict
order):
# Variables that can be referenced in builds
definitions:
- gsourceA: fileA.c, fileB.c
# List of builds that will be used by the targets
builds:
- buildA:
- sources: gsourceA # Reference a group of sources defined
# in the sources section
- buildB:
- sources: main.c # Sources can be specified in the build as well
- flags: -Wall, -Wextra # Flags are specified here, can be comma
# separated or specified as a list
- buildC:
- sources: main.c
- flags: -Wall, -Wextra, -g
# List of all targets
targets:
- targetA:
- modes: default # Specifiy modes here (default mode does
# not really need to be specified)
- builds:
- default: buildA # Must specify builds as a pair of `mode: build`
# Note that post-build scripts do not need to be specified:
# if nothing is specified, then there is no post-build script
- targetB:
- modes: default, debug # Comma separated modes
- builds: # Modes are selected using the -m option of smake
- default: buildB # for example: smake targetB -m debug
- debug: buildC # the default mode is used if no mode is specified
- postbuild: # Post-build scripts, specified per mode (optional)
- debug: 'gdb {}' # The {} is replaced by the target object file
This configuration allows for the following commands:
$ smake targetA
$ smake targetB
$ smake targetB -m debug
As one can imagine, this build system is quite simple, yet powerful.
Another example of smake
file can be found inside the example
directory.
Clone this repository and run smake
to get started (available targets are
smake basic
and smake multisource
).
Future features
- Pre-build scripts, for cases where source code needs to be auto-generated
- Add options for parallelizing builds
- Easier way to define macro arguments for the compilers
- Detect changes in included headers, and the config in general
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file smake-1.2.6.tar.gz
.
File metadata
- Download URL: smake-1.2.6.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77ab077686f03d409c11e3fecef311e362202c7fda5817abc849b0a2088ada54 |
|
MD5 | f53738a7e138f0cda6f6bda98aa43131 |
|
BLAKE2b-256 | 5a1f6b0f9d282e68c2c36db7eb726c518fb02882fe67d3008010501e3f92abb9 |
File details
Details for the file smake-1.2.6-py3-none-any.whl
.
File metadata
- Download URL: smake-1.2.6-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 499d110453b8cc4359c144fcf12b4d594e274252ec226c69088d026b8addc675 |
|
MD5 | fc42bbd62acff1a36a823617d7d1de52 |
|
BLAKE2b-256 | 7c4ec7ca202a185588014919e22674075360b977ebe399acf483540a672d3417 |