Makefile: Generate list with subdirectories
Considering your edit, you basically have 2 solutions :
Use a linux shell under Windows and use
$(shell find $(BASE_DIR) -type d)
.-
Use a condition on the OS you're running on :
BASE_DIR := . ifeq ($(OS),Windows_NT) DIRS := $(patsubst $(shell CHDIR )\\%,%,$(shell DIR /A:D /B /S $(BASE_DIR))) else DIRS := $(shell find $(BASE_DIR) -type d) endif $(info $(DIRS)) # print the variable .PHONY: all all:
Note that the space after CHDIR
in $(shell CHDIR )
is mandatory.