2018-11-24 10:55:51 -08:00
|
|
|
ifneq ($(lastword a b),b)
|
2023-01-22 12:11:50 -05:00
|
|
|
$(error This Makefile requires make 3.81 or newer)
|
2018-11-24 10:55:51 -08:00
|
|
|
endif
|
|
|
|
|
|
2021-01-14 01:19:43 +09:00
|
|
|
# Detect whether shell style is windows or not
|
2021-01-10 20:46:29 +09:00
|
|
|
# https://stackoverflow.com/questions/714100/os-detecting-makefile/52062069#52062069
|
|
|
|
|
ifeq '$(findstring ;,$(PATH))' ';'
|
2023-01-22 12:11:50 -05:00
|
|
|
# PATH contains semicolon - so we're definitely on Windows.
|
2023-01-30 17:21:48 +07:00
|
|
|
CMDEXE := 1
|
|
|
|
|
|
|
|
|
|
# makefile shell commands should use syntax for DOS CMD, not unix sh
|
2023-01-22 12:11:50 -05:00
|
|
|
# Unfortunately, SHELL may point to sh or bash, which can't accept DOS syntax.
|
|
|
|
|
# We can't just use sh, because while sh and/or bash shell may be available,
|
|
|
|
|
# many Windows environments won't have utilities like realpath used below, so...
|
2023-01-30 17:21:48 +07:00
|
|
|
# Force DOS command shell on Windows.
|
|
|
|
|
SHELL := cmd.exe
|
2021-01-10 20:46:29 +09:00
|
|
|
endif
|
|
|
|
|
|
2018-11-24 10:55:51 -08:00
|
|
|
# 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.
|
2023-01-30 17:21:48 +07:00
|
|
|
THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
|
|
|
|
|
|
|
|
|
|
# strip off /tools/top.mk to get for example ../../..
|
2023-03-06 13:03:55 +07:00
|
|
|
# and Set TOP to an absolute path
|
|
|
|
|
TOP = $(abspath $(subst /tools/top.mk,,$(THIS_MAKEFILE)))
|
2018-11-24 10:55:51 -08:00
|
|
|
|
2023-01-22 12:11:50 -05:00
|
|
|
# Set CURRENT_PATH to the relative path from TOP to the current directory, ie examples/device/cdc_msc_freertos
|
2023-03-03 15:55:34 +07:00
|
|
|
CURRENT_PATH = $(subst $(TOP)/,,$(abspath .))
|