summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-11-26 11:44:05 +0700
committerGitHub <[email protected]>2018-11-26 11:44:05 +0700
commit4ec7dba453d414d0c0c67c6f5bab5a9ca9eba388 (patch)
tree9d13e00d699168d4681617925fac8e102ccb1495 /tools
parent3bb53273cd3770328f55ba317af3df0cce4333c1 (diff)
parent61bea0db1c645324a44b37327d6630ab85d40f39 (diff)
Merge pull request #15 from tannewt/makefile
Add Makefile support for the cdc_msc_hid example
Diffstat (limited to 'tools')
-rw-r--r--tools/top.mk17
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/top.mk b/tools/top.mk
new file mode 100644
index 000000000..991f9b16a
--- /dev/null
+++ b/tools/top.mk
@@ -0,0 +1,17 @@
+ifneq ($(lastword a b),b)
+$(error This Makefile require make 3.81 or newer)
+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.
+
+THIS_MAKEFILE := $(lastword $(MAKEFILE_LIST))
+TOP := $(patsubst %/tools/top.mk,%,$(THIS_MAKEFILE))
+
+TOP := $(shell realpath $(TOP))
+
+$(info Top directory is $(TOP))
+
+CURRENT_PATH := $(shell realpath --relative-to=$(TOP) `pwd`)
+$(info Path from top is $(CURRENT_PATH))