[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Change a target within Makefile?
From: |
Dmitry Goncharov |
Subject: |
Re: Change a target within Makefile? |
Date: |
Wed, 24 Jul 2024 12:36:42 -0400 |
On Wed, Jul 24, 2024 at 5:46 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
> Of course, it does not work since MAKECMDGOALS is read-only.
Well, it is possible to assign a new value to makecmdgoals. i guess,
you mean that make proceeds to build the target specified on the
command line, regardless.
> If recursion is allowed, the following might work, but
i agree with "but". Make has a certain user interface and when the
user specified x.a, i prefer a makefile that builds x.a. Attempts to
override users choice are misleading.
Somebody else reads the build log and cannot figure out why x.b was
build, even though x.a was specified. And then another user inherits
this env var accidentally and cannot figure out why x.b is getting
build when they say x.a. And most users don't know the clever trick
that turns x.a to x.b. Etc.
Why don't you have the user specify x.b when they need x.b?
If a shell program calls make, then the same logic applies, the shell
program can look at the env variable and specify x.a or x.b.
regards, Dmitry