Common GNU makefile directory path

前端 未结 5 1143
我在风中等你
我在风中等你 2020-12-01 00:19

I\'m trying to consolidate some build information by using a common makefile. My problem is that I want to use that makefile from different subdirectory levels, which makes

5条回答
  •  甜味超标
    2020-12-01 00:51

    My solution:

    cwd  :=  $(shell readlink -en $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))) 
    

    This also works for calls like make -f /opt/some/dir/Makefile whenn your in /opt/other/path/subdir.

提交回复
热议问题