Getting the absolute physical path of the current Makefile' directory

Published on 2024-06-08 • Modified on 2024-06-08

This snippet shows how to get the absolute physical path of the current Makefile. The documentation is available by clicking the "Read the doc" link below.


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

.PHONY: root

root:
    echo $(ROOT_DIR)

 More on Stackoverflow   Read the doc  Random snippet

  Work with me!


Call to action

Did you like this post? You can help me back in several ways: (use the "reply" link on the right to comment or to contact me )

Thank you for reading! And see you soon on Strangebuzz! 😉

COil