about summary refs log tree commit diff
path: root/MakeTAGS
diff options
context:
space:
mode:
Diffstat (limited to 'MakeTAGS')
-rw-r--r--MakeTAGS31
1 files changed, 20 insertions, 11 deletions
diff --git a/MakeTAGS b/MakeTAGS
index 29dfc47f01..96dc59e587 100644
--- a/MakeTAGS
+++ b/MakeTAGS
@@ -43,7 +43,8 @@ sysdep-dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
 
 ifndef sysdep_dirs
 # Find all sysdep directories.
-sysdep_dirs := $(shell find $(..)sysdeps -type d ! -name RCS -print)
+sysdep_dirs := $(shell find $(..)sysdeps -type d \
+					 ! -name RCS ! -name CVS -print)
 endif
 
 # Find all sysdep dirs there are, but putting the ones
@@ -53,6 +54,11 @@ all-dirs := $(objdir) \
 	    $(source_dirs) \
 	    $(filter-out $(sysdep-dirs),$(sysdep_dirs))
 
+vpath %.h $(all-dirs)
+vpath %.c $(all-dirs)
+vpath %.S $(all-dirs)
+vpath %.s $(all-dirs)
+
 # Find all the subdirs there are, but putting the ones
 # we are configured to use first and preserving their order.
 ifndef subdir
@@ -71,18 +77,21 @@ else
 all-dist = $(distribute)
 endif
 
+sources += $(filter %.c %.s %.S,$(all-dist))
+headers += $(filter %.h,$(all-dist))
+all-dist := $(filter-out %.h %.c %.s %.S,$(all-dist))
+
 # All different versions of $(sources), preserving the configured sysdep
 # directory order.
-all-sources = $(wildcard $(foreach file,$(sources),\
-				   $(file) \
-				   $(foreach dir,$(all-dirs),\
-					     $(dir)/$(file) \
-					     $(dir)/$(file:.c=.S) \
-					     $(dir)/$(file:.c=.s))))
-
-all-headers = $(wildcard $(foreach file,$(headers),\
-				   $(file) \
-				   $(foreach dir,$(all-dirs),$(dir)/$(file))))
+all-sources = $(shell find $(all-dirs) -maxdepth 1 \( -name fnord \
+			   $(foreach file,$(sort $(sources) $(sources:.c=.S) \
+						 $(sources:.c=.s)),\
+				     -o -name $(file)) \
+			   \) -print)
+
+all-headers = $(shell find $(all-dirs) -maxdepth 1 \( -name fnord \
+			   $(foreach file,$(headers),-o -name $(file)) \
+			   \) -print)
 
 tags_sources := $(strip $(tags_sources))