1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #5221 from Kijewski/rm-rf-safe

make: bail out if there are spaces in the path
This commit is contained in:
Cenk Gündoğan 2016-04-20 23:47:01 +02:00
commit 8a85725cf9

View File

@ -4,23 +4,43 @@
all:
# set undefined variables
RIOTBASE ?= $(shell dirname "$(lastword $(MAKEFILE_LIST))")
RIOTBASE := $(abspath $(RIOTBASE))
RIOTBASE ?= $(dir $(lastword $(MAKEFILE_LIST)))
CCACHE_BASEDIR ?= $(RIOTBASE)
RIOTCPU ?= $(RIOTBASE)/cpu
RIOTBOARD ?= $(RIOTBASE)/boards
RIOTPKG ?= $(RIOTBASE)/pkg
RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd)
GITCACHE ?= $(RIOTBASE)/dist/tools/git/git-cache
APPDIR ?= $(CURDIR)
BINDIRBASE ?= $(APPDIR)/bin
BINDIR ?= $(BINDIRBASE)/$(BOARD)
CCACHE_BASEDIR := $(RIOTBASE)
__DIRECTORY_VARIABLES := RIOTBASE CCACHE_BASEDIR RIOTCPU RIOTBOARD RIOTPKG GITCACHE RIOTPROJECT APPDIR BINDIRBASE BINDIR
RIOTCPU ?= $(RIOTBASE)/cpu
RIOTCPU := $(abspath $(RIOTCPU))
# Make all paths absolute.
override RIOTBASE := $(abspath $(RIOTBASE))
override CCACHE_BASEDIR := $(abspath $(CCACHE_BASEDIR))
override RIOTCPU := $(abspath $(RIOTCPU))
override RIOTBOARD := $(abspath $(RIOTBOARD))
override RIOTPKG := $(abspath $(RIOTPKG))
override RIOTPROJECT := $(abspath $(RIOTPROJECT))
override GITCACHE := $(abspath $(GITCACHE))
override APPDIR := $(abspath $(APPDIR))/
override BINDIRBASE := $(abspath $(BINDIRBASE))
override BINDIR := $(abspath $(BINDIR))/
RIOTBOARD ?= $(RIOTBASE)/boards
RIOTBOARD := $(abspath $(RIOTBOARD))
# Ensure that all directories are set and don't contain spaces.
ifneq (, $(filter-out 1, $(foreach v,${__DIRECTORY_VARIABLES},$(words ${${v}}))))
$(info Aborting compilation for your safety.)
$(info Related variables = ${__DIRECTORY_VARIABLES})
$(error Make sure no path override is empty or contains spaces!)
endif
RIOTPKG ?= $(RIOTBASE)/pkg
# Use absolute paths in recusive "make" even if overriden on command line.
MAKEOVERRIDES += $(foreach v,${__DIRECTORY_VARIABLES},${v}=${${v}})
RIOTPROJECT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || pwd)
RIOTPROJECT := $(abspath $(RIOTPROJECT))
GITCACHE:=$(RIOTBASE)/dist/tools/git/git-cache
# Path to the current directory relative to the git root
BUILDRELPATH ?= $(shell git rev-parse --show-prefix)
# Include Docker settings near the top because we need to build the environment
# command line before some of the variable origins are overwritten below when
@ -30,18 +50,6 @@ include $(RIOTBASE)/Makefile.docker
# Static code analysis tools provided by LLVM
include $(RIOTBASE)/Makefile.scan-build
# Path to the current directory relative to the git root
BUILDRELPATH ?= $(shell git rev-parse --show-prefix)
APPDIR ?= $(CURDIR)
APPDIR := $(abspath $(APPDIR))/
BINDIRBASE ?= $(APPDIR)/bin
BINDIRBASE := $(abspath $(BINDIRBASE))
BINDIR ?= $(BINDIRBASE)/$(BOARD)
BINDIR := $(abspath $(BINDIR))/
COLOR_GREEN :=
COLOR_RED :=
COLOR_PURPLE :=