[GRASS5] Gmake is not Gnu Make

Shouldn't we advertize the fact that Gmake and Gmakefiles stand for
_G_rass makefiles and that these makefiles are POSIX compatible i.e. use
only few features that let them be scanned by GNUmake or Pmake (BSD)?

The FreeBSD package for example has:

USE_GMAKE= yes

The fact is that, _now_, the name is misleading.

What are the plans for the future? Keep this compatibility (I'm
personnally against automake and the hell) or use more elaborate (why?)
features that will not be portable?
--
Thierry Laronde (Alceste) <tlaronde@polynum.org>
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C

Thierry Laronde wrote:

Shouldn't we advertize the fact that Gmake and Gmakefiles stand for
_G_rass makefiles and that these makefiles are POSIX compatible i.e. use
only few features that let them be scanned by GNUmake or Pmake (BSD)?

The FreeBSD package for example has:

USE_GMAKE= yes

The fact is that, _now_, the name is misleading.

What are the plans for the future? Keep this compatibility (I'm
personnally against automake and the hell) or use more elaborate (why?)
features that will not be portable?

5.7 doesn't use gmake5 or Gmakefiles. It just uses GNU Makefiles.

For a sane build system, we realistically need to insist upon a make
which:

1. Uses a Bourne shell for executing the commands.

2. Provides an "include" feature.

3. Provides an adequate syntax for pattern rules.

We should make a reasonable attempt to support any make program which
meets the above requirements. Over-engineering the build system in
order to support every make program in existence (which is basically
the case for gmake5) isn't worth it. OTOH, we shouldn't insist upon
GNU make just because we don't want to bother with relatively minor
compatibility issues.

--
Glynn Clements <glynn.clements@virgin.net>

On Mon, Nov 17, 2003 at 08:40:10PM +0000, Glynn Clements wrote:

>
> What are the plans for the future? Keep this compatibility (I'm
> personnally against automake and the hell) or use more elaborate (why?)
> features that will not be portable?

5.7 doesn't use gmake5 or Gmakefiles. It just uses GNU Makefiles.

For a sane build system, we realistically need to insist upon a make
which:

1. Uses a Bourne shell for executing the commands.

POSIX susv3 specifies that the special macro SHELL shall be defined
internally by make to point to the command line interpreter 'sh', and
the standard points to the POSIX definition which is a Bourne shell.

So, if I'm not mistaken, a standard make shall interpret the commands
via a Bourne compatible shell. But the standard is not really clear
(this is only infered). But I think the practice is more clear (and at
least POSIX specifies that the environment variable SHELL has nothing to
do here and shall not be mixed with it).

2. Provides an "include" feature.

POSIX shell is a very restricted subset of the make utilities. And there
is no POSIX include target.

But I had the surprise to see `include' accepted by the FreeBSD make,
when I thought that only '.include' was accepted. The reason is:

SYSVINCLUDE
* Recognize system V like include directives [include "filename"]

that is a SysV compatibility defined at compile time.
So this may or may not be present on different BSD flavors.

3. Provides an adequate syntax for pattern rules.

I suspect this is were there would be a lot of difference and perhaps no
common case (and there is no POSIX standardisation).

We should make a reasonable attempt to support any make program which
meets the above requirements. Over-engineering the build system in
order to support every make program in existence (which is basically
the case for gmake5) isn't worth it. OTOH, we shouldn't insist upon
GNU make just because we don't want to bother with relatively minor
compatibility issues.

Well, I think that there is two alternatives (and only two, nothing in
the middle):
- whether go the traditionnal Grass make way, that is letting bourne
shell script constructs portable makefiles;
- or adopt one between multiple flavors, i.e. GNU make or P make since a
syntax working on one may fail on the other.

By the way, the new sketch directory for make include files is more a
BSD one.

But, have mercy! no automake around there! :wink:
--
Thierry Laronde (Alceste) <tlaronde@polynum.org>
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C

Thierry Laronde wrote:

> > What are the plans for the future? Keep this compatibility (I'm
> > personnally against automake and the hell) or use more elaborate (why?)
> > features that will not be portable?
>
> 5.7 doesn't use gmake5 or Gmakefiles. It just uses GNU Makefiles.
>
> For a sane build system, we realistically need to insist upon a make
> which:
>
> 1. Uses a Bourne shell for executing the commands.

POSIX susv3 specifies that the special macro SHELL shall be defined
internally by make to point to the command line interpreter 'sh', and
the standard points to the POSIX definition which is a Bourne shell.

So, if I'm not mistaken, a standard make shall interpret the commands
via a Bourne compatible shell.

No, it simply means that you can force a command to be passed to a
Bourne shell with:

  $(SHELL) -c "..."

Which is what we do at present (see Makefile.in), and it's a nuisance.

I'd rather just require make to execute the commands via a Bourne
shell. IOW, I don't think that we should support make programs which
use a C shell (IRIX?).

Also, citing SuS/XPG/etc isn't really much use. A lot of systems don't
comply with them (including Linux, which is our most popular platform;
Cygwin doesn't either, and I doubt that MacOSX does).

> 2. Provides an "include" feature.

POSIX shell is a very restricted subset of the make utilities. And there
is no POSIX include target.

But I had the surprise to see `include' accepted by the FreeBSD make,
when I thought that only '.include' was accepted. The reason is:

SYSVINCLUDE
* Recognize system V like include directives [include "filename"]

that is a SysV compatibility defined at compile time.
So this may or may not be present on different BSD flavors.

Without an include feature, we are stuck with the gmake5 approach,
which is to generate the actual Makefiles via some kind of
preprocessor which glues together all of the relevant fragments.
Personally, I think that's going too far.

> 3. Provides an adequate syntax for pattern rules.

I suspect this is were there would be a lot of difference and perhaps no
common case (and there is no POSIX standardisation).

Again, gmake5 gets around this issue by simply generating a separate
compilation rule for every .o file. However, pattern rules are an
absolute necessity for any sane build system.

> We should make a reasonable attempt to support any make program which
> meets the above requirements. Over-engineering the build system in
> order to support every make program in existence (which is basically
> the case for gmake5) isn't worth it. OTOH, we shouldn't insist upon
> GNU make just because we don't want to bother with relatively minor
> compatibility issues.

Well, I think that there is two alternatives (and only two, nothing in
the middle):
- whether go the traditionnal Grass make way, that is letting bourne
shell script constructs portable makefiles;
- or adopt one between multiple flavors, i.e. GNU make or P make since a
syntax working on one may fail on the other.

Personally, I wouldn't have a problem with simply requiring GNU make
if all of the alternatives had significant issues (and requiring the
use of a preprocessor is a significant issue).

I'm just saying that, if another make program was close enough that it
only imposed minor constraints, then we should support it. Not
supporting another make program because of genuine issues is OK; not
supporting it because we can't be bothered to consider the issues
isn't.

The situation isn't the same as for the choice of a compiler, where
there is a strong imperative to use the system's "official" compiler
(i.e. avoiding portability issues by saying "you must use gcc" is
completely unacceptable). The choice of make utility only affects the
process, not the end result.

--
Glynn Clements <glynn.clements@virgin.net>

On Tue, Nov 18, 2003 at 06:09:41PM +0000, Glynn Clements wrote:

>
> So, if I'm not mistaken, a standard make shall interpret the commands
> via a Bourne compatible shell.

No, it simply means that you can force a command to be passed to a
Bourne shell with:

  $(SHELL) -c "..."

Since I'm not an english native speaker, your interpretation is probably
better. But I thought that since the user shell (via the SHELL
environment variable) shall not be interpreted was ensuring that
this was not the user SHELL that was used but the "internally defined"
make SHELL.

Which is what we do at present (see Makefile.in), and it's a nuisance.

I'd rather just require make to execute the commands via a Bourne
shell. IOW, I don't think that we should support make programs which
use a C shell (IRIX?).

Certainly not.

