Re: [hackers] [tabbed] Makefile improvements || Hiltjo Posthuma

From: NRK <nrk_AT_disroot.org>
Date: Sun, 16 Oct 2022 18:29:37 +0600

On Sun, Oct 16, 2022 at 01:56:51PM +0200, Hiltjo Posthuma wrote:
> > How can it be simpler than calling
> >
> > make CFLAGS=... LDFLAGS=... CPPFLAGS=...
> >
> > ? No matter what you put into config.mk, explicitly specified variables
> > in the make command-line override it.
> >
>
> This includes -DVERSION for example and you'd have to specify all flags,
> including the paths for Freetype of X11 for example. Now it allows both options
> more easily, respecting the default CFLAGS, LDFLAGS from the (build) system, or
> overriding them completely with TABBED_CFLAGS, TABBED_LDFLAGS.

From a packagers' perspective, builds that respect environmental
${C,LD}FLAGS are a huge plus for me.

Overriding them via cli is not a good idea since many suckless Makefiles
contain things that are essential for the build in CFLAGS. For example,
this is dwm:

        [dwm upstream]~> make CFLAGS="-O3 -march=native"
        /usr/include/X11/Xft/Xft.h:40:10: fatal error: ft2build.h: No such file or directory
           40 | #include <ft2build.h>
              | ^~~~~~~~~~~~

It fails because CPPFLAGS (which contains the -I flags as well as some
feature-test-macros) get mushed with CFLAGS. Dmenu Makefile does the
same thing :|

One other annoyance is that library flags (-l) are typically set in
LDFLAGS in most suckless Makefiles (whereas the convention is to set
them in LDLIBS). This makes overriding LDFLAGS break the build as well:

        [dwm upstream]~> make LDFLAGS="-s"
        /* thousands of lines of undefined reference linker error */

I earlier said to keep the config.mk, but after looking at it a bit
more, tabbed doesn't really have any build time option (unlike dwm or
dmenu which have optional xcinerama support) so removing `config.mk` I
think is fine since environmental {C,LD}FLAGS are now respected.

- NRK
Received on Sun Oct 16 2022 - 14:29:37 CEST

This archive was generated by hypermail 2.3.0 : Sun Oct 16 2022 - 14:36:35 CEST