Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jun 2002 10:38:42 -0700
From:      Juli Mallett <jmallett@FreeBSD.org>
To:        Akinori MUSHA <knu@iDaemons.org>
Cc:        Trevor Johnson <trevor@jpj.net>, Mikhail Teterin <mi+mx@aldan.algebra.com>, Pete Fritchman <petef@absolutbsd.org>, portmgr@freebsd.org, Maxim Sobolev <sobomax@freebsd.org>, cvs-committers@freebsd.org, cvs-all@freebsd.org
Subject:   Re: cvs commit: ports/Mk bsd.port.mk
Message-ID:  <20020614103842.A92261@FreeBSD.ORG>
In-Reply-To: <86hek56abw.wl@archon.local.idaemons.org>; from knu@iDaemons.org on Sat, Jun 15, 2002 at 02:26:11AM %2B0900
References:  <200206141102.50292.mi%2Bmx@aldan.algebra.com> <20020614113752.K11520-100000@blues.jpj.net> <86k7p16c4q.wl@archon.local.idaemons.org> <20020614101409.A88549@FreeBSD.ORG> <86hek56abw.wl@archon.local.idaemons.org>

next in thread | previous in thread | raw e-mail | index | archive | help
* Akinori MUSHA <knu@iDaemons.org> escriurères
> At Fri, 14 Jun 2002 10:14:10 -0700,
> Juli Mallett wrote:
> > sed 's/foo/bar/;s/blah/bleh/' file | tee file > /dev/null
> 
> Surely that'll work, but it has to be a single command to be used in
> the ports infrastructure, no?

Well, could be done via a make(1) rule, maybe?  Aside that, no because you
could use some :: rules generated by some definitions.

.if defined(REGEX_REPLACE)
.for file in ${REGEX_REPLACE_FILES}
regex-replace::
.if defined(REGEX_REPLACE_${file})
	sed ${REGEX_REPLACE_${file}} ${file} | tee ${file} > /dev/null
.else
	sed ${REGEX_REPLACE} ${file} | tee ${file} > /dev/null
.endif
.endfor
.endif
.if target(regex-replace)
all: regex-replace
.endif

And then in a Makefile,

REGEX_REPLACE=	s/foo/bar/
REGEX_REPLACE_foo.c=	s/barf/blah/
REGEX_REPLACE_FILES=	foo.c bar.blah heh.hoh dum.di.dum

Or similar?

Of course I'm not how sure that "surely" that will work, because I haven't
read tee(1)'s code in a long time, but something along those lines is not
hard.
-- 
Juli Mallett <jmallett@FreeBSD.org>                  FreeBSD: The Power To Serve
Perception is prejudice / Don't classify me / Accept me as me / Not what you see

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020614103842.A92261>