about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile23
1 files changed, 12 insertions, 11 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 3a02ea03..f7a87d35 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -102,14 +102,15 @@ all: nonmerge
 .PHONY: nonmerge
 nonmerge: $(PRODUCT_SUBDIRS:%=%/all)
 
-# Parallel make (make --jobs) is not smart enough to coordinate builds
-# between submakes, so a naive parallel make would cause certain
-# targets to get built multiple times simultaneously.  That is usually
-# unacceptable.  So we introduce extra dependencies here just to make
-# sure such targets are already up to date before the submake starts,
-# for the benefit of parallel make.  Note that we ensure that parallel
-# make works for 'make all' in the top directory, but it may still fail
-# for the aforementioned reason for other invocations.
+# Parallel make (make --jobs) is not smart enough to coordinate builds between
+# submakes, so a naive parallel make would cause certain targets to be seen as
+# existing by one thread while another thread is in the process of creating
+# it.  Also, multiple threads may build a target simultaneously.  So we
+# introduce extra dependencies here just to make sure such targets are already
+# up to date before the submake starts, for the benefit of parallel make.
+# Note that we ensure that parallel make works for 'make all' in the top
+# directory, but it may still fail for the aforementioned reason for other
+# invocations.
 
 $(SUBDIRS:%=%/all) lib/util/all: pm_config.h inttypes_netpbm.h version.h
 $(PROG_SUBDIRS:%=%/all): lib/all $(SUPPORT_SUBDIRS:%=%/all)
@@ -140,7 +141,7 @@ $(TYPEGEN) $(ENDIANGEN): $(BUILDDIR)/buildtools
 	$(MAKE) -C $(dir $@) -f $(SRCDIR)/buildtools/Makefile \
 	    SRCDIR=$(SRCDIR) BUILDDIR=$(BUILDDIR) $(notdir $@) 
 
-inttypes_netpbm.h: $(TYPEGEN)
+$(BUILDDIR)/inttypes_netpbm.h: $(TYPEGEN)
 	$(TYPEGEN) >$@
 
 
@@ -156,7 +157,7 @@ $(TESTRANDOM): $(BUILDDIR)/test
 # that or to override the results, because it doesn't work if he's
 # cross compiling.
 
-pm_config.h: \
+$(BUILDDIR)/pm_config.h: \
   $(SRCDIR)/pm_config.in.h config.mk inttypes_netpbm.h \
   $(ENDIANGEN)
 # Note that this rule depends on the effect of the .DELETE_ON_ERROR
@@ -198,7 +199,7 @@ endif
 MAJOR := $(NETPBM_MAJOR_RELEASE)
 MINOR := $(NETPBM_MINOR_RELEASE)
 POINT := $(NETPBM_POINT_RELEASE)
-version.h: $(SRCDIR)/version.mk
+$(BUILDDIR)/version.h: $(SRCDIR)/version.mk
 	@rm -f $@
 	@echo "/* Generated by make file rule */" >>$@
 	@echo "#define NETPBM_VERSION" \