diff --git a/tools/top.mk b/tools/top.mk index d2388201a..fdae6337c 100644 --- a/tools/top.mk +++ b/tools/top.mk @@ -16,31 +16,14 @@ CMDEXE := 1 SHELL := cmd.exe endif -#$(info top.mk: SHELL=$(SHELL)) -#$(info top.mk: CMDEXE=$(CMDEXE)) - # Set TOP to be the path to get from the current directory (where make was # invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns # the name of this makefile relative to where make was invoked. THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) # strip off /tools/top.mk to get for example ../../.. -TOP := $(subst /tools/top.mk,,$(THIS_MAKEFILE)) -$(info top.mk: Initial TOP=$(TOP)) - -# Set TOP to an absolute path, for example /tinyUSB (from ../../..) -ifeq ($(CMDEXE),1) -TOP := $(subst \,/,$(shell for %%i in ( $(TOP) ) do echo %%~fi)) -else -TOP := $(abspath $(TOP)) -endif - -$(info top.mk: Top directory is $(TOP)) +# and Set TOP to an absolute path +TOP = $(abspath $(subst /tools/top.mk,,$(THIS_MAKEFILE))) # Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos -ifeq ($(CMDEXE),1) -CURRENT_PATH := $(subst $(TOP)/,,$(subst \,/,$(shell echo %CD%))) -else CURRENT_PATH = $(subst $(TOP)/,,$(abspath .)) -endif -$(info top.mk: CURRENT_PATH = $(CURRENT_PATH))