[Novalug] Indented word-wrapped echoing from a makefile
sean@mcgowanet.com
sean@mcgowanet.com
Thu Dec 13 08:51:59 EST 2012
Try piping your command to a sed -e 's/^/ /'.
Sent via BlackBerry by AT&T
-----Original Message-----
From: Michael Henry <lug-user@drmikehenry.com>
Sender: novalug-bounces@calypso.tux.org
Date: Thu, 13 Dec 2012 08:33:36
To: novalug<novalug@calypso.tux.org>
Subject: [Novalug] Indented word-wrapped echoing from a makefile
All,
I'm looking for an elegant way to wrap echoed text in a
makefile. Consider the following makefile (``wrap.mk``)::
LIST=some list of words like filenames
all:
@echo LIST=$(LIST) | fmt -w 1
The output of ``make -f wrap.mk`` is::
$ make -f wrap.mk
LIST=some
list
of
words
like
filenames
I'd like each word in LIST to be on its own line, indented, like
this::
LIST=
some
list
of
words
like
filenames
The above technique using ``fmt -w 1`` is concise and portable
(to Unix-like operating systems, anyway), but doesn't have the
indentation I'd like. To avoid introducing a new tool
dependency on Cygwin (where this makefile must run in addition
to running on Linux), I'm trying to avoid tools like Python and
Ruby (and possibly Perl as well), though I'd be interested to
see concise solutions in those languages as well for comparison.
Thanks,
Michael Henry
_______________________________________________
Novalug mailing list
Novalug@calypso.tux.org
http://calypso.tux.org/mailman/listinfo/novalug
More information about the Novalug
mailing list