1. 获取目录下所有子目录
主要原理是通多shell的find命令获取目录的子目录信息
find . -maxdepth 3 -type d
获取当前目录的所有三级子目录以内的目录信息,type d表示只获取目录信息
修改成Makefile格式即可
SUBDIRS= ./core
CXX_DIRS = $(shell find $(SUBDIRS) -maxdepth 3 -type d)
$(warning "CXX_DIRS: $(CXX_DIRS)")
output:
Makefile:40: "CXX_DIRS: ./core ./core/framebuffer ./core/src ./core/include ./core/include/data ./core/include/enum"