diff options
authorRobin H. Johnson <>2018-01-23 17:57:55 -0500
committerJens Axboe <>2018-01-23 15:59:13 -0700
commit519fd9a5d08d85f3d9cb4192d624fe8351e40232 (patch)
parentd1398e339585f6750f7158c50c98861b68dddc8b (diff)
fix parallel build failures
When building in parallel, the btreplay/btrecord and btreplay/btreplay targets cause make to kick off two jobs for `make -C btreplay` and they sometimes end up clobbering each other. We could fix this by making one a dependency of the other, but it's a bit cleaner to refactor things to be based on subdirs. This way changes in subdirs also get noticed: $ touch btreplay/*.[ch] $ make <btreplay is now correctly updated> Signed-off-by: Robin H. Johnson <> Signed-off-by: Mike Frysinger <> Signed-off-by: Jens Axboe <>
1 files changed, 10 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 68de591..5917814 100644
--- a/Makefile
+++ b/Makefile
PROGS = blkparse blktrace verify_blkparse blkrawverify blkiomon
LIBS = -lpthread
SCRIPTS = btrace
+SUBDIRS = btreplay btt iowatcher
-ALL = $(PROGS) $(SCRIPTS) btt/btt btreplay/btrecord btreplay/btreplay \
+INSTALL_ALL = $(ALL) btt/btt btreplay/btrecord btreplay/btreplay \
btt/ iowatcher/iowatcher
-all: $(ALL)
+all: $(ALL) $(SUBDIRS)
- $(MAKE) -C btt
- $(MAKE) -C iowatcher
- $(MAKE) -C btreplay
- $(MAKE) -C btreplay
+# We always descend into subdirs because they contain their own dependency
+# information which we don't track in this top level Makefile.
+ $(MAKE) -C $@
%.o: %.c
$(CC) -o $*.o -c $(ALL_CFLAGS) $<
@@ -85,7 +81,7 @@ install: all
$(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man8
- $(INSTALL) -m 755 $(ALL) $(DESTDIR)$(bindir)
+ $(INSTALL) -m 755 $(INSTALL_ALL) $(DESTDIR)$(bindir)
$(INSTALL) -m 644 doc/*.1 $(DESTDIR)$(mandir)/man1
$(INSTALL) -m 644 doc/*.8 $(DESTDIR)$(mandir)/man8