A simple and convenient build-and-run system for C and C++.

Overview

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.

pictures/smake.png

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
You might also like...
A python script to run any executable and pass test cases to it's stdin and compare stdout with correct output.

quera_testcase_checker A python script to run any executable and pass test cases to it's stdin and compare stdout with correct output. proper way to u

Run python scripts and pass data between multiple python and node processes using this npm module

Run python scripts and pass data between multiple python and node processes using this npm module. process-communication has a event based architecture for interacting with python data and errors inside nodejs.

This is a multi-app executor that it used when we have some different task in a our applications and want to run them at the same time

This is a multi-app executor that it used when we have some different task in a our applications and want to run them at the same time. It uses SQLAlchemy for ORM and Alembic for database migrations.

Exercise to teach a newcomer to the CLSP grid to set up their environment and run jobs

Exercise to teach a newcomer to the CLSP grid to set up their environment and run jobs

Nuclei - Burp Extension allows to run nuclei scanner directly from burp and transforms json results into the issues
Nuclei - Burp Extension allows to run nuclei scanner directly from burp and transforms json results into the issues

Nuclei - Burp Extension Simple extension that allows to run nuclei scanner directly from burp and transforms json results into the issues. Installatio

Run-Your-Own Firefox Sync Server

Run-Your-Own Firefox Sync Server This is an all-in-one package for running a self-hosted Firefox Sync server. It bundles the "tokenserver" project for

Run unpatched binaries on Nix/NixOS

Run unpatched binaries on Nix/NixOS

Run Python code right in your Telegram messages
Run Python code right in your Telegram messages

Run Python code right in your Telegram messages Made with Telethon library, TGPy is a tool for evaluating expressions and Telegram API scripts. Instal

This repo is for scripts to run various clients at the merge f2f

merge-f2f This repo is for scripts to run various clients at the merge f2f. Tested with Lighthouse! Tested with Geth! General dependecies sudo apt-get

Comments
  • Smake vs CMake?

    Smake vs CMake?

    You realize everything you are doing with smake can be done with -D CMAKE_BUILD_TYPE=Release right? or =Debug. And there's Ninja Multi-config too. Your cmakelists shouldn't specify compiler flags.

    opened by arnavkartikeya 0
Releases(v1.2.0)
  • v1.2.0(Jan 2, 2022)

    Features

    • More flexible libraries (i.e. adding -pthread to the list will not be overriden as -l-pthread)
    • Generating compile_commands.json file for clangd

    Install

    pip install smake or clone the executable from the source.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(Dec 9, 2021)

    Features

    • Parallelizing builds: set number of threads with smake -j [threads]
    • New section installs for specifying install processes (using smake --install [install-target]): these targes are not the same as those specified in targets
    • New section ldirs for specifying libraries directories (which are specified to the compiler with the -L flag)
    • Refactoring includes directory to idirs
    • Updated recompilation check which uses the modification dates of all header dependencies (this is the reason for the slight delay in the smake command)

    Install

    pip install smake or clone the executable from the source.

    Source code(tar.gz)
    Source code(zip)
    smake(21.13 KB)
  • v1.0.1(Dec 7, 2021)

    Fixes

    • Removed recursive config searching, takes too long on very large directories
    • Added error handling for missing builds and targets specifications
    • Refactored variable definition section from sources to definitions, and fixed related bugs to proper substitution

    Install

    pip install smake or clone the executable from the source.

    Source code(tar.gz)
    Source code(zip)
  • v1.0.0(Dec 7, 2021)

    Features

    • Recursive build-and-run system
    • Easy build and target specification
    • Post-build scripts, useful for build-and-run or build-and-debug workflows

    Install

    pip install smake or clone the executable from the source.

    Source code(tar.gz)
    Source code(zip)
    smake(13.55 KB)
Owner
Venkataram Edavamadathil Sivaram
Venkataram Edavamadathil Sivaram
Yet another basic python package.

ironmelts A basic python package. Easy to use. Minimum requirements. Installing Linux python3 -m pip install -U ironmelts macOS python3 -m pip install

IRONMELTS 1 Oct 26, 2021
Official repository for the BPF Performance Tools book

