makefile 屏蔽输出 Entering/Leaving directory
阅读: 795
场景
先看看makefile
BUILD_DIR = ./tmp_build
all: build_android
cd $(BUILD_DIR); make clean
使用makefile编译的时候回出现大量的log
$ make all
cd ./tmp_build; make clean
make[1]: Entering directory '/home/swack/st/dev/mixo/tmp_build'
make[2]: Entering directory '/home/swack/st/dev/mixo/tmp_build'
make[3]: Entering directory '/home/swack/st/dev/mixo/tmp_build'
make[3]: Leaving directory '/home/swack/st/dev/mixo/tmp_build'
make[3]: Entering directory '/home/swack/st/dev/mixo/tmp_build'
make[3]: Leaving directory '/home/swack/st/dev/mixo/tmp_build'
make[2]: Leaving directory '/home/swack/st/dev/mixo/tmp_build'
make[1]: Leaving directory '/home/swack/st/dev/mixo/tmp_build'
解决
方法一
可以直接使用makefile的参数
make all --no-print-directory
方法二
我们可以把参数放到makefile中去
BUILD_DIR = ./tmp_build
all: build_android
cd $(BUILD_DIR); make clean MAKEFLAGS=--no-print-directory
方法三
可以将参数设置为全局,这样执行就类似于 方法一
MAKEFLAGS+= --no-print-directory
BUILD_DIR = ./tmp_build
all: build_android
cd $(BUILD_DIR); make clean