It's the $. Since $ denotes a variable in Makefiles, you have to use $$ in order for it to make it to the shell, like $$dir.
In general, this kind of directory recursion is a hack tho. For example, errors in the resursive parts of the script aren't handled as well as errors in regular parts of the Makefile.
.hc
On Mar 26, 2007, at 3:17 AM, Alexandre Quessy wrote:
Hi again, I made it a bit better. I still get 2 errors. (see below) I think that something gets expanded badly in the sed expression that makes it not match what I want, hence it doesn't remove the unwanted path for every file that is found. (see the part saying "src/pdmtl/src: No such file or directory") This is quite funky even though it doesn't even build anything ! ;-)
alex
======================== makefile ================== all: pdmtl_install
# remove these 3 variables abstractions_src = src objectsdir = objects helpdir = help
# pdmtl PDMTL_NAME = pdmtl pdmtl_install: install -d $(objectsdir)/$(PDMTL_NAME) for dir in `find $(abstractions_src)/$(PDMTL_NAME) -type d | grep -v 'examples' | sed 's,$(abstractions_src)/$(PDMTL_NAME)/,,'`; do \ install -d $(objectsdir)/$(PDMTL_NAME)/$$dir; \ for fil in `find $(abstractions_src)/$(PDMTL_NAME)/$$dir -name '*.pd' | grep -v '-help' | sed "s,$(abstractions_src)/$(PDMTL_NAME)/$$dir/,,"`; do \ install -p $(abstractions_src)/$(PDMTL_NAME)/$$dir/$$fil $(objectsdir)/$(PDMTL_NAME)/$$dir; \ done; \ done install -d $(helpdir)/$(PDMTL_NAME) for dir in `find $(abstractions_src)/$(PDMTL_NAME) -type d | sed 's,$(abstractions_src)/$(PDMTL_NAME)/,,'`; do \ install -d $(helpdir)/$(PDMTL_NAME)/$$dir; \ for fil in `find $(abstractions_src)/$(PDMTL_NAME)/$$dir -type f | grep '.mov|.jpg|.ttf|.keys|.wav|-help.pd' | sed "s,$(abstractions_src)/$(PDMTL_NAME)/$$dir/,,"`; do \ install -p $(abstractions_src)/$(PDMTL_NAME)/$$dir/$$fil $(helpdir)/$(PDMTL_NAME)/$$dir; \ done; \ done done @echo Done installing the Pure Data Montreal Abstractions library
======================== output ===============
install -d objects/pdmtl for dir in `find src/pdmtl -type d | grep -v 'examples' | sed 's,src/pdmtl/,,'`; do \ install -d objects/pdmtl/$dir; \ for fil in `find src/pdmtl/$dir -name '*.pd' | grep -v '-help' | sed "s,src/pdmtl/$dir/,,"`; do \ install -p src/pdmtl/$dir/$fil objects/pdmtl/$dir; \ done; \ done find: src/pdmtl/src: No such file or directory install -d help/pdmtl for dir in `find src/pdmtl -type d | sed 's,src/pdmtl/,,'`; do \ install -d help/pdmtl/$dir; \ for fil in `find src/pdmtl/$dir -type f | grep '.mov|.jpg|.ttf|.keys|.wav|-help.pd' | sed "s,src/pdmtl/$dir/,,"`; do \ /bin/sh: Syntax error: end of file unexpected (expecting "done") make: *** [pdmtl_install] Error 2
======================================
2007/3/26, Alexandre Quessy listes@sourcelibre.com:
Something like this ?
all: pdmtl PDMTL_NAME = pdmtl abstractions_src = . pdmtl_install: install -d $(objectsdir)/$(PDMTL_NAME) install -d $(helpdir)/$(PDMTL_NAME) for dir in `find $(abstractions_src)$(PDMTL_NAME) -type d | grep -v 'examples'`; do \ install -d $(objectsdir)/$(PDMTL_NAME)/$$dir; \ for f in `find $(abstractions_src)$(PDMTL_NAME)/$ $dir -name '*.pd' | grep -v '-help'`; do \ install -p $$f $(objectsdir)/$(PDMTL_NAME)/ $$dir; \ done; \ done; \ for dir in `find $(abstractions_src)$(PDMTL_NAME) -type d`; do \ install -d $(helpdir)/$(PDMTL_NAME)/$$dir; \ for typ in '.mov' '.jpg' '.ttf' '.keys' '.wav' '- help.pd'; do \ for f in `find $(abstractions_src)$ (PDMTL_NAME)/$$dir -name $$typ`; do \ install -p $$f $(helpdir)/$ (PDMTL_NAME)/$$dir; \ done; \ done; \ done;
2007/3/23, Hans-Christoph Steiner hans@eds.org:
Makefiles are largely tied to bourne shell scripts, so that
would be
the preferred scripting language with Makefiles. You can write bourne shell code right into the Makefile. For directory recursion or pattern matching, check out these files:
externals/Makefile - $(wildcard ...) and $(shell sed ...) pd/src/makefile.in - for dir in $(shell ...)
And others too
.hc
On Mar 22, 2007, at 2:57 AM, Alexandre Quessy wrote:
Hi all, I want to add the pdmtl abstractions in the CVS. (I have a
developper
account.) Our library uses many directories so that our
abstractions
names look like [generate/adsr~] and [seq/liner], for
instance. Now,
having several directories that might (will) change over time
makes it
a bit longer to write a Makefile entry to make it part of the pd-extended build system. Is there somewhere a Makefile syntax
to make
it automagic ? Otherwise, this could be a ($shell ) thing with
a find
and a bunch of grep. Other solution : generate the makefile
with a
Python script, for instance. Anyone has a quick solution for
this ?
Other point: I need to put this in the abstractions part of
the CVS,
right ? I would rather put it in externals, but if you
insist... ;)
Thanks for helping. By the way, this structure is a kind of a
proposal
for a system to classify externals and abstractions by what
they do,
not by they author's name. See http://pdmtl.goto10.org for
more infos.
-- Alexandre Quessy http://alexandre.quessy.net
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
¡El pueblo unido jamás será vencido!
-- Alexandre Quessy http://alexandre.quessy.net
-- Alexandre Quessy http://alexandre.quessy.net
------------------------------------------------------------------------ ----
I have the audacity to believe that peoples everywhere can have three meals a day for their bodies, education and culture for their minds, and dignity, equality and freedom for their spirits. - Martin Luther King, Jr.