Skip to content

Instantly share code, notes, and snippets.

@bbl
Created June 13, 2020 12:17
Show Gist options
  • Save bbl/5429c4a0a498c5ef91c10201e1b651c2 to your computer and use it in GitHub Desktop.
Save bbl/5429c4a0a498c5ef91c10201e1b651c2 to your computer and use it in GitHub Desktop.
Get Makefile root directory absolute path
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
test:
@echo $(ROOT_DIR)
@caruccio
Copy link

No need to exec a shell for dirname, just use function dir:

ROOT_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment