When full path of a source directory has spaces in it, that makes
shell and Make split the path, so special treatment is
necessary. Additionally, @F doesn't honour the escaping, so has to be
avoided.

Reported-by: Roman Faizullin <ro...@faizullin.info>
Signed-off-by: Paul Fertser <fercer...@gmail.com>
---
 Makefile             | 8 +++++---
 lib/Makefile.include | 8 ++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 1f66bfc..0edf3f7 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,9 @@ LIBDIR                := $(DESTDIR)/$(PREFIX)/lib
 SHAREDIR       := $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts
 INSTALL                := install
 
-SRCLIBDIR:= $(realpath lib)
+space:=
+space+=
+SRCLIBDIR:= $(subst $(space),\$(space),$(realpath lib))
 
 TARGETS:= stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/l1 lpc13xx 
lpc17xx \
          lpc43xx/m4 lpc43xx/m0 lm3s lm4f \
@@ -62,7 +64,7 @@ build: lib
 LIB_DIRS:=$(wildcard $(addprefix lib/,$(TARGETS)))
 $(LIB_DIRS): $(IRQ_DEFN_FILES:=.genhdr)
        @printf "  BUILD   $@\n";
-       $(Q)$(MAKE) --directory=$@ SRCLIBDIR=$(SRCLIBDIR)
+       $(Q)$(MAKE) --directory=$@ SRCLIBDIR="$(SRCLIBDIR)"
 
 lib: $(LIB_DIRS)
        $(Q)true
@@ -92,7 +94,7 @@ clean: $(IRQ_DEFN_FILES:=.cleanhdr) $(LIB_DIRS:=.clean) 
$(EXAMPLE_DIRS:=.clean)
 %.clean:
        $(Q)if [ -d $* ]; then \
                printf "  CLEAN   $*\n"; \
-               $(MAKE) -C $* clean SRCLIBDIR=$(SRCLIBDIR) || exit $?; \
+               $(MAKE) -C $* clean SRCLIBDIR="$(SRCLIBDIR)" || exit $?; \
        fi;
 
 
diff --git a/lib/Makefile.include b/lib/Makefile.include
index 4c44bf6..70fdd5c 100644
--- a/lib/Makefile.include
+++ b/lib/Makefile.include
@@ -29,12 +29,12 @@ OBJS += vector.o systick.o scb.o nvic.o assert.o sync.o 
dwt.o
 all: $(SRCLIBDIR)/$(LIBNAME).a
 
 $(SRCLIBDIR)/$(LIBNAME).a: $(SRCLIBDIR)/$(LIBNAME).ld $(OBJS)
-       @printf "  AR      $(@F)\n"
-       $(Q)$(AR) $(ARFLAGS) $@ $(OBJS)
+       @printf "  AR      $(LIBNAME).a\n"
+       $(Q)$(AR) $(ARFLAGS) "$@" $(OBJS)
 
 $(SRCLIBDIR)/$(LIBNAME).ld: $(LIBNAME).ld
-       @printf "  CP      $(@F)\n"
-       $(Q)cp $^ $@
+       @printf "  CP      $(LIBNAME).ld\n"
+       $(Q)cp $^ "$@"
        $(Q)if [ -f $(LIBNAME)_rom_to_ram.ld ]; then cp 
$(LIBNAME)_rom_to_ram.ld $(SRCLIBDIR); fi
 
 %.o: %.c
-- 
1.8.3.2


------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls. 
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
libopencm3-devel mailing list
libopencm3-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libopencm3-devel

Reply via email to