Re: Appending to variables

Heime <[email protected]> Mon, 22 Jun 2026 21:05:24 +0000
Newsgroups gmane.comp.gnu.make.general
Message-ID <mg0dPxLU7xEyh_p_V8CzGOMA2aZcg67NaklDiwCaRH1ZkKoql8vZaZq8ULa5AtBhMIO7iWkqXPvFy43S-GZOPfGpZ4R2X_o3aWAX_0axvds=@protonmail.com>
On Tuesday, June 23rd, 2026 at 8:45 AM, David Deutsch <[email protected]> wr=
ote:

> Like in your other mail - you're trying to go against a fundamental
> concept in make.
>=20
> A target is a target. What you're telling make with:
>=20
> make -f myfile.mk trlfn #(or ndf)
>=20
>   is "I want target myfile.mk to be one thing if I also tell you to
> build trlfn and another thing if I tell you to also build ndf and YET
> another thing if I tell it to also build trlfn and ndf at the same time".
>=20
> That means your Makefile has - in your theory - four separate
> understandings of what myfile.mk fundamentally is.
>=20
> If you keep pursuing this route, you're going to have a bad time because
> make works best when targets have clear and final meanings.
>=20
> The reason why trlfn/ndf does not work is because you have not provided
> a recipe to it, in two different ways: First, you thought a recipe was
> "the thing that make executes when I tell it to make a target" - which
> is kind of true, but not for makefile syntax which is evaluated before
> recipes are built (but in this case, will be ignored). Second: You just
> wrote the recipe behind the colon. That's where the prerequisites go.
> The actual recipe goes into the next line after a tab.

Would there be no prerequisites for such cases?
=20
> I would think that you're looking for outside variables, but from your
> other email, you already seem to know about those.
>=20
> What you're actually seem to be trying to do is use makefiles as though
> they were a bash script. Wrong tool for the job.
>=20
> -David
=20
I do not think I am using wrong tool for the job.  If I want
to build my program with gcc, I might need to set compiler
options by specifying what I want to the makefile.  How would
it be a wrong idea?



=20
> On 6/22/26 22:04, Heime wrote:
> > How can I have targets that append values to variables?
> > Doing as follows produces error on hopc.
> >
> > .PHONY: trlfn ndf
> >
> > trlfn: hopc +=3D --transliterate-file-names
> > ndf: hopc +=3D --node-files
> >
> > What I want is that calling
> >
> > make -f myfile.mk trlfn
> >
> > will append --transliterate-file-names to hopc
> >
> >
> >
>=20
>