diff options
| author | kkitayam <[email protected]> | 2021-01-10 20:46:29 +0900 |
|---|---|---|
| committer | kkitayam <[email protected]> | 2021-01-11 15:56:16 +0900 |
| commit | 8fa083d79e1325c19f2bc0af894fdf7f8ab5e84c (patch) | |
| tree | 15f1fb9980fbc9c7706673e850438c77ca249214 /tools/top.mk | |
| parent | 05728e2b189b228a7b51f359dc207f54b85811ef (diff) | |
added support for cmd.exe as a shell on make.
Diffstat (limited to 'tools/top.mk')
| -rw-r--r-- | tools/top.mk | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tools/top.mk b/tools/top.mk index be51b3f4f..d276f5814 100644 --- a/tools/top.mk +++ b/tools/top.mk @@ -2,6 +2,12 @@ ifneq ($(lastword a b),b) $(error This Makefile require make 3.81 or newer) endif +# Detect windows or not +# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069 +ifeq '$(findstring ;,$(PATH))' ';' +UNAME := Windows +endif + # 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. @@ -9,9 +15,16 @@ endif THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST)) TOP := $(patsubst %/tools/top.mk,%,$(THIS_MAKEFILE)) +ifeq ($(UNAME),Windows) +TOP := $(subst \,/,$(shell for %%i in ( $(TOP) ) do echo %%~fi)) +else TOP := $(shell realpath $(TOP)) - +endif #$(info Top directory is $(TOP)) +ifeq ($(UNAME),Windows) +CURRENT_PATH := $(subst $(TOP)/,,$(subst \,/,$(shell echo %CD%))) +else CURRENT_PATH := $(shell realpath --relative-to=$(TOP) `pwd`) +endif #$(info Path from top is $(CURRENT_PATH)) |
