[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Manual substitution (was: Default for libexecdir)

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

CLEANFILES = swish.cgi
        @rm -f swish.cgi
        @sed \
                -e 's,@@perlmoduledir@@,$(libexecdir)/perl,' \
                -e 's,@@swishbindir@@,$(bindir),' \
                -e 's,@@perlbinary@@,$(PERL),' \
                         $(srcdir)/ > 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 :
PERL=$(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:

        PERL=$(PERL) $(PERL) $< < $< > address@hidden

- John Burger

reply via email to

[Prev in Thread] Current Thread [Next in Thread]