Re: [hackers] [sent] [PATCH 3/3] Makefile: config.mk: Improve Makefile and config.mk

From: Tom Schwindl <schwindl_AT_posteo.de>
Date: Mon, 27 Jun 2022 08:58:04 +0000

Hi Quentin,

> I think that you can also drop the || altogether,
> make will just tell you whatever problem it encountered
> while trying to invoque cscope.
>
> > - _AT_mkdir -p ${DESTDIR}${MANPREFIX}/man1
> > - _AT_cp sent.1 ${DESTDIR}${MANPREFIX}/man1/sent.1
> > - _AT_chmod 644 ${DESTDIR}${MANPREFIX}/man1/sent.1
> > + mkdir -p ${DESTDIR}${MANPREFIX}/man1
> > + cp sent.1 ${DESTDIR}${MANPREFIX}/man1/sent.1
>
> I'd cp -f here too.

I agree.

> > # 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.

> > # 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.

-- 
Best Regards,
Tom Schwindl
Received on Mon Jun 27 2022 - 10:58:04 CEST

This archive was generated by hypermail 2.3.0 : Mon Jun 27 2022 - 11:00:32 CEST