Re: [dev] Yet another "sane alternatives" thread

From: Martin Tournoij <martin_AT_arp242.net>
Date: Thu, 27 Dec 2018 18:36:22 +1300

On Tue, Dec 25, 2018, at 10:11, Cág wrote:
> 3. Are there any drop-in replacements for Open/LibreSSL and GNU make?

I've thought about this for a while, and I wonder if make is even
needed? Or rather, what's wrong with:

    cc [flags] *.c

If you have a reasonably fast compiler then using object files won't be
all that advantageous, and caching in general kind of sucks (it's a
necessarily evil sometimes, but usually best avoided).

Unfortunately, neither gcc nor clang are reasonably fast; a quick
benchmark with dwm on my system (I rm'd transient.c):

Default (make clean all):

        tcc 0.052s
        gcc 0.806s
        clang 0.886s

cc [..] *.c -o dwm:

        tcc *.c 0.057s
        gcc *.c 0.722s
        clang *.c 0.756s

I think 0.05s is fast enough :-) I also tested some larger programs;
xterm takes 0.7 seconds to compile with tcc (gcc: 15s). Vim 3.4 seconds
(gcc: 90s; this also includes some non-compiler stuff like gettext, so
could be faster).

I am disappointed to see that clang compilation speeds are a lot slower
than what they used to be. The disadvantage of tcc is that it does
almost no optimisations, so even simple programs will run slower. My
solution is to use tcc as the default, and gcc when installing stuff.

On the origins of make:

> Make originated with a visit from Steve Johnson (author of yacc,
> etc.), storming into my office, cursing the Fates that had caused him
> to waste a morning debugging a correct program (bug had been fixed,
> file hadn't been compiled, cc *.o was therefore unaffected). As I had
> spent a part of the previous evening coping with the same disaster on
> a project I was working on, the idea of a tool to solve it came up. It
> began with an elaborate idea of a dependency analyzer, boiled down to
> something much simpler, and turned into Make that weekend

This is a classic "oops, cache!" problem. Computers and compilers are
fast enough to not use a cache for most C programs. No cache, no
problem, no make.

So it seems to me that if we just eliminate object files, we eliminate
the need for make? I don't really see the advantage of make beyond
defining the basic well-known "all", "install", and "clean" targets for
convenience.
Received on Thu Dec 27 2018 - 06:36:22 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 27 2018 - 06:48:07 CET