clean up top
This commit is contained in:
21
tools/top.mk
21
tools/top.mk
@@ -16,31 +16,14 @@ CMDEXE := 1
|
|||||||
SHELL := cmd.exe
|
SHELL := cmd.exe
|
||||||
endif
|
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
|
# 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
|
# invoked) to the top of the tree. $(lastword $(MAKEFILE_LIST)) returns
|
||||||
# the name of this makefile relative to where make was invoked.
|
# the name of this makefile relative to where make was invoked.
|
||||||
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
||||||
|
|
||||||
# strip off /tools/top.mk to get for example ../../..
|
# strip off /tools/top.mk to get for example ../../..
|
||||||
TOP := $(subst /tools/top.mk,,$(THIS_MAKEFILE))
|
# and Set TOP to an absolute path
|
||||||
$(info top.mk: Initial TOP=$(TOP))
|
TOP = $(abspath $(subst /tools/top.mk,,$(THIS_MAKEFILE)))
|
||||||
|
|
||||||
# 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))
|
|
||||||
|
|
||||||
# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
|
# 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 .))
|
CURRENT_PATH = $(subst $(TOP)/,,$(abspath .))
|
||||||
endif
|
|
||||||
$(info top.mk: CURRENT_PATH = $(CURRENT_PATH))
|
|
||||||
|
Reference in New Issue
Block a user