makefile多级目录的调用

来源:互联网 发布:淘宝联盟软件 编辑:程序博客网 时间:2024/06/05 15:56
SUBDIRS := ./webrtc_common ./rtc_base_approved    ./cpu_features_linux   ./system_wrappers  ./common_audio_sse2
SUBDIRS +=  ./audio_processing_sse2  ./audio_encoder_interface ./audioproc_debug_proto
SUBDIRS += ./dl    ./isac_common   ./common_audio ./audio_decoder_interface    ./isac
CXX :=  g++

export CXX

.PHONY : all clean

all:
    for n in $(SUBDIRS);do $(MAKE) -C $$n ; done

clean:

    for n in $(SUBDIRS);do $(MAKE) clean -C $$n ; done

ps:自己在make -C 的时候发现:只能进入一个目录内操作makefile文件,再多的文件路径无法进入。

所以在makefile中使用循环即可。