BPF Performance Tools This is the official repository of BPF (eBPF) tools from the book BPF Performance Tools: Linux and Application Observability. Th

Brendan Gregg 1.2k Dec 28, 2022
Assembly example for CadQuery

Spindle and vacuum attachment This is a model of the vacuum attachment for my Workbee CNC router. There is a mist spray coming from the left hand side

Marcus Boyd 20 Sep 16, 2022
Research on how Gboard Stickers work.

Google-Sticker-Mashup-Research Research on how Gboard Stickers work. Contribute Contributing is nice, and you will be listed below for contributing. C

Jeremiah 45 Oct 28, 2022
Repository voor verhalen over de woningbouw-opgave in Nederland

Analyse plancapaciteit woningen In deze notebook zetten we cijfers op een rij om de woningbouwplannen van Nederlandse gemeenten in kaart te kunnen bre

Follow the Money 10 Jun 30, 2022
LOC-FLOW is an “hands-free” earthquake location workflow to process continuous seismic records

LOC-FLOW is an “hands-free” earthquake location workflow to process continuous seismic records: from raw waveforms to well located earthquakes with magnitude calculations. The package assembles sever

Miao Zhang 71 Jan 09, 2023
A Regex based linter tool that works for any language and works exclusively with custom linting rules.

renag Documentation Available Here Short for Regex (re) Nag (like "one who complains"). Now also PEGs (Parsing Expression Grammars) compatible with py

Ryan Peach 12 Oct 20, 2022
Taxonomy addition for complete trees

TACT: Taxonomic Addition for Complete Trees TACT is a Python app for stochastic polytomy resolution. It uses birth-death-sampling estimators across an

Jonathan Chang 3 Jun 07, 2022
Standard mutable string (character array) implementation for Python.

chararray A standard mutable character array implementation for Python.

Tushar Sadhwani 3 Dec 18, 2021
RxPY - The Reactive Extensions for Python (RxPY)

The Reactive Extensions for Python (RxPY) A library for composing asynchronous and event-based programs using observable collections and query operato

ReactiveX 4.4k Dec 29, 2022
Created a Python Keylogger script.

Python Script Simple Keylogger Script WHAT IS IT? Created a Python Keylogger script. HOW IT WORKS Once the script has been executed, it will automatic

AC 0 Dec 12, 2021
Workshop OOP - Workshop OOP - Discover object-oriented programming

About: This is an open-source bot, the code is open for anyone to see, fork and

Francis Clairicia-Rose-Claire-Joséphine 5 May 02, 2022
Tips that improve your life in one way or another

Tips that improve your life in one way or another. This software downloads life tips from reddit.com/r/LifeProTips and tweet the most upvoted tips on Twitter.

Burak Tokman 2 Aug 04, 2022
Python Create Your Own Tool Series

Python Create Your Own Tool Series Hey there! This is an additional Github repository that contains the final product files for each video in my Youtu

Joe Helle 21 Dec 02, 2022
Clear merged pull requests ref (branch) on GitHub

GitHub PR Cleansing This tool is used to clear merged pull requests ref (branch) on GitHub. GitHub has no feature to auto delete branches on pull requ

Andi N. Dirgantara 12 Apr 19, 2022
decorator

Decorators for Humans The goal of the decorator module is to make it easy to define signature-preserving function decorators and decorator factories.

Michele Simionato 734 Dec 30, 2022
Syntax highlighting for yarn.lock and bun.lockb files

Yarn.lock Syntax Highlighting Syntax highlighting for yarn.lock and bun.lockb files Installation Plugin is not publushed yet on Package Control, to in

Alexander Kuznetsov 4 Jul 06, 2022
msgqywx 使用企业微信的应用消息推送实时信息

msgqywx 使用企业微信的应用消息推送实时信息

Demon Finch 8 Dec 18, 2022
High-level bindings to the Valhalla framework.

Valhalla for Python This spin-off project simply offers improved Python bindings to the fantastic Valhalla project. Installation pip install valhalla

GIS • OPS 20 Dec 13, 2022
A python script that will automate the boring task of login to the captive portal again and again

A python script that will automate the boring task of login to the captive portal again and again

Rakib Hasan 2 Feb 09, 2022