build-system: Parallel build all subdirs.

This commit is contained in:
Chris Johns
2017-05-14 11:52:52 +10:00
parent 86ae03c691
commit a748603cb4
31 changed files with 215 additions and 107 deletions

View File

@@ -11,8 +11,8 @@ SUBDIRS = . $(RTEMS_BSP)
DIST_SUBDIRS = $(RTEMS_BSP)
## Let all RTEMS' make targets depend on ${RTEMS_BSP}
all-local: ${RTEMS_BSP}
preinstall-am: ${RTEMS_BSP}
all-local: $(RTEMS_BSP)
preinstall-am: $(RTEMS_BSP)
## Pull in extra files intro the distribution
EXTRA_DIST = ACKNOWLEDGEMENTS

View File

@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I aclocal
SUBDIRS = . @BSP_SUBDIRS@
_SUBDIRS = . @BSP_SUBDIRS@
DIST_SUBDIRS = @BSP_SUBDIRS@
clean-local:

View File

@@ -1,30 +1,87 @@
## Borrowed from automake-1.4 and adapted to RTEMS
## Copyright 2017 Chris Johns <chrisj@rtems.org>
## NOTE: This is a temporary work-around to keep
## RTEMS's non automake standard make targets working.
## Once automake is fully integrated these make targets
## and this file will probably be removed
##
## The following builds in parallel. The subdirectories are
## expanded into separate rules and all the targets are listed
## and make runs as many as it can.
##
## A macro is defined and evaluated once for each directory. This
## creates the instance of the rule. Use $(info ...) to print them.
##
preinstall-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
## This trick allows "-k" to keep its natural meaning when running a
## recursive rule.
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
SUBDIRS_dot = $(filter .,$(_SUBDIRS))
SUBDIRS_no_dot = $(filter-out .,$(_SUBDIRS))
SUBDIRS_no_dot_no_wrapup = $(filter-out wrapup,$(SUBDIRS_no_dot))
SUBDIRS_no_dot_no_testsuites = $(filter-out testsuites,$(SUBDIRS_no_dot))
SUBDIRS_no_dot_no_wrapup_no_testsuites = $(filter-out testsuites,$(SUBDIRS_no_dot_no_wrapup))
SUBDIRS_wrapup = $(filter wrapup,$(SUBDIRS_no_dot))
SUBDIRS_testsuites = $(filter testsuites,$(SUBDIRS_no_dot))
preinstall: preinstall-recursive
.PHONY: preinstall-recursive
SUBDIR_TARGET = $(subst /,-,$1)
PREINSTALL_TARGET = preinstall-$(call SUBDIR_TARGET,$(1))
preintstall_targets = $(if "$(SUBDIRS_dot)" ".",preinstall-dot) $(foreach D,$(SUBDIRS_no_dot),$(call PREINSTALL_TARGET,$(D)))
define PREINSTALL_DIR
.PHONY: $1
$1:
@+set fnord $(MAKEFLAGS); amf=$$$$2; \
subdir=$(2); \
subdir_label=`echo $(1) | sed -e 's/preinstall-//'`; \
target=`echo $$@ | sed -e 's/-recursive//' -e "s/-$$$${subdir_label}//"`$(3); \
echo "Making $$$$target in $$$$subdir"; \
(cd $$$$subdir && $(MAKE) $(AM_MAKEFLAGS) $$$$target) \
|| case "$$$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac;
endef
$(if "$(SUBDIRS_dot)" ".",$(eval $(call PREINSTALL_DIR,preinstall-dot,.,-am)))
$(foreach D,$(SUBDIRS_no_dot),$(eval $(call PREINSTALL_DIR,$(call PREINSTALL_TARGET,$(D)),$(D))))
preinstall: $(preintstall_targets)
.PHONY: preinstall
define CPUKITDIR
.PHONY: $1
$1: $(preintstall_targets)
@+set fnord $(MAKEFLAGS); amf=$$$$2; \
subdir=$(2); \
target=`echo $(MAKECMDGOALS) | sed s/-recursive//`; \
if test "$$$$target" = "all-local-am"; then \
target="all-am"; \
fi; \
if test "$$$$target" = "all-local"; then \
target="all"; \
fi; \
echo "Making $$$$target in $$$$subdir"; \
if test "$$$$subdir" != "."; then \
cd $$$$subdir; \
$(MAKE) $(AM_MAKEFLAGS) $$$$local_target; \
fi;
endef
#
# This GNU make syntax is being used to stop automake thinking the code is for
# it.
#
$(if "$(SUBDIRS_dot)" ".",$(eval $(call CPUKITDIR,dot,.)))
$(foreach D,$(SUBDIRS_no_dot),$(eval $(call CPUKITDIR,$(D),$(D))))
#
# If there is a wrapup make it depend on all other directories except the
# testsuite so it is not entered until everything but the testsuite has
# finished.
#
$(if "$(SUBDIRS_wrapup)" "wrapup",wrapup: dot $(SUBDIRS_no_dot_no_wrapup_no_testsuites))
#
# If there is a testsuite make it depend on all other directories so it is not
# entered until everything else has finished.
#
$(if "$(SUBDIRS_testsuites)" "testsuites",testsuites: dot $(SUBDIRS_no_dot_no_testsuites))
#
# The general build all rule for automake.
#
all-local: preinstall $(if "$(SUBDIRS_dot)" ".",dot) $(SUBDIRS_no_dot)

