Re: [dev] lightweight build system

From: Ori Bernstein <>
Date: Tue, 1 Aug 2017 15:10:49 -0700

On Sun, 23 Jul 2017 23:29:04 +0300
ochern <> wrote:

> Unfortunately as more complex becomes configuration part the more perverted
> and unreadable it will look when done using make, at the same time it will
> keep nice look in pure shell variant. Yet a lower part, rules part, will
> not change for both variants.

Yes, that's the general problem with configuration. The challenge of simple
software is finding ways to reduce the number of configuration knobs, instead
of adding more and more complex systems to deal with the interactions of all
the parts.

> I thing the best approach is treating Make as a simple command, like
> sed, awk etc, and use it inside Shell scripts instead of writing
> standalone.

That sounds like a solution to an unnecessary problem. If you have recursive
make, put the flags into a per-directory `` (or better, `config.h`).
Concentrate your per-platform dependencies into a small number of files, and
use them to provide a uniform interface.

If it turns out that, for example, Linux needs different linker flags from
OpenBSD, you can put those bits of configuration into different makefiles,
and include them:


        include mk/$(SYS)

        mybin: $(OBJ) $(COMPATOBJ)
                $(LD) -o $_AT_ $^

        # maybe you need some extra flags.
        LDFLAGS=$(LDFLAGS) -lrt

        # maybe you want to use some string
        # handling from openbsd.
        strlcat.o: strlcat.c

        # maybe you don't need anything here.
Received on Wed Aug 02 2017 - 00:10:49 CEST

This archive was generated by hypermail 2.3.0 : Wed Aug 02 2017 - 00:12:31 CEST