The smallest build system

10 points by asb


wink

Zig, which is some nice prior art for writing the build files in the source language

This is great if you know the language. It's exponentially terrible if you're just starting out and the docs are not helpful.

But maybe build systems are (without any external limiting factors) just a thing where personal preference plays a big role. I've never been let down by cargo or make or qmake (in a sense that I couldn't find a solution on the web) but it has absolutely happened with other build systems (looking at you, cmake and ant and maven).

spc476

Ah, a reimplementation of make. For really simple C program of a single file (like for a class) you don't even need a makefile---just make prog will work as long prog.c exists. Even larger projects aren't that bad with make, here's a 150,000 line project (using GNUmake, which I find more useful than POSIX make):

%.a :
        $(AR) $(ARFLAGS) $@ $?

libIMG/libIMG.a     : $(patsubst %.c,%.o,$(wildcard libIMG/*.c))
libXPA/src/libxpa.a : $(patsubst %.c,%.o,$(wildcard libXPA/src/*.c))
libStyle/libStyle.a : $(patsubst %.c,%.o,$(wildcard libStyle/*.c))
libWWW/libWWW.a     : $(patsubst %.c,%.o,$(wildcard libWWW/*.c))
viola/viola         : $(patsubst %.c,%.o,$(wildcard viola/*.c)) \
        libIMG/libIMG.a     \
        libXPA/src/libxpa.a \
        libStyle/libStyle.a \
        libWWW/libWWW.a     \
        parmcheck.o

Granted, generating dependencies is a bitch, but once done, you at least get parallel builds with make for free (make -j).

It's funny, but I first came across make as a teenager in high school writing assembly code for MS-DOS. Yes, I learned make on MS-DOS, not Unix. It was a godsend for doing multi-file development on a single floppy system.