Re: [dev] getting rid of cmake builds

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

Hi,

On Fri, Sep 22, 2023 at 07:27:25PM +0600, NRK wrote:
> $ make
> # ... builds st
> $ make CFLAGS="-g3 -fsanitize=address,undefined"
> # ... builds nothing because make doesn't take CFLAGS changes into account.
>
> I've seen some (hacky) ways to dump the flags into a file to trigger
> re-build more reliably. But as I've said, it's a solution to a self-made
> problem.

I don't think a build system should care about it. The build system should
care only about building what is required with the set of flags that you pass
in the command line. This is derivated from the UNIX principle "Mechanisms,
not policy" [1]. What happens if I want to apply the set of flags to only
one file? If you want to build everything with a different set of flags just
clean and build. This is very well summarized in the quote "Unix was not
designed to stop you from doing stupid things, because that would also stop
you from doing clever things" [2]

> There is no shell script involved. You invoke the compiler directly with
> whatever flags you please. There's no need to track dependencies or
> flags.

Did you see any flags in my example? If I want debug symbols then I just
write `make CFLAGS=-g`. and it knows what is the compiler to be used.
I don't want to know anything about compiler or set of options, I just
want to execute make and get the binary.

> And this is no longer the 50s, we have enough memory to build a couple
> thousand line of code without *requiring* splitting things into multiple
> intermediate object files to avoid going OOM (even with bloated
> compilers like gcc/clang with optimization enabled).

That is just another version of "it works for me". Don't assume anything
about build hosts. If you don't like it you are free of using jave instead,
I am pretty sure java programmers would like more this kind of things.

> Incremental builds are not free. And for small projects, the complexities
> they bring is (IMO) much higher compared to the benefits (which are
> either non-existent or negligible for small projects).

Do you think the Makefile that I wrote was complex? It was just a list of
objects. Can you explain me where is the complexity? and also, can you
explain me how you solve the problem of duplicated static symbols?

Regards,

[1] https://www.linuxtopia.org/online_books/programming_books/art_of_unix_programming/ch01s06_3.html?
[2] https://quotefancy.com/quote/1711236/Douglas-Gwyn-Unix-was-not-designed-to-stop-you-from-doing-stupid-things-because-that
Received on Fri Sep 22 2023 - 16:07:15 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 22 2023 - 16:12:08 CEST