Skip to content

Commit

Permalink
Merge pull request #865 from tymcauley/feature/make-with-fd
Browse files Browse the repository at this point in the history
Use 'fd' rather than 'find' in makefiles if available
  • Loading branch information
abejgonzalez authored Apr 28, 2021
2 parents 1fd2ccc + 7d32e6c commit 1b16e75
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ include $(base_dir)/tools/dromajo/dromajo.mk
# Prerequisite lists
#########################################################################################
# Returns a list of files in directory $1 with file extension $2.
lookup_srcs = $(shell find -L $(1)/ -name target -prune -o -iname "*.$(2)" -print 2> /dev/null)
# If available, use 'fd' to find the list of files, which is faster than 'find'.
ifeq ($(shell which fd),)
lookup_srcs = $(shell find -L $(1)/ -name target -prune -o -iname "*.$(2)" -print 2> /dev/null)
else
lookup_srcs = $(shell fd -L ".*\.$(2)" $(1))
endif

SOURCE_DIRS = $(addprefix $(base_dir)/,generators sims/firesim/sim tools/barstools/iocell fpga/fpga-shells fpga/src)
SCALA_SOURCES = $(call lookup_srcs,$(SOURCE_DIRS),scala)
Expand Down

0 comments on commit 1b16e75

Please sign in to comment.