Write the objfiles.txt rules in a way that is compatible with GNU make 3.78,
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 29 Feb 2008 10:34:51 +0000 (10:34 +0000)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 29 Feb 2008 10:34:51 +0000 (10:34 +0000)
and simpler, too.

src/backend/common.mk

index fef03728afb158e773ecd6a5253e39ce1e38394f..0e4b54764ce4d9e0fbcf7815245d7d2d09319bb8 100644 (file)
@@ -26,11 +26,9 @@ endif
 SUBSYS.o: $(SUBDIROBJS) $(OBJS)
        $(LD) $(LDREL) $(LDOUT) $@ $^
 
-objfiles.txt:: $(MAKEFILE_LIST) | $(SUBDIROBJS) $(OBJS)
-       ( $(if $(SUBDIROBJS),cat $(SUBDIROBJS); )echo $(addprefix $(subdir)/,$(OBJS)) ) >$@
-
-objfiles.txt:: $(SUBDIROBJS) $(OBJS)
-       touch $@
+objfiles.txt: Makefile $(SUBDIROBJS) $(OBJS)
+# Only rebuild the list if it does not exist or the Makefile has changed.
+       $(if $(filter $<,$?),( $(if $(SUBDIROBJS),cat $(SUBDIROBJS); )echo $(addprefix $(subdir)/,$(OBJS)) ) >$@,touch $@)
 
 # make function to expand objfiles.txt contents
 expand_subsys = $(foreach file,$(1),$(if $(filter %/objfiles.txt,$(file)),$(patsubst ../../src/backend/%,%,$(addprefix $(top_builddir)/,$(shell cat $(file)))),$(file)))