Re: [dev] getting rid of cmake builds

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Fri, 22 Sep 2023 12:33:15 +0200

Hi,

On Fri, Sep 22, 2023 at 04:06:25PM +0600, NRK wrote:
> On Fri, Sep 22, 2023 at 11:18:47AM +0200, Страхиња Радић wrote:
> > ./build.sh
>
> But in short: you simply include any `.c` file into one. There's zero

and then you get name collisions because all the static symbols are
compiled in a single translation unit.

> problem adapting to a different compiler or compiler flags. In fact,
> it's *easier* to do than a makefile (which I also said on my previous

easier than in a Makefile? In a Makefile (in a good well written) you
only have to pass a different CFLAGS value, but in the shell script you
have to edit the shell script itself.

> $ gcc -o exe src.c
> $ clang -o exe src.c # no need to "clean" anything
>
> Doing cross-platform is also easy by just making your core application
> "platform-agonistic" and having the "platform layer" provide platform
> specific functionality. For example, here's a hypothetical
> `app-windows.c` file:

that is not about build systems, is about software design:

        OBJS = main.o src-$(SYS).o
        SYS = posix

        app: $(OBJS)
                $(CC) -o $_AT_ $(LDFLAGS) $(OBJS)

if you compile in posix, then you only use `make`, if you compile in windows
you use `make SYS=windows`.

Makefiles are really simple, but for some reason that I don't understand
people like to write horrible and complex Makefiles.

Regards,
Received on Fri Sep 22 2023 - 12:33:15 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 22 2023 - 12:36:09 CEST