View File

@@ -1,4 +1,9 @@
SUBDIRS = libcpu libbsp
_SUBDIRS = libcpu libbsp
include $(top_srcdir)/automake/subdirs.am
include $(top_srcdir)/automake/local.am
#
# The libsp cannot be built until libcpu is built.
#
libbsp: libcpu

View File

@@ -1,6 +1,6 @@
include $(top_srcdir)/automake/compile.am
SUBDIRS = @libbsp_cpu_subdir@
_SUBDIRS = @libbsp_cpu_subdir@
DIST_SUBDIRS = @libbsp_cpu_subdir@
EXTRA_DIST = MERGE.PROCEDURE bsp.am
@@ -42,5 +42,5 @@ include_bsp_HEADERS += shared/include/console-termios.h
include_bsp_HEADERS += shared/include/gpio.h
include $(srcdir)/preinstall.am
include $(top_srcdir)/automake/subdirs.am
include $(top_srcdir)/automake/local.am
include $(top_srcdir)/automake/subdirs.am

View File

@@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
## Currently, the shared directory is not explicitly
## added but it is present in the source tree.
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include_bspdir = $(includedir)/bsp
include_bsp_HEADERS = shared/include/linker-symbols.h

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
# Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(top_srcdir)/../../../automake/subdirs.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
## Currently, the shared directory is not explicitly
## added but it is present in the source tree.
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../automake/subdirs.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
EXTRA_DIST =

View File

@@ -23,7 +23,7 @@ DISTCLEANFILES = include/bspopts.h
noinst_PROGRAMS =
SUBDIRS = . tools
_SUBDIRS = . tools
nodist_include_bsp_HEADERS += include/bspimpl.h
include_bsp_HEADERS = ../../i386/shared/irq/irq.h
@@ -258,3 +258,4 @@ EXTRA_DIST += times_p5
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../../automake/local.am
include $(top_srcdir)/../../../../automake/subdirs.am

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
# Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(top_srcdir)/../../../automake/subdirs.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
EXTRA_DIST =

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include_bspdir = $(includedir)/bsp
include_bsp_HEADERS = shared/include/linker-symbols.h

View File

@@ -13,7 +13,7 @@ nodist_include_HEADERS = include/bspopts.h
nodist_include_bsp_HEADERS = ../../shared/include/bootcard.h
DISTCLEANFILES = include/bspopts.h
SUBDIRS = . tools
_SUBDIRS = . tools
include_HEADERS += include/coverhd.h
include_HEADERS += include/i2c.h

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(top_srcdir)/../../../automake/subdirs.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -5,7 +5,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
# Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(top_srcdir)/../../../automake/subdirs.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
# Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(top_srcdir)/../../../automake/subdirs.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
# Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(top_srcdir)/../../../automake/subdirs.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -3,7 +3,7 @@ ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
## Currently, the shared directory is not explicitly
## added but it is present in the source tree.
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../automake/subdirs.am

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
# FIXME: This does not work
# DIST_SUBDIRS = @all_subdirs@ support/old_exception_processing \

