stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r292586 - /incubator/stdcxx/trunk/etc/config/makefile.rules
Date Fri, 30 Sep 2005 00:25:15 GMT
Author: sebor
Date: Thu Sep 29 17:25:12 2005
New Revision: 292586

URL: http://svn.apache.org/viewcvs?rev=292586&view=rev
Log:
2005-09-29  Martin Sebor  <sebor@roguewave.com>

	* makefile.rules: Optimized the inclusion of dependencies to just
	those needed (rather than all of them) when MAKECMDGOALS is non-empty
	(i.e., when at least one goal has been specified on the command line).
	Removed .c from .SUFFIXES.


Modified:
    incubator/stdcxx/trunk/etc/config/makefile.rules

Modified: incubator/stdcxx/trunk/etc/config/makefile.rules
URL: http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/makefile.rules?rev=292586&r1=292585&r2=292586&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/makefile.rules (original)
+++ incubator/stdcxx/trunk/etc/config/makefile.rules Thu Sep 29 17:25:12 2005
@@ -57,9 +57,6 @@
 #  COMMON RULES
 ##############################################################################
 
-#empty rule for .cc files so they won't be separately compiled
-%: %.cc ; 
-
 # compile and link in one or two steps
 ifeq ($(NO_DOT_O),)
 
@@ -137,25 +134,26 @@
         fi ;                                                              \
         exit 0)
 
-# include the automatically generated dependencies unless "make clean"
-ifneq ($(MAKECMDGOALS),clean)
-  ifneq ($(MAKECMDGOALS),realclean)
-    ifneq ($(MAKECMDGOALS),dependclean)
-      ifneq ($(SRCS),)
-
-        -include $(patsubst %.cpp,$(DEPENDDIR)/%.d,$(filter %.cpp,$(SRCS)))
-
-        ifneq ($(filter %.s,$(SRCS)),)
-          -include $(patsubst %.s,$(DEPENDDIR)/%.d,$(filter %.s,$(SRCS)))
-        endif
-
-        ifneq ($(filter %.S,$(SRCS)),)
-          -include $(patsubst %.S,$(DEPENDDIR)/%.d,$(filter %.S,$(SRCS)))
-        endif
-      endif   # neq ($(SRCS),)
-    endif   # neq ($(MAKECMDGOALS),dependclean)
-  endif   # neq ($(MAKECMDGOALS),realclean)
-endif   # neq ($(MAKECMDGOALS),clean)
+# include the automatically generated dependencies unless "clean"
+# or similar is one of the targets
+ifeq ($(findstring clean,$(MAKECMDGOALS)),)
+
+  ifeq ($(MAKECMDGOALS),)
+    # include all dependencies (can be slow when there are a lot of them)
+    DEPS := $(patsubst %.cpp,$(DEPENDDIR)/%.d,$(filter %.cpp,$(SRCS)))
+    DEPS += $(patsubst %$(AS_EXT),$(DEPENDDIR)/%.d,$(filter %$(AS_EXT),$(SRCS)))
+  else
+    # as a (potentially significant) optimization, include
+    # only the dependencies for the explicitly specified goals
+    DEPS := $(addprefix $(DEPENDDIR)/,$(basename $(MAKECMDGOALS)))
+    DEPS := $(addsuffix .d,$(DEPS))
+  endif
+
+  # (try to) include the dependency file(s), failing gracefully
+  # if they don't exist (e.g., in the case of a .PHONY goal)
+  -include $(DEPS)
+
+endif   # eq ($(findstring clean,$(MAKECMDGOALS)),)
 
 
 ifneq ($(DEPENDFLAGS),)
@@ -201,21 +199,17 @@
       fi)
 endef
 
-$(DEPENDDIR)/%.d: %.cpp
-	$(makedep)
-
-$(DEPENDDIR)/%.d: %.$(AS_EXT)
+$(DEPENDDIR)/%.d: %.cpp %.$(AS_EXT)
 	$(makedep)
 
-else
+else   # ifeq ($(DEPENDFLAGS),)
 
 $(DEPENDDIR)/%.d:
 
 endif   # neq ($(DEPENDFLAGS),)
 
 
-# force the regeneration of all dependencies
-#  by removing them
+# force the regeneration of all dependencies by removing them
 dependclean:
 	rm -f $(DEPENDDIR)/*.d; 
 	@echo "dependencies will be regenerated at the next invocation of make"
@@ -227,6 +221,12 @@
 	         $(warning $V=$($V) ($(value $V)))))
 
 
+# define a set of phony targets that make should make unconditionally
+# regardless of whether files with the same name exist and their
+# timestamps
 .PHONY: all c_headers clean dependclean realclean config configure listtarget \
        listruntarget listsrc listobj listvpath listsubtests printvars \
        run run_all runall
+
+# override the default set of suffixes with our own
+.SUFFIXES: .a .cpp .d .o .$(AS_EXT)



Mime
View raw message