Skip to content

Instantly share code, notes, and snippets.

@OrangeTide
OrangeTide / build-systems-comparison.md
Created March 16, 2026 04:24
Comparison of build systems: Make, Plan 9 mk, Perforce Jam, Tup, and Ninja

Build Systems Comparison

A comparison of four build systems researched during the design of a new build tool. Each system represents a distinct philosophy and set of tradeoffs.

Summaries

Make (1976)

The original build tool by Stuart Feldman. Make reads a Makefile containing rules that map targets to prerequisites and shell recipes. It uses file modification timestamps to determine what needs rebuilding and supports pattern rules (%.o: %.c) for generic transformations. Make's key weakness is its lack of a real programming language — it has evolved ad-hoc features (conditionals, functions, pattern substitution) that are awkward and error-prone. Recursive make (invoking make in subdirectories) is the standard approach for multi-directory projects, but it fragments the dependency graph, leading to both correctness and performance problems at scale. Despite its limitations, make remains the most widely used build tool due to its ubiquity and simplicity for small projects.

@OrangeTide
OrangeTide / gmail-mailto
Created February 18, 2024 17:46
Use GMail as default email client on Linux / Ubuntu / Raspbian / Arch
#!/bin/sh
# Installation for using GMail as your preferred application
# This is for handling mime type: x-scheme-handler/mailto
#
# Place this script in your $PATH, and mark as executable
#
# Install the .desktop file:
# cp gmail-mailto.desktop ~/.local/share/applications/
#
@OrangeTide
OrangeTide / makefile
Last active November 10, 2023 16:32
small and low-configuration project Makefile (GNU make required)
# small and low-configuration project Makefile (GNU make required)
# Nov 10 2023 - Jon
# usage:
# 1. place this in the directory of a small C/C++ project.
# 2. modify type= configuration option to select executable or library modes.
# 3. all c/c++ and assembler sources will be linked into a single
# executable or library.
# 4. adjust configuration options for desired compiler and linker flags.
# examples of typical usage:
# make clean
@OrangeTide
OrangeTide / sdl-setup.md
Last active September 8, 2024 21:46
To set up a new SDL Android project

How To Set Up a New SDL Android project

  1. Install Android Studio
  1. Get SDL sources SDL2-2.0.12.tar.gz and extract to a location of your choice
    cd /tmp
    
@OrangeTide
OrangeTide / using-strcspn.c
Created September 13, 2022 17:29
Using strcspn to process control character delimiters
#include <stdio.h>
#include <string.h>
void
process(const char *input)
{
const char delim[] = { 0x0b, 0x1c, 0x0d, 0 };
int count = 0;
while (input[0] != '\0') {
@OrangeTide
OrangeTide / .bashrc
Created January 27, 2021 18:52
Add a cool 😎 prompt to your shell (for bash)
# Add this snippet to your .bashrc instead of your normal prompt (PS1) setting.
# Customize the line below further with your favorite smilies
# 😎 🙂 😊 😢 🙁 🙃
PS1='$(test $? -eq 0 && echo "\[\033[0;32m\]😎" || echo "\[\033[0;1;31m\]😢")\[\033[0m\] \W\$ '
# Set window title
case "$TERM" in
xterm*)
# see also man xterm(1) - "Window and Icon Titles"
@OrangeTide
OrangeTide / bananabread.md
Last active April 2, 2020 03:31
Banana Bread recipe

Banana Bread

Ingredients

  • 2 c flour
  • 1 c sugar
  • 1 1/2 tsp baking powder
  • 1/2 tsp baking soda
  • 1/4 tsp salt
@OrangeTide
OrangeTide / GNUmakefile
Created March 30, 2019 14:16
Primitive modular Makefile
all ::
clean :: ; $(RM) $(TARGETS) $(foreach t,$(TARGETS),$(OBJS_$t))
.PHONY : all clean
## Configuration
CFLAGS = -Wall -W -O2 -g
# a really aggressive strip-all for ARM
STRIP = strip -s -w -R .comment\* -R .note\* -R .gnu.hash -R .ARM.exidx -R .ARM.attributes
## Rules
%.o : %.c
$(COMPILE.c) $(if $(PKGS),$(shell pkg-config --cflags $(PKGS))) $(OUTPUT_OPTION) $<
@OrangeTide
OrangeTide / GNUmakefile
Created March 30, 2019 14:09
Sample build system
# Default options
CFLAGS = -Wall -W -g -O
# CFLAGS += -D_GNU_SOURCE
# OS Detection
ifeq ($(OS),Windows_NT)
X=.exe
RM=del
else
X=
endif
@OrangeTide
OrangeTide / pipe-example.c
Last active May 14, 2018 17:44
demonstration of using pipe() and fork() to redirect
#define _XOPEN_SOURCE 700
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <unistd.h>
int main() {
int s, fd[2];
pipe(fd);
if (!fork()) { /* child */
dup2(fd[0], STDIN_FILENO);