mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-14 04:18:56 +00:00
clean up top
This commit is contained in:
parent
9930863b41
commit
b6404d143e
21
tools/top.mk
21
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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user