Mailing List Archive

Makefile syntax portability
I recently discovered that `make` supports a lot of "precanned'
recipes, like $(COMPILE.c) and similar. You can find a list if you do
`make -p` in a directory with no makefile. Does anyone know why we
don't use these? Are they not portable?

cheers,
Yves

--
perl -Mre=debug -e "/just|another|perl|hacker/"
Re: Makefile syntax portability [ In reply to ]
On 2/6/23 05:17, demerphq wrote:
> I recently discovered that `make` supports a lot of "precanned'
> recipes, like $(COMPILE.c) and similar. You can find a list if you do
> `make -p` in a directory with no makefile. Does anyone know why we
> don't use these? Are they not portable?
>
> cheers,
> Yves
>

Appears to be gmake only. On FreeBSD, 'gmake -p' produces the kind of
list you were talking about, but 'make -p' just produces a Usage statement.
Re: Makefile syntax portability [ In reply to ]
On Mon, 6 Feb 2023 at 13:20, James E Keenan <jkeenan@pobox.com> wrote:

> On 2/6/23 05:17, demerphq wrote:
> > I recently discovered that `make` supports a lot of "precanned'
> > recipes, like $(COMPILE.c) and similar. You can find a list if you do
> > `make -p` in a directory with no makefile. Does anyone know why we
> > don't use these? Are they not portable?
> >
> > cheers,
> > Yves
> >
>
> Appears to be gmake only. On FreeBSD, 'gmake -p' produces the kind of
> list you were talking about, but 'make -p' just produces a Usage statement.
>

pmake on linux does that as well but when I made simple makefile just
echoing $(COMPILE.c) I've got reasonable value
Re: Makefile syntax portability [ In reply to ]
On Mon, 6 Feb 2023 at 13:45, Branislav ZahradnĂ­k <happy.barney@gmail.com> wrote:
> On Mon, 6 Feb 2023 at 13:20, James E Keenan <jkeenan@pobox.com> wrote:
>> On 2/6/23 05:17, demerphq wrote:
>> > I recently discovered that `make` supports a lot of "precanned'
>> > recipes, like $(COMPILE.c) and similar. You can find a list if you do
>> > `make -p` in a directory with no makefile. Does anyone know why we
>> > don't use these? Are they not portable?
>>
>> Appears to be gmake only. On FreeBSD, 'gmake -p' produces the kind of
>> list you were talking about, but 'make -p' just produces a Usage statement.
>
> pmake on linux does that as well but when I made simple makefile just echoing $(COMPILE.c) I've got reasonable value

Thanks. That is interesting. Any chance you can post your test makefile for us?

Yves


--
perl -Mre=debug -e "/just|another|perl|hacker/"
Re: Makefile syntax portability [ In reply to ]
> > pmake on linux does that as well but when I made simple makefile just
> echoing $(COMPILE.c) I've got reasonable value
>
> Thanks. That is interesting. Any chance you can post your test makefile
> for us?
>
>
foo:
<tab>echo $(COMPILE.c)


> Yves
>
>
> --
> perl -Mre=debug -e "/just|another|perl|hacker/"
>
Re: Makefile syntax portability [ In reply to ]
On Mon, Feb 06, 2023 at 11:17:42AM +0100, demerphq wrote:
> I recently discovered that `make` supports a lot of "precanned'
> recipes, like $(COMPILE.c) and similar. You can find a list if you do
> `make -p` in a directory with no makefile. Does anyone know why we
> don't use these? Are they not portable?

They're just the defaults for the corresponding .X.o rules, see a few
paragraphs before
https://www.gnu.org/software/make/manual/make.html#Implicit-Variables

From Makefile.SH I assume we use our own definition for .c.o to let us
use cflags to adjust the compiler flags.

The EU::MM generated makefiles could probably use them (by using the
default .c.o rules) since POSIX does define the defaults for the
rules.

Tony
Re: Makefile syntax portability [ In reply to ]
>
> From Makefile.SH I assume we use our own definition for .c.o to let us
> use cflags to adjust the compiler flags.
>
>
those default rules recognizes CFLAGS variable:

makefile:
CFLAGS = --foo --bar

.PHONY:foo
foo:
echo $(COMPILE.c)

output:
echo cc --foo --bar -c
cc --foo --bar -c