首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

makefile中的shell函数,该怎么处理

2013-11-01 
makefile中的shell函数all:cd ./ttecho $(shell pwd)cd ..得到的是tt的父目录,而不是tt的绝对路径,为什

makefile中的shell函数
all:
    cd ./tt;echo $(shell pwd);cd ..

得到的是tt的父目录,而不是tt的绝对路径,为什么啊?不是cd 到./tt后,在执行了 pwd吗? makefile shell
[解决办法]
如果是这样(假定我理解了lz的需求),就简单了。
假设有目录层次(不管多少目录都是类似的):
./
 
[解决办法]
--- Makfile
 
[解决办法]

  -- tt
      
[解决办法]

       --- Makefile
即: ./Makefile
    ./tt/Makefile

./Makefile:

all:
@cd ./tt; make


./tt/Makefile:
all:
@echo $(PWD)

子目录的Makefile只需要获取 PWD 变量的内容就可以了。而不需要使用 shell 函数。

热点排行