bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gmake-4.2.1 ignores assignment of ARCH on FreeBSD


From: Paul Smith
Subject: Re: gmake-4.2.1 ignores assignment of ARCH on FreeBSD
Date: Tue, 26 Dec 2017 14:37:19 -0500

On Tue, 2017-12-26 at 09:59 -0800, Yuri wrote:
> Here are all lines where the variable ARCH appears in the makefile. ARCH 
> doesn't get substituted. Renaming ARCH -> ARCHX changes the behavior to 
> what is expected.
> 
> ARCH    := $(shell uname -m | ...)
> OSTYPE  := $(shell uname -s | ...)

> BASE    =       $(OSTYPE).$(ARCH).$(COMP).$(OPT)
> OBJDIR  = obj/O.$(OSTYPE).$(ARCH).$(COMP).$(LINK).$(OPT)
> NAME    =       zimpl
> BINNAME = $(NAME)-$(VERSION).$(OSTYPE).$(ARCH).$(COMP).$(LINK).$(OPT)

Something to be careful of is that you're assigning these values (BASE,
OBJDIR, etc.) using recursive assignment (=), not simple assignment
(:=).  That means that these variables will use the value of ARCH _when
they are expanded_, not the value of ARCH when they are _set_.  That
means that if some other part of the makefile later comes in and
changes the value of the ARCH variable, these variables will no longer
have their expected value.

However, you're saying that this line:

> include make/make.$(OSTYPE).$(ARCH).$(COMP).$(OPT)

uses the wrong value of ARCH.  If that's the case then the above can't
be the problem, because here ARCH is expanded immediately of course.

Since it works if you rename ARCH to ARCHX I'm assuming that if you run
this shell command at the shell prompt you get the correct results.

The only other thing I can think of, besides some strange local
customization of GNU make at a source code level, is that the ARCH
variable is set either on the command line or elsewhere with the
'override' operation so that the other setting takes precedence over
this one.

One thing you can try is adding something like:

  $(info shell = $(shell uname -m | ...)
  $(info ARCH = $(ARCH))

to the makefile right after you assign ARCH and see whether the shell
result is what you expect, and whether the ARCH assignment here is what
you expect.

Also, if you invoke make with the '-p' option it will show you where
all the variables are assigned along with their value.  This may help
you track down where ARCH is being set.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]