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
Singularity Containers on Apple M1 (ARM64)

Singularity Containers on Apple M1 (ARM64) This is a repository containing a ready-to-use environment for singularity in arm64 (M1). It has been prepa

Manuel Parra 4 Nov 14, 2022
Vita Specific Patches and Application for Doki Doki Literature Club (Steam Version) using Ren'Py PSVita

Doki-Doki-Literature-Club-Vita Vita Specific Patches and Application for Doki Doki Literature Club (Steam Version) using Ren'Py PSVita Contains: Modif

Jaylon Gowie 25 Dec 30, 2022
With Christmas and New Year ahead, it is time for some festive coding. Here is a Christmas Card for you all!

Christmas Card With Christmas and New Year ahead, it is time for some festive coding! Here is a Christmas Card for you all! NOTE: I have not made this

CodeMaster7000 1 Dec 25, 2021
Projeto job insights - Projeto avaliativo da Trybe do Bloco 32: Introdução à Python

Termos e acordos Ao iniciar este projeto, você concorda com as diretrizes do Código de Ética e Conduta e do Manual da Pessoa Estudante da Trybe. Boas

Lucas Muffato 1 Dec 09, 2021
Data repo for one-among.us

Our Data Data repo for one-among.us File Structure Directory /people/userid/: Data for a specific person info.json5: Profile information page.md: Pr

Hykilpikonna 55 Dec 30, 2022
ALSPAC data analysis studying links between screen-usage and mental health issues in children. Provided data has been synthesised.

ADSMH - Mental Health and Screen Time Group coursework for Applied Data Science at the University of Bristol. Overview The data set that you have was

Kai 1 Jan 13, 2022
Python most simple|stupid programming language (MSPL)

Most Simple|Stupid Programming language. (MSPL) Stack - Based programming language "written in Python" Features: Interpretate code (Run). Generate gra

Kirill Zhosul 14 Nov 03, 2022
Simple logger for Urbit pier size, with systemd timer template

urbit-piermon Simple logger for Urbit pier size, with systemd timer template. Syntax piermon.py -i [PATH TO PIER] -o [PATH TO OUTPUT CSV] systemd serv

1 Nov 07, 2021
Usos Semester average helper

Usos Semester average helper Dzieki temu skryptowi mozesz sprawdzic srednia ocen na kazdy odbyty przez ciebie semestr PARAMETERS required: '--username

2 Jan 17, 2022
A tool to guide you for team selection based on mana and ruleset using your owned cards.

Splinterlands_Teams_Guide A tool to guide you for team selection based on mana and ruleset using your owned cards. Built With This project is built wi

Ruzaini Subri 3 Jul 30, 2022
Displays Christmas-themed ASCII art

Christmas Color Scripts Displays Christmas-themed ASCII art. This was mainly inspired by DistroTube's Shell Color Scripts Screenshots ASCII Shadow Tex

1 Aug 09, 2022
Do you need a screensaver for CircuitPython? Of course you do

circuitpython_screensaver Do you need a screensaver for CircuitPython? Of course you do Demo video of dvdlogo screensaver: screensaver_dvdlogo.mp4 Dem

Tod E. Kurt 8 Sep 02, 2021
Checks for Vaccine Availability at your district and notifies you using E-mail, subscribe to our website.

Vaccine Availability Notifier Project Description Checks for Vaccine Availability at your district and notifies you using E-mail every 10 mins. Kindly

Farhan Hai Khan 19 Jun 03, 2021
IST-Website - IST Tutoring Portal for python

IST Tutoring Portal This portal is a web based interface to handle student help

Jean 3 Jan 03, 2022
An open-source systems and controls toolbox for Python3

harold A control systems package for Python=3.6. Introduction This package is written with the ambition of providing a full-fledged control systems s

Ilhan Polat 157 Dec 05, 2022
Waydroid is a container-based approach to boot a full Android system on a regular GNU/Linux system like Ubuntu.

Waydroid is a container-based approach to boot a full Android system on a regular GNU/Linux system like Ubuntu.

WayDroid 4.7k Jan 08, 2023
A small site to list shared directories

Nebula Server Directories This site can be used to list folder and subdirectories in your server : Python It's required to have Python 3.8 or more ins

Adrien J. 1 Dec 28, 2021
Is a util for xferring skinning from one mesh to another

maya_pythonplugins skinTo: Is a util for xferring skinning from one mesh to another args: :param maxInfluences: is the number of max influences on the

James Dunlop 2 Jan 24, 2022
pspsps(1) is a compyuter software to call an online catgirl to the Linux terminyal.

pspsps(1): call a catgirl from the Internyet to the Linux terminyal show processes: ps show catgirls: pspsps —@ Melissa Boiko 32 Dec 19, 2022

A simple PID tuner and simulator.

PIDtuner-V0.1 PlantPy PID tuner version 0.1 Features Supports first order and ramp process models. Supports Proportional action on PV or error or a sp

3 Jun 23, 2022