Makefile: fix build for directories with spaces
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 <roman@faizullin.info> Signed-off-by: Paul Fertser <fercerpav@gmail.com>
This commit is contained in:
parent
88c20212ed
commit
283d8cc7d2
8
Makefile
8
Makefile
@ -30,7 +30,9 @@ LIBDIR := $(DESTDIR)/$(PREFIX)/lib
|
|||||||
SHAREDIR := $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts
|
SHAREDIR := $(DESTDIR)/$(PREFIX)/share/libopencm3/scripts
|
||||||
INSTALL := install
|
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 \
|
TARGETS:= stm32/f0 stm32/f1 stm32/f2 stm32/f3 stm32/f4 stm32/l1 lpc13xx lpc17xx \
|
||||||
lpc43xx/m4 lpc43xx/m0 lm3s lm4f \
|
lpc43xx/m4 lpc43xx/m0 lm3s lm4f \
|
||||||
@ -62,7 +64,7 @@ build: lib
|
|||||||
LIB_DIRS:=$(wildcard $(addprefix lib/,$(TARGETS)))
|
LIB_DIRS:=$(wildcard $(addprefix lib/,$(TARGETS)))
|
||||||
$(LIB_DIRS): $(IRQ_DEFN_FILES:=.genhdr)
|
$(LIB_DIRS): $(IRQ_DEFN_FILES:=.genhdr)
|
||||||
@printf " BUILD $@\n";
|
@printf " BUILD $@\n";
|
||||||
$(Q)$(MAKE) --directory=$@ SRCLIBDIR=$(SRCLIBDIR)
|
$(Q)$(MAKE) --directory=$@ SRCLIBDIR="$(SRCLIBDIR)"
|
||||||
|
|
||||||
lib: $(LIB_DIRS)
|
lib: $(LIB_DIRS)
|
||||||
$(Q)true
|
$(Q)true
|
||||||
@ -92,7 +94,7 @@ clean: $(IRQ_DEFN_FILES:=.cleanhdr) $(LIB_DIRS:=.clean) $(EXAMPLE_DIRS:=.clean)
|
|||||||
%.clean:
|
%.clean:
|
||||||
$(Q)if [ -d $* ]; then \
|
$(Q)if [ -d $* ]; then \
|
||||||
printf " CLEAN $*\n"; \
|
printf " CLEAN $*\n"; \
|
||||||
$(MAKE) -C $* clean SRCLIBDIR=$(SRCLIBDIR) || exit $?; \
|
$(MAKE) -C $* clean SRCLIBDIR="$(SRCLIBDIR)" || exit $?; \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ OBJS += vector.o systick.o scb.o nvic.o assert.o sync.o dwt.o
|
|||||||
all: $(SRCLIBDIR)/$(LIBNAME).a
|
all: $(SRCLIBDIR)/$(LIBNAME).a
|
||||||
|
|
||||||
$(SRCLIBDIR)/$(LIBNAME).a: $(SRCLIBDIR)/$(LIBNAME).ld $(OBJS)
|
$(SRCLIBDIR)/$(LIBNAME).a: $(SRCLIBDIR)/$(LIBNAME).ld $(OBJS)
|
||||||
@printf " AR $(@F)\n"
|
@printf " AR $(LIBNAME).a\n"
|
||||||
$(Q)$(AR) $(ARFLAGS) $@ $(OBJS)
|
$(Q)$(AR) $(ARFLAGS) "$@" $(OBJS)
|
||||||
|
|
||||||
$(SRCLIBDIR)/$(LIBNAME).ld: $(LIBNAME).ld
|
$(SRCLIBDIR)/$(LIBNAME).ld: $(LIBNAME).ld
|
||||||
@printf " CP $(@F)\n"
|
@printf " CP $(LIBNAME).ld\n"
|
||||||
$(Q)cp $^ $@
|
$(Q)cp $^ "$@"
|
||||||
$(Q)if [ -f $(LIBNAME)_rom_to_ram.ld ]; then cp $(LIBNAME)_rom_to_ram.ld $(SRCLIBDIR); fi
|
$(Q)if [ -f $(LIBNAME)_rom_to_ram.ld ]; then cp $(LIBNAME)_rom_to_ram.ld $(SRCLIBDIR); fi
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
|
Loading…
x
Reference in New Issue
Block a user