Subject: Re: custom CFLAGS not getting set
To: Jeremy C. Reed <reed@reedmedia.net>
From: Simon Gerraty <sjg@juniper.net>
List: tech-pkg
Date: 12/02/2002 10:25:18
On Mon, 2 Dec 2002 10:01:31 -0800 (PST), "Jeremy C. Reed" writes:
>> Now I see that the Linux system's
>> /home/jeremy/netbsd/usr/pkg/share/mk/sys.mk has:
>> CFLAGS=         ${DBG}
>>
>> I believe that is from mk-files.
>>
>> but other mk/sys.mk have:
>> CFLAGS?=        ${DBG}
>
>Why does the NetBSD.sys.mk assign the value to the variables only if they
>are not already defined, while the other operating system sys.mk files
>override the settings?

My bad.  Most of the $OS.sys.mk's reflect the state of NetBSD.sys.mk
at the time they were created.  It has been pointed out that this use
of DBG is at best a poor choice of variable name.  I'm sort of waiting
to see what fix Jason comes up with, and will update all these to use
the same solution.

I've also been tempted to do a sys.mk.in or perhaps generic.sys.mk.in
I think the bootstrap-pkgsrc thing uses some .mk.in files so there's
probably some benefit in doing this.

>My Linux system's other sys.mk files use the ?= syntax, but the version
>of sys.mk I use for building packages is from mk-files and it
>overwrites my custom settings set in individual Makefiles. When I changed

Huh?  sys.mk is read before anything else, so Makefile settings should
not be impacted.  settings on the command line override anything, so
only CFLAGS set in the environment should be impacted?  Or is
something reading sys.mk directly?

>my /home/jeremy/netbsd/usr/pkg/share/mk/sys.mk's
>CFLAGS=        ${DBG}
> to
>CFLAGS?=        ${DBG}
> then all was well for that.
>
>Why isn't it like that in the first place?

Ancient history I expect.

--sjg