I'm creating a makefile for GNU make. I want to find all files within a directory structure. For this I tried:
find_files_recursive = $(wildcard $(1)/*)$(foreach dir,$(wildcard $(1)/*),$(call find_files_recursive,$(dir)))
$(info $(call find_files_recursive,.))
The problem is that this prints also the directories, not only files. Any ideas how to eliminate directories?
Edit:
I have to create an OS independent solution. So the Unix-way find -type f
is no alternative. But it is exactly what I have to solve.
Used solution: Based on the accepted answer I developed a shorter version:
find_files_recursive = $(foreach item,$(wildcard $(1)/*),$(if $(wildcard $(item)/.),$(call find_files_recursive,$(item),$(2)),$(item)))