about summary refs log tree commit diff
path: root/GNUmakefile
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-11-22 00:53:38 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2018-11-22 00:53:38 +0000
commit2bac3b28489811b74478118dcfce12c9232d8f5e (patch)
tree06e16438cca48bc2170bf85d4edf8de21c539e94 /GNUmakefile
parentbbeaa55023675ff92b9eb8e1a8d73ec91e6bb7d2 (diff)
downloadnetpbm-mirror-2bac3b28489811b74478118dcfce12c9232d8f5e.tar.gz
netpbm-mirror-2bac3b28489811b74478118dcfce12c9232d8f5e.tar.xz
netpbm-mirror-2bac3b28489811b74478118dcfce12c9232d8f5e.zip
Fix parallel make
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@3439 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'GNUmakefile')
-rw-r--r--GNUmakefile26
1 files changed, 17 insertions, 9 deletions
diff --git a/GNUmakefile b/GNUmakefile
index f7a87d35..1beebb4c 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -102,19 +102,27 @@ 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 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.
+# Completely parallel make (make --jobs) does not work because there are
+# multiple targets somewhere in the Netpbm build that depend upon pm_config.h
+# and similar targets, and the threads building those multiple targets might
+# simultaneously find that pm_config.h needs to be built and proceed to build
+# it.  After one thread has built pm_config.h, it will proceed to use
+# pm_config.h, but the other thread is still building pm_config.h, which is
+# not valid while it is in the middle of being built.
+#
+# But many submakes don't have any such shared dependencies, so build their
+# targets in parallel just fine.  So we declare this make file ineligible for
+# parallel make and have special dependencies to get pm_config.h and like
+# targets built before any submakes begin.  The submakes will thus never find
+# that pm_config.h needs to be built, so we leave them eligible for parallel
+# make.
+
+.NOTPARALLEL:
 
 $(SUBDIRS:%=%/all) lib/util/all: pm_config.h inttypes_netpbm.h version.h
 $(PROG_SUBDIRS:%=%/all): lib/all $(SUPPORT_SUBDIRS:%=%/all)
 lib/all: lib/util/all
+netpbm: lib/all
 
 .PHONY: lib/util/all
 lib/util/all: