On Wed, 30 Mar 2005, Phil Dibowitz wrote:

> Darren Reed wrote:
> >
> > So long as it keeps working, what's the problem?
> > When/if they remove /usr/ccs/bin/make, then I'll worry...
>
> There's no problem. It's a pretty crufty make. As long as you don't
> require anything in /usr/ucb I'm OK. I was just throwing it out, as I've
> never seen a makefile that worked with solaris make but not gnu make.

Well, I like being able to compile code on a new box with just the
vendor-provided tools, and since IPFilter is one of the first things I
build when bootstrapping a new version of the OS, I'd certainly prefer to
not _have_ to go load up a bunch of "optional" software;  but, since Sun
is providing more and more GNU stuff by default now, it may be a moot
point.

Anyway, having had to work in environments where both the Sun and GNU make
had to work, I discovered one major difference that was highly annoying,
but came up with a gross/clever workaround. :-)  To test and set variables
derived from shell commands, the syntax is incompatible:

GNU:    THISHOST = $(shell hostname)
Sun:    THISHOST:sh = hostname

However, you _can_ actually just do both assignments (in that order) and
your makefile will work in both environments:

THISHOST = $(shell hostname)            # GNU first
THISHOST:sh = hostname                  # then Sun

Sun make first sets $(THISHOST) to "$(shell hostname)", then on the next
line properly sets the correct value;  GNU make sets $(THISHOST) correctly
the first time, then sets a bogus $(THISHOST:sh) which you just ignore.

Clever, but gross. :-)  I think that's the only major (badly documented)
incompatibility, and the workaround is silly but not too painful.  I
haven't looked at the IPF4/pfil makefiles to see if this is even an
issue...

-- Chris

Reply via email to