[comp.software-eng] Problem with an earlier make tip

bernhold@qtp.ufl.edu (David E. Bernholdt) (10/23/89)

Some time ago in this group there was a discussion of "tricks" to help
produce more general makefiles -- the original question, I think had
something to do with defining the CFLAGS macro (for example) in a
machine-dependent way.

One of the responses was from David Hough at Sun who attributed the
following trick (use of recursive macro definitions) to the creator of make:

Define macros like:
	CFLAGS-sun = some stuff
	CFLAGS-cray = other stuff
and then
	CFLAGS = $(CFLAGS-$(MACHINE))
where you define MACHINE on the command line or some other convenient
place.


I jumped on this and found it quite useful, however I've since
discovered that it isn't very portable!  It appears that some versions
of make *don't* understand recursive evaluation of macros.

Although I have only a few different machines available on which to
try this out, my present suspicion is that BSD make does it and SysV
make does not.

I don't know enough about the geneology (sp?) of the various
implementations of make to know if my guess is correct or even
reasonable.

Can anyone shed some light on why "some do and some don't" or perhaps
how I can accomplish this trick in a more general way?

Note:  I am already familiar with numerous make replacements -- I am
not interested in replacing make at this point, just in getting this
trick to work on most of the common implementations of make (if
possible).

Thanks for any help.
-- 
David Bernholdt			bernhold@qtp.ufl.edu
Quantum Theory Project		bernhold@ufpine.bitnet
University of Florida
Gainesville, FL  32611		904/392 6365