Please note that active projects have migrated to https://github.com/fawkesrobotics.

buildsys: add implicit parallel-* targets
authorTim Niemueller <niemueller@kbsg.rwth-aachen.de>
Wed, 30 May 2018 10:04:47 +0000 (12:04 +0200)
committerTim Niemueller <niemueller@kbsg.rwth-aachen.de>
Wed, 30 May 2018 11:33:34 +0000 (13:33 +0200)
This is intended for automatic builds for continuous integration. You
probably should not use this on the command line. Note, that this may be
stacked with uncolored, but "parallel-" must be the prefix, e.g.,
parallel-uncolored-all.

Note that the parallel target is a root target. It only works in the
top-level directory, not for individual builds for, e.g., plugins.

etc/buildsys/root/parallel.mk [new file with mode: 0644]
etc/buildsys/root/root.mk

diff --git a/etc/buildsys/root/parallel.mk b/etc/buildsys/root/parallel.mk
new file mode 100644 (file)
index 0000000..55470bb
--- /dev/null
@@ -0,0 +1,23 @@
+#*****************************************************************************
+#            Makefile Build System for Fawkes: parallel-* targets
+#                              -------------------
+#   Created on Wed May 30 11:59:55 2018
+#   Copyright (C) 2006-2018 by Tim Niemueller, AllemaniACs RoboCup Team
+#
+#*****************************************************************************
+#
+#   This program is free software; you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation; either version 2 of the License, or
+#   (at your option) any later version.
+#
+#*****************************************************************************
+
+# Parallel implicit targets
+parallel-%:
+       $(SILENT)if [ "$(filter -j% --jobs=% --jobserver-auth=%,$(MAKEFLAGS))" != "" ]; then \
+               echo -e "$(INDENT_STRING)[ERROR] $(TRED)Cannot call target $@ with '$(filter -j% --jobs=%,$(MAKEFLAGS))'$(TNORMAL)"; \
+               exit 1; \
+       else \
+               $(MAKE) --no-print-directory --no-keep-going -j$(shell nproc) $*; \
+       fi
index 2b96d6f..71a5188 100644 (file)
@@ -23,6 +23,7 @@ __buildsys_parts_root_mk_ := 1
 include $(BUILDSYSDIR)/root/docs.mk
 include $(BUILDSYSDIR)/root/check.mk
 include $(BUILDSYSDIR)/root/btmgmt.mk
+include $(BUILDSYSDIR)/root/parallel.mk
 include $(BUILDSYSDIR)/root/uncolored.mk
 
 endif # __buildsys_root_root_mk_