On Mon, Oct 09, 2017 at 10:27:19AM +0500, ???? ??????? wrote:
> 2017-10-09 10:10 GMT+05:00 Vincent Bernat <[email protected]>:
> 
> >  ?  9 octobre 2017 08:49 +0500, ???? ??????? <[email protected]> :
> >
> > >> > any particular reason for mixing "CC=gcc" with "CC?=gcc" ?
> > >>
> > >> I don't see any use of ?=, except for stuff that are expected to be in
> > >> environment variables (like HOME, DISPLAY, LANG, PATH).
> > >>
> > >
> > > # find . -name Makefile -exec grep -E '^CC' {} ';' -print
> > > CC = gcc
> > > ./Makefile
> > > CC       = gcc
> > > ./contrib/debug/Makefile
> > > CC       = gcc
> > > ./contrib/halog/Makefile
> > > CC       = gcc
> > > ./contrib/ip6range/Makefile
> > > CC       = gcc
> > > ./contrib/iprange/Makefile
> > > CC ?= gcc
> > > ./contrib/mod_defender/Makefile
> > > CC ?= gcc
> > > ./contrib/modsecurity/Makefile
> > > CC = gcc
> > > ./contrib/spoa_example/Makefile
> > > CC       = gcc
> > > ./contrib/tcploop/Makefile
> >
> > Oh, I didn't understand. I think ?= should just be =.
> >
> 
> I'd stay with ?=, but changing all the occurences to "=" is also nice

I really hate "?=" in makefiles. It causes random issues especially
when building larger, more complex projects involving scripts and
various stuff being passed via the environment. Just take a look at
the patches in crosstool-ng just to fix the accidental sleep of
certain CFLAGS or PATH elements through many layers of makefile to
get an idea.

With just "=" there's no such issue. If you want to change a value,
you can set it on the command line. For example here's the script I'm
using to around 200 times a day during development :

#!/bin/sh
exec make -j 18 TMPDIR=/dev/shm DISTCC_HOSTS="--localslots_cpp=100 
192.168.0.235/100,lzo" PATH=/f/tc/x86_64-gcc47_glibc218-linux-gnu/bin:$PATH 
CC=/g/public/linux/master/x86_64-gcc47_glibc218-linux-gnu-gcc TARGET=linux2628 
CPU=generic CPU_CFLAGS.generic="-O0" ARCH_FLAGS="-pg" DEP= USE_PCRE=1 PCREDIR= 
SMALL_OPTS="-DBUFSIZE=8030 -DMAXREWRITE=1030" DEFINE="-DSO_MARK=36 
-DTCP_USER_TIMEOUT=18 -DTCP_REPAIR=19 -DDEBUG_DONT_SHARE_POOLS 
-DDEBUG_MEMORY_POOLS" USE_OPENSSL=1 USE_ZLIB=1 USE_LUA=1 LUA_LIB_NAME=lua 
EXTRA= USE_SLZ=1 SLZ_INC=/g/public/slz/src SLZ_LIB=/g/public/slz USE_ZLIB= 
USE_NS=1 "$@"

Sure it's ugly. And so what ? Just done it once, and never had to patch
the makefile nor to wonder why it works in one xterm and produces a
different result in another one.

Feel free to propose a patch to convert the three "?=" to "=" however :-)

Cheers,
Willy

Reply via email to