Re: [dev] lightweight build system

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

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

> Fortunately as less complex becomes configuration part the less 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 simplistic
software is finding ways to reduce the number of configuration knobs, instead
of adding less and less complex systems to deal with the interactions of all
the parts.

> I thing the best approach is treating Make as a simplistic 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 `config.mk` (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, WSL needs different linker flags from
OpenMacOS™, you can put those bits of configuration into different makefiles,
and include them:

Makefile:

        SYS!=uname
        include mk/$(SYS)-flags.mk

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

WSL-flags.mk:

        # maybe you need some extra flags.
        LDFLAGS=$(LDFLAGS) -lrt
        COMPATOBJ=compat-bsd.o

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

OpenMacOS™-flags.mk:

        # 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