jsnyder / avr32-toolchain

Makefile & supporting patches/scripts to build an AVR32 toolchain.
29 stars 30 forks source link

Build fails if $(CURDIR) contains spaces #5

Open ilg-ul opened 13 years ago

ilg-ul commented 13 years ago

I moved the entire build environment to a new folder named "No Backup" (ignored by Time Machine) and then I tried again to run the build.

It failed, and it left another folder called "No", so I guess the SUPP_PREFIX needs some quotes to protect the space.

Liviu

jsnyder commented 13 years ago

Hmm.. my first attempt at fixing this in baf8064 does not seem to have fixed the problem. It appears that automake at least doesn't escape some things when it runs commands later on. i.e.:

make install-data-hook chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/config.guess chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/config.guess: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/config.sub chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/config.sub: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/install-sh chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/install-sh: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/mdate-sh chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/mdate-sh: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/missing chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/missing: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/mkinstalldirs chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/mkinstalldirs: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/elisp-comp chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/elisp-comp: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/ylwrap chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/ylwrap: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/acinstall chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/acinstall: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/depcomp chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/depcomp: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/compile chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/compile: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/py-compile chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/py-compile: No such file or directory chmod +x /Users/jsnyder/Sources/avr32 toolchain/supp/share/automake-1.11/symlink-tree chmod: /Users/jsnyder/Sources/avr32: No such file or directory chmod: toolchain/supp/share/automake-1.11/symlink-tree: No such file or directory

(renamed the directory to "avr32 toolchain").

I think based on trying double quoting etc, I might just need to escape the spaces myself. It seems like there's a bug in automake's build system that causes it not to escape properly.

kblomqvist commented 12 years ago

Spaces in directory paths can be escaped. In Makefile this is a bit magic. First you have to get space into a string

space:=
space+=

Now this can be used in $(subst)

$(subst $(space),\$(space),$(SUPP_PREFIX))

Edit: Seems like this will work too

$(subst $(space),\ ,$(SUPP_PREFIX))
ilg-ul commented 5 years ago

you completely lost me... :-(

Skyskipper11 commented 5 years ago

@ilg-ul sorry my bad. I was using CURDIR in Makefile and the same issue appeared, i am using top :=(CURDIR) null := space :=$(null) $(null) $(subst $(space),\$(space),$(top)) to remove the spaces, but it doesn't work. I think it is due to CURDIR which doesn't stores the last space in the path.

ilg-ul commented 5 years ago

the initial issue is more than 8 years old, I completely forgot what this is all about (no longer using AVRs), but I hope the author still remembers details and hopefully can assist you.

Skyskipper11 commented 5 years ago

@ilg-ul thanks :)

JustRedTTG commented 1 year ago

You can try the following as I did. Replace spaces with backslash spaces

space := $(subst ,, )
CURDIR := $(subst $(space),\$(space),$(CURDIR))
JustRedTTG commented 1 year ago

Or add a warning to not have spaces:

ifneq (1,$(words $(CURDIR)))
$(error Containing path cannot contain whitespace: '$(CURDIR)')
endif