build: filter out relative directory entries from $PATH
[librecmc/librecmc.git] / include / toplevel.mk
index 0e6c55ae08d0dc323a31e283f276163bfd7f4353..0b5ac2686fd76e9a3298a4619079905e46f7cb09 100644 (file)
@@ -39,6 +39,13 @@ unexport LPATH
 # make sure that a predefined CFLAGS variable does not disturb packages
 export CFLAGS=
 
+empty:=
+space:= $(empty) $(empty)
+path:=$(subst :,$(space),$(PATH))
+path:=$(filter-out .%,$(path))
+path:=$(subst $(space),:,$(path))
+export PATH:=$(path)
+
 unexport TAR_OPTIONS
 
 ifneq ($(shell $(HOSTCC) 2>&1 | grep clang),)
@@ -213,7 +220,7 @@ docs/clean: FORCE
        @$(_SINGLE)$(SUBMAKE) -C docs clean
 
 distclean:
-       rm -rf tmp build_dir staging_dir dl .config* feeds package/feeds package/openwrt-packages bin
+       rm -rf bin build_dir .config* dl feeds key-build* logs package/feeds package/openwrt-packages staging_dir tmp
        @$(_SINGLE)$(SUBMAKE) -C scripts/config clean
 
 ifeq ($(findstring v,$(DEBUG)),)