Also, citing SuS/XPG/etc isn't really much use. A lot of systems don't
comply with them (including Linux, which is our most popular platform;
Cygwin doesn't either, and I doubt that MacOSX does).

The only Portability specification between OSes is POSIX and the last
one (version 3) is Single Unix Specification. That's why I use it,
discarding all XPG extensions. Every Unix like system should support
POSIX, and since you must start with something, it's better to start
with this (if you are even not guaranteed to have a Bourne shell, sed
and so on...). And I think Cygwin ports at least the POSIX user tools?

> > 2. Provides an "include" feature.
>
> that is a SysV compatibility defined at compile time.
> So this may or may not be present on different BSD flavors.

Without an include feature, we are stuck with the gmake5 approach,
which is to generate the actual Makefiles via some kind of
preprocessor which glues together all of the relevant fragments.
Personally, I think that's going too far.

pmake (make) uses .include.

All the features are here. All I want to say is that indeed there will
be a choice to make, and yes it seems simpler to go the GNU make way...
but perhaps because BSD base systems ensure the portability and are able
to compile packages with gmake, while the other way (Linux based
distributions having the ability to compile with BSD make) is not
guaranteed.

--
Thierry Laronde (Alceste) <tlaronde@polynum.org>
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C

Thierry Laronde wrote:

> Also, citing SuS/XPG/etc isn't really much use. A lot of systems don't
> comply with them (including Linux, which is our most popular platform;
> Cygwin doesn't either, and I doubt that MacOSX does).

The only Portability specification between OSes is POSIX and the last
one (version 3) is Single Unix Specification. That's why I use it,
discarding all XPG extensions. Every Unix like system should support
POSIX, and since you must start with something, it's better to start
with this (if you are even not guaranteed to have a Bourne shell, sed
and so on...). And I think Cygwin ports at least the POSIX user tools?

The term POSIX refers to a whole family of standards. The most
commonly used are POSIX.1, which describes essential system calls and
library functions (e.g. the ANSI functions, plus those in <unistd.h>,
<fcntl.h> etc), and POSIX.2, which describes essential command-line
utilities (cp, mv, cat etc).

Unfortunately, both of those standards are extremely limited.

Very few packages will compile and/or run on a system which only
provides that which is mandated by those standards. E.g. POSIX.1
doesn't include the BSD sockets API, or anything which requires
"privilege". FWIW, Windows NT is POSIX.1 compliant.

To take a concrete example, look at the SuS specification for the
"echo" command. It doesn't accept any switches, but it does mandate a
number of backslash sequences which aren't supported by either the
echo program from GNU sh-utils or the bash echo built-in command.

In particular, the SuS version doesn't support the -n switch (don't
add a newline), but specifies a backslash sequence for this purpose;
however, neither of the aforementioned GNU implementations support the
backslash sequence. Consequently, we just have to accept that there is
no portable way to echo a string without a trailing newline. Waving a
copy of the SuS at the computer won't help.

If SuS compliance was widespread, we wouldn't need most of the
configure script. However, it isn't widespread; in reality we have to
go according to "common practice".

> > > 2. Provides an "include" feature.
> >
> > that is a SysV compatibility defined at compile time.
> > So this may or may not be present on different BSD flavors.
>
> Without an include feature, we are stuck with the gmake5 approach,
> which is to generate the actual Makefiles via some kind of
> preprocessor which glues together all of the relevant fragments.
> Personally, I think that's going too far.

pmake (make) uses .include.

All the features are here. All I want to say is that indeed there will
be a choice to make, and yes it seems simpler to go the GNU make way...
but perhaps because BSD base systems ensure the portability and are able
to compile packages with gmake, while the other way (Linux based
distributions having the ability to compile with BSD make) is not
guaranteed.

BTW, I'm not suggesting that the "preferred" make program should be
anything other than GNU make. Just to re-iterate my position:

1. Any future build system should be based around GNU make.

2. We should be willing to accept reasonable constraints in order to
accommodate other make utilities which are "sufficiently" compatible
with GNU make.

3. We shouldn't accept drastic constraints in order to accomodate
every possible make utility.

Essentially, point 2 rules out trying to be too "clever" in the kind
of things that the Makefiles (and their include files) do, while point
3 rules out accomodating "weird" make programs (e.g. csh-based makes,
NMAKE etc).

--
Glynn Clements <glynn.clements@virgin.net>

On Tue, Nov 18, 2003 at 10:16:00PM +0000, Glynn Clements wrote:

To take a concrete example, look at the SuS specification for the
"echo" command. It doesn't accept any switches, but it does mandate a
number of backslash sequences which aren't supported by either the
echo program from GNU sh-utils or the bash echo built-in command.

Yes, GNU echo is not compliant. There is the '-e' switch but with a
syntax that is not the POSIX one (no leading 0).

In particular, the SuS version doesn't support the -n switch (don't
add a newline), but specifies a backslash sequence for this purpose;
however, neither of the aforementioned GNU implementations support the
backslash sequence. Consequently, we just have to accept that there is
no portable way to echo a string without a trailing newline. Waving a
copy of the SuS at the computer won't help.

echo "Blabla blabla" | tr -d '\n'

And multi line version:

echo "Blabla|blabla" | tr -d '\n' | tr '|' '\n'

BTW, I'm not suggesting that the "preferred" make program should be
anything other than GNU make. Just to re-iterate my position:

[FWIW I prefer BSD make. So it was not a plea for GNU make ;)]

1. Any future build system should be based around GNU make.

2. We should be willing to accept reasonable constraints in order to
accommodate other make utilities which are "sufficiently" compatible
with GNU make.

3. We shouldn't accept drastic constraints in order to accomodate
every possible make utility.

Agreed.

Cheers,
--
Thierry Laronde (Alceste) <tlaronde@polynum.org>
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C

On Wed, Nov 19, 2003 at 10:36:10AM +0100, Thierry Laronde wrote:

On Tue, Nov 18, 2003 at 10:16:00PM +0000, Glynn Clements wrote:

> BTW, I'm not suggesting that the "preferred" make program should be
> anything other than GNU make. Just to re-iterate my position:

> 1. Any future build system should be based around GNU make.
>
> 2. We should be willing to accept reasonable constraints in order to
> accommodate other make utilities which are "sufficiently" compatible
> with GNU make.
>
> 3. We shouldn't accept drastic constraints in order to accomodate
> every possible make utility.

Agreed.

Glynn's position also looks reasonable to me.