|
From: | John Burger |
Subject: | Re: Manual substitution (was: Default for libexecdir) |
Date: | Wed, 9 Apr 2003 10:21:59 -0400 |
Bill Moseley <address@hidden> writes:
Well, this is what I'm using in a Makefile.am: CLEANFILES = swish.cgi swish.cgi: swish.cgi.in @rm -f swish.cgi @sed \ -e 's,@@perlmoduledir@@,$(libexecdir)/perl,' \ -e 's,@@swishbindir@@,$(bindir),' \ -e 's,@@perlbinary@@,$(PERL),' \ $(srcdir)/swish.cgi.in > swish.cgi Is there a better way to do those substitutions? I can't use @bindir@ directly as it gets replaced in the Makefile generation, of course.
We don't use automake, but we used to have something like the following in our Makefiles:
SUBSTPAT = $(PERL) -pe 's/@([\w]+)@/$$ENV{$$1} || $$&/ge;' Then, following your example above, we might have a rule like this: %.cgi : #.cgi.inPERL=$(PERL) perlmoduledir=$(perlmoduledir) ... $(SUBSTPAT) $< > address@hidden
$(INSTALL_PROGRAM) address@hidden $@ rm -f address@hidden where the .in files have @PERL@ etc.We now have a mkscript perl script that does all of this with some other bells and whistles, but it's basically the same as the above. As a geeky aside, my favorite part of our build is the following bootstrap:
mkscript: mkscript.pl PERL=$(PERL) $(PERL) $< < $< > address@hidden ... - John Burger MITRE
[Prev in Thread] | Current Thread | [Next in Thread] |