Thread: Template matching, a different perspective

Template matching, a different perspective

From
Peter Eisentraut
Date:
One thing that occurred to me, if I'm going to rejuggle the templates, why
not name them like the Makefile.${os} and the include/port/${os}.h? We
don't really need two matching logics and no matter how smart we make the
template matching, there's still nothing to be gained if we don't find the
right Makefile.port and include/port/os.h (which we apparently do). So
perhaps get rid of all the fanciness and just use the name detected by the
big case statement at the top of configure.in? (And then treat the subtle
differences *within* the template files.)

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden



Re: Template matching, a different perspective

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
> One thing that occurred to me, if I'm going to rejuggle the templates, why
> not name them like the Makefile.${os} and the include/port/${os}.h? We
> don't really need two matching logics and no matter how smart we make the
> template matching, there's still nothing to be gained if we don't find the
> right Makefile.port and include/port/os.h (which we apparently do).

Er, um, hmm ... for some reason I'd thought the Makefile and port files
were selected by the template file, but I see they ain't.  I agree
that's pretty stupid; no point in smart template matching if the other
part falls over.

If we are eliminating the compiler choice from the template names, then
I think you've got a good idea: make a one-for-one correspondence
between templates, Makefile.ports, and os.h's.

If we do that then I'd still like to see a --with-template option, but
now it'd select all three files, and would provide a way for the user
to override that big case on $host_os.  (Alternatively, if the regular
configure "--host" option allows the same result, then we wouldn't need
--with-template anymore.)

BTW, if you are going to end up editing most or all of the templates
anyway, I'd suggest getting rid of that hack about substituting : to =,
and make the templates plain-vanilla shell scripts.  I put the hack
in awhile ago because I didn't want to edit all the templates, but
I was just being lazy :-(
        regards, tom lane