Master Makefile - 从当前路径转到目录

问题描述 投票:1回答:1

我想创建一个Master Makefile,我从中转到子目录并调用其他Makefile。对于这个主Makefile,我做了:

DIR_1D = $(dir $(mkfile_dir))1D
DIR_2D = $(dir $(mkfile_dir))2D
DIR_3D = $(dir $(mkfile_dir))3D

# Phony target
.PHONY: all clean

all:
        @(cd $(DIR_1D) ; $(MAKE))
        @(cd $(DIR_2D) ; $(MAKE))
        @(cd $(DIR_3D) ; $(MAKE))

# Clean target
clean:
        @(cd $(DIR_1D) ; $(MAKE) $@)
        @(cd $(DIR_2D) ; $(MAKE) $@)
        @(cd $(DIR_3D) ; $(MAKE) $@)

更新:对不起,愚蠢的拼写错误,修复,谢谢

makefile
1个回答
2
投票

你设置变量DIR_1DDIR_2DDIR_3D,但你的cd命令使用DIR_1DIR_2DIR_3。由于您没有设置这些变量,因此您运行的cd没有参数,而cd没有参数意味着cd "$HOME"

© www.soinside.com 2019 - 2024. All rights reserved.