> Hi Tom o/
Hi Quentin \o/
> > > > # includes and libs
> > > > -INCS = -I. -I/usr/include -I/usr/include/freetype2 -I${X11INC}
> > > > -LIBS = -L/usr/lib -lc -lm -L${X11LIB} -lXft -lfontconfig -lX11
> > > > +INCS = -I/usr/include/freetype2 -I${X11INC}
> > > > +LIBS = -lm -L${X11LIB} -lXft -lfontconfig -lX11
> > >
> > > The -L option should go into LDFLAGS
> >
> > Since $LIBS is only used to provide $LDFLAGS, we could copy it's contents
> > directly into $LDFLAGS and drop $LIBS. Good catch.
>
> No, those are two different things.
>
> LDFLAGS are linker configuration parameters,
> like indeed where to search libraries amongst other things.
>
> The LIBS macro is to indicate what libraries to link against;
> those are not configuration parameters,
> but actual ordered operands in the linking chain.
Now that I'm looking over this again, I think the `-L` option can simply be
dropped. It isn't necessary in this context.
We could do it like surf (at least iirc) and drop $LDFLAGS in favour of
$LIBS. Let $LDFLAGS be an optional configuration option for the user.
> > > > # flags
> > > > CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600
> > > > -CFLAGS += -g -std=c99 -pedantic -Wall ${INCS} ${CPPFLAGS}
> > > > -LDFLAGS += -g ${LIBS}
> > > > -#CFLAGS += -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
> > > > -#LDFLAGS += ${LIBS}
> > > > +CFLAGS = -std=c99 -pedantic -Wall -Wstrict-prototypes -Wold-style-definition -Os ${INCS} ${CPPFLAGS}
> > >
> > > The -std option isn't necessary with the default CC.
> > > I'd remove any warning from production build,
> > > warnings are for development,
> > > then developpers can set whatever warnings they like.
> > >
> > > > # compiler and linker
> > > > -CC ?= cc
> > > > +CC = cc
> > >
> > > This should be removed altogether if you want a standard Makefile,
> > > then CC will just be the expected c99.
> >
> > I'd keep the `-std` option and the CC assignment.
> > We want to be C99 compliant regardless of which compiler the user decides to use.
> > Additionally, CC is a configuration option in all suckless programs and
> > to be consistent here seems reasonable, in my opinion.
>
> That's the point. To be compliant with C99, use a c99 compiler,
> which is the default compiler called by standard Makefiles.
> By defining CC to something non-standard,
> we introduce an indirection change here,
> that then forces the (non-standard) -std option to be passed to random compiler
> in the hope that it'll compatible with it.
> If the user decides to replace the standard compiler
> with another one, then they'll know which option to pass to it to make it respecting
> the original contract.
>
> As for some of the other suckless programs that specify CC,
> that's just a legacy format that should be replaced anyway IMO.
>
On most systems `c99` is just a simple wrapper script with, roughly, the
following content:
exec /usr/bin/cc -std=c99 "$_AT_"
`-std` is already used here and we don't gain much by using the systems `c99`.
But in the case in which `c99` isn't a script (which we probably should assume),
your way is definitely the better one.
Luckily, that's something the maintainer has to decide.
Btw. does anyone know if he is still active on this list (or in general)?
--
Best Regards,
Tom Schwindl
Received on Thu Jun 30 2022 - 17:20:49 CEST