View File

@@ -1,9 +1,9 @@
ACLOCAL_AMFLAGS = -I ../../../../aclocal
SUBDIRS = .
SUBDIRS+= bootloader
_SUBDIRS = .
_SUBDIRS += bootloader
if QEMU
SUBDIRS+= qemu_fakerom
_SUBDIRS += qemu_fakerom
endif
include $(top_srcdir)/../../../../automake/compile.am
@@ -166,3 +166,4 @@ EXTRA_DIST += times.mcp750 times.mvme2307
include $(srcdir)/preinstall.am
include $(top_srcdir)/../../../../automake/local.am
include $(top_srcdir)/../../../../automake/subdirs.am

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
# Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
EXTRA_DIST =
EXTRA_DIST += shared/console.c

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
# Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
EXTRA_DIST =

View File

@@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
include $(top_srcdir)/../../../automake/subdirs.am
include $(top_srcdir)/../../../automake/local.am

View File

@@ -6,7 +6,7 @@ ACLOCAL_AMFLAGS = -I ../../../aclocal
## Descend into the @RTEMS_BSP_FAMILY@ directory
## Currently, the shared directory is not explicitly
## added but it is present in the source tree.
SUBDIRS = @RTEMS_BSP_FAMILY@
_SUBDIRS = @RTEMS_BSP_FAMILY@
EXTRA_DIST =

View File

@@ -4,7 +4,7 @@ EXTRA_DIST =
EXTRA_DIST += shared/include/cache.h
EXTRA_DIST += shared/src/cache_manager.c
SUBDIRS = @libcpu_cpu_subdir@
_SUBDIRS = @libcpu_cpu_subdir@
DIST_SUBDIRS = @libcpu_cpu_subdir@
include $(top_srcdir)/automake/subdirs.am

View File

@@ -4,30 +4,30 @@ include $(top_srcdir)/automake/compile.am
include $(top_srcdir)/automake/multilib.am
# librtemscpu
SUBDIRS = . score rtems sapi posix
SUBDIRS += dev
SUBDIRS += dtc/libfdt
SUBDIRS += libcrypt
SUBDIRS += libcsupport libblock libfs
SUBDIRS += libdrvmgr
SUBDIRS += libnetworking librpc
SUBDIRS += libpci
SUBDIRS += libi2c
SUBDIRS += libmisc
SUBDIRS += libmd
SUBDIRS += libgnat
SUBDIRS += libdl
SUBDIRS += libstdthreads
SUBDIRS += libdebugger
SUBDIRS += wrapup
_SUBDIRS = . score rtems sapi posix
_SUBDIRS += dev
_SUBDIRS += dtc/libfdt
_SUBDIRS += libcrypt
_SUBDIRS += libcsupport libblock libfs
_SUBDIRS += libdrvmgr
_SUBDIRS += libnetworking librpc
_SUBDIRS += libpci
_SUBDIRS += libi2c
_SUBDIRS += libmisc
_SUBDIRS += libmd
_SUBDIRS += libgnat
_SUBDIRS += libdl
_SUBDIRS += libstdthreads
_SUBDIRS += libdebugger
_SUBDIRS += wrapup
SUBDIRS += zlib
_SUBDIRS += zlib
# applications
SUBDIRS += ftpd
SUBDIRS += telnetd
SUBDIRS += pppd
SUBDIRS += mghttpd
_SUBDIRS += ftpd
_SUBDIRS += telnetd
_SUBDIRS += pppd
_SUBDIRS += mghttpd
noinst_DATA = preinstall-stamp
preinstall-stamp:

View File

