Re: [PATCH 1/3] arch/um/Makefile: remove dead code

From: Al Viro
Date: Thu Jul 04 2013 - 19:53:38 EST


On Fri, Jul 05, 2013 at 02:33:15AM +0530, Ramkumar Ramachandra wrote:
> arch/um/Makefile is included in the toplevel Makefile:495. Well before
> that, it unconditionally sets $SUBARCH (in Makefile:168) as follows:
>
> SUBARCH := $(shell uname -m | sed -e s/i.86/x86/ -e s/x86_64/x86/ \
> -e s/sun4u/sparc64/ \
> -e s/arm.*/arm/ -e s/sa110/arm/ \
> -e s/s390x/s390/ -e s/parisc64/parisc/ \
> -e s/ppc.*/powerpc/ -e s/mips.*/mips/ \
> -e s/sh[234].*/sh/ -e s/aarch64.*/arm64/ )
>
> It is clearly impossible for $SUBARCH to be set as i386 or x86_64.

RTFM(make); section 9.5 in GNU make info, or the following from POSIX:

[quote]

Macro definitions shall be taken from the following sources, in the following
logical order, before the makefile(s) are read.

1. Macros specified on the make utility command line, in the order
specified on the command line. It is unspecified whether the internal macros
defined in Internal Macros are accepted from this source.
2. Macros defined by the MAKEFLAGS environment variable, in the order
specified in the environment variable. It is unspecified whether the internal
macros defined in Internal Macros are accepted from this source.
3. The contents of the environment, excluding the MAKEFLAGS and SHELL
variables and including the variables with null values.
4. Macros defined in the inference rules built into make.

Macro definitions from these sources shall not override macro definitions from
a lower-numbered source. Macro definitions from a single source (for example,
the make utility command line, the MAKEFLAGS environment variable, or the
other environment variables) shall override previous macro definitions from
the same source.

Macros defined in the makefile(s) shall override macro definitions that occur
before them in the makefile(s) and macro definitions from source 4. If the -e
option is not specified, macros defined in the makefile(s) shall override
macro definitions from source 3. Macros defined in the makefile(s) shall not
override macro definitions from source 1 or source 2.

[end quote]

IOW, any make variable (== macro in POSIX quote above) can be explicitly
set in make(1) command line in form name=value and in that case nothing in
makefile(s) can change its value. It's true for GNU make, it's true for
BSD make and it's been true for historical Unix make since its introduction
in v7.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/