Hi, On 2013-06-05 14:37 -0700, Kip Warner wrote: > My make install target for my autotool'd project's translations > directory has a number of prerequisites. The one which seems to be > causing trouble is the install-data-yes target. Yes, I am aware the path > I am using contains spaces and yes I am aware that makefiles can choke > on it if not properly dealt with (e.g. escaped). From the final > generated Makefile... > > install-data-yes: all > @catalogs='$(CATALOGS)'; \ > for cat in $$catalogs; do \ > cat=`basename $$cat`; \ > lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \ > dir=$(localedir)/$$lang/LC_MESSAGES; \ > $(mkdir_p) $(DESTDIR)$$dir; \
This fragment appears incomplete. Moreover, the link provided below is broken, so we cannot see the whole Makefile.am. It is unclear why the above would choke on spaces in the working directory, since it does not at a first glance appear to reference it at all. How are CATALOGS and localedir defined? By using @ to suppress the command invocation you have rendered the make output essentially useless, because we cannot see what shell command is actually being run by make. I suspect the problem would be obvious if you did not use @. I recommend avoiding @ for the most part, especially for complex shell commands like the above! Automake documents restrictions on filenames in the manual, but notably does not mention (regular) spaces in build or install directories as problematic. There are a couple spots where you can definitely run into trouble, but for the most part I'd expect things to work (albeit this configuration is probably not heavily used or tested). However, you are missing some necessary quoting for the cases where DESTDIR or localedir contain spaces. I suspect this is your main problem. > The second to last line seems to be causing problems. > > $ pwd > ~/Projects/Avaneya/Extras/Viking Lander Remastered/Extractor/Translations > > $ make install --debug > > Must remake target `install-data-yes'. > /bin/sh: 5: Lander: not found > /bin/mkdir: missing operand > Try '/bin/mkdir --help' for more information. > /usr/bin/install: cannot create regular file > ‘/viking-extractor.mo’: Permission denied I can only guess that you have defined localedir = Viking Lander Remastered or similar. This will obviously fail in your rule since it lacks the necessary quoting for the shell. Without the quoting, the shell sees dir=Viking Lander Remastered/$lang/LC_MESSAGES You can try running that manually in bash or similar. So that explains the first error. The second error is explained by the fact that this broken shell command now is not a normal variable assignment: it sets dir only in the environment of the (non-existent) Lander command, so dir is empty for the mkdir command, explaining the second error. The third error does not appear to have come from your snippet. Properly quoting your shell commands should fix it up. Also, a little error handling goes a long way: your rule totally ignored the (easily detectable!) errors and just happily proceeded as if nothing was wrong. The make rule then proceeded to run installation commands with garbage arguments, and appears to have subsequently attempted to create files directly in /. Keep in mind that install rules are often run as the superuser. It's no fun for anyone involved when a buggy makefile trashes someone's root filesystem... > The project's Makefile.am is here: > > <https://bazaar.launchpad.net/~avaneya/avaneya/trunk/view/head:/Extras/Viking%20Lander%20Remastered/Extractor/Makefile.am> Broken link? Hope that helps, -- Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/)