@@ -1,30 +1,74 @@
## Borrowed from automake-1.4 and adapted to RTEMS
## Copyright 2017 Chris Johns <chrisj@rtems.org>
## NOTE: This is a temporary work-around to keep
## RTEMS's non automake standard make targets working.
## Once automake is fully integrated these make targets
## and this file will probably be removed
##
## The following builds in parallel. The subdirectories are
## expanded into separate rules and all the targets are listed
## and make runs as many as it can.
##
## A macro is defined and evaluated once for each directory. This
## creates the instance of the rule. Use $(info ...) to print them.
##
preinstall-recursive:
@set fnord $(MAKEFLAGS); amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
(cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
## This trick allows "-k" to keep its natural meaning when running a
## recursive rule.
|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
SUBDIRS_dot = $(filter .,$(_SUBDIRS))
SUBDIRS_no_dot = $(filter-out .,$(_SUBDIRS))
SUBDIRS_no_dot_no_wrapup = $(filter-out wrapup,$(SUBDIRS_no_dot))
SUBDIRS_wrapup = $(filter wrapup,$(SUBDIRS_no_dot))
preinstall: preinstall-recursive
.PHONY: preinstall-recursive
SUBDIR_TARGET = $(subst /,-,$1)
PREINSTALL_TARGET = preinstall-$(call SUBDIR_TARGET,$(1))
preintstall_targets = $(if "$(SUBDIRS_dot)" ".",preinstall-dot) $(foreach D,$(SUBDIRS_no_dot),$(call PREINSTALL_TARGET,$(D)))
define PREINSTALL_DIR
.PHONY: $1
$1:
@+set fnord $(MAKEFLAGS); amf=$$$$2; \
subdir=$(2); \
subdir_label=`echo $(1) | sed -e 's/preinstall-//'`; \
target=`echo $$@ | sed -e 's/-recursive//' -e "s/-$$$${subdir_label}//"`$(3); \
echo "Making $$$$target in $$$$subdir"; \
(cd $$$$subdir && $(MAKE) $(AM_MAKEFLAGS) $$$$target) \
|| case "$$$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac;
endef
$(if "$(SUBDIRS_dot)" ".",$(eval $(call PREINSTALL_DIR,preinstall-dot,.,-am)))
$(foreach D,$(SUBDIRS_no_dot),$(eval $(call PREINSTALL_DIR,$(call PREINSTALL_TARGET,$(D)),$(D))))
preinstall: $(preintstall_targets)
.PHONY: preinstall
define CPUKITDIR
.PHONY: $1
$1: $(preintstall_targets)
@+set fnord $(MAKEFLAGS); amf=$$$$2; \
subdir=$(2); \
target=`echo $(MAKECMDGOALS) | sed s/-recursive//`; \
if test "$$$$target" = "all-local-am"; then \
target="all-am"; \
fi; \
if test "$$$$target" = "all-local"; then \
target="all"; \
fi; \
echo "Making $$$$target in $$$$subdir"; \
if test "$$$$subdir" != "."; then \
cd $$$$subdir; \
$(MAKE) $(AM_MAKEFLAGS) $$$$local_target; \
fi;
endef
#
# This GNU make syntax is being used to stop automake thinking the code is for
# it.
#
$(if "$(SUBDIRS_dot)" ".",$(eval $(call CPUKITDIR,dot,.)))
$(foreach D,$(SUBDIRS_no_dot),$(eval $(call CPUKITDIR,$(D),$(D))))
#
# If there is a wrapup make it depend on all other directories so it is not
# entered until they have finished.
#
$(if "$(SUBDIRS_wrapup)" "wrapup",wrapup: dot $(foreach D,$(SUBDIRS_no_dot_no_wrapup),$(D)),)
all-local: preinstall $(if "$(SUBDIRS_dot)" ".",dot) $(SUBDIRS_no_dot)

View File

@@ -1,7 +1,7 @@
include $(top_srcdir)/automake/multilib.am
include $(top_srcdir)/automake/compile.am
SUBDIRS = src/nfsclient
_SUBDIRS = src/nfsclient
EXTRA_DIST = README

View File

@@ -1,7 +1,7 @@
include $(top_srcdir)/automake/multilib.am
include $(top_srcdir)/automake/compile.am
SUBDIRS = cpu
_SUBDIRS = cpu
## include

View File

@@ -1,4 +1,4 @@
SUBDIRS = @RTEMS_CPU@
_SUBDIRS = @RTEMS_CPU@
DIST_SUBDIRS =
DIST_SUBDIRS += arm