Re: Catching passed options to makeinfo

Heime <[email protected]> Wed, 10 Jun 2026 14:11:02 +0000
Newsgroups gmane.comp.gnu.make.general
Message-ID <DEpqpP9J2uhPBVykM9oW5Q19JHXdrelqZ6uqtzAC9kY5k84nLwCUPXQQ3dPet4EKMsMt8ppKJ7Xvgj7bh5UhZ8wk-DjsrSjwNMlIwVfRmAU=@protonmail.com>
On Tuesday, June 9th, 2026 at 4:17 AM, Heime <[email protected]> w=
rote:

> On Tuesday, June 9th, 2026 at 12:06 AM, Paul Smith <[email protected]> wrote=
:
>=20
> > On Sun, 2026-06-07 at 08:57 +0000, Heime wrote:
> > > I want to avoid passing using a variable like this
> > >
> > > make -f myfile.mk opt=3D--split=3Dchapter
> > >
> > > Rather, I want a direct setting like thisn
> > >
> > > make -f myfile.mk -- --html --split=3Dchapter
> > >
> > > And be able to pass all option to the command part of a
> > > makefile rule.
> >
> > What you want to do is not possible.  Make is not a general-purpose
> > interpreter that allows makefiles to investigate and interpret its
> > command-line arguments.
> >
> > The only thing you can do is write a shell script wrapper around make,
> > that will parse the arguments and pass them to make using a variable
> > assignment. --- Paul D. Smith

Parsing options to makefile, arguments after -- end up=20
considered either as variable assignments (if they contain=20
an =3D symbol) or as targets to build.  I'm not aware of a=20
way for a Makefile to determine generically all the variables=20
and targets specified as command-line arguments.  Assignments=20
end up in $(MAKEFLAGS) but that's it.

I can=E2=80=99t think of many (or even any) shell script wrappers=20
used for `make`.=20

I thought to use something that behaves like a shell script,=20
but using the `make` invocation syntax doesn=E2=80=99t bring much=20
benefit anyway.

Building something that looks like a typical command-line=20
program, processing options and arguments, Make isn=E2=80=99t the=20
right tool.  If I'm going to use `make`, I should embrace=20
its features instead of trying to work around them.

How does one typically handle various options for gcc. =20
Are there some makefile examples I can study that allow=20
for various compiling options=20
to be used?