From 4d1e1478360ad5131e780164c1547c4e2bc6ed5e Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 27 Apr 2017 23:50:09 -0700 Subject: [PATCH] scons: Find ext build directories automatically. The ext directories with SConscripts in them are easy to find automatically. Avoid boilerplate listing them out and SConscript()ing them manually. Change-Id: Ib723882aebc00e639eb8ec44904bb05ffa2c6b55 Reviewed-on: https://gem5-review.googlesource.com/2942 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- SConstruct | 34 +++++++--------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) diff --git a/SConstruct b/SConstruct index 6010f3a57..26b1acf6e 100755 --- a/SConstruct +++ b/SConstruct @@ -1339,33 +1339,13 @@ config_builder = Builder(emitter = config_emitter, action = config_action) main.Append(BUILDERS = { 'ConfigFile' : config_builder }) -# libelf build is shared across all configs in the build root. -main.SConscript('ext/libelf/SConscript', - variant_dir = joinpath(build_root, 'libelf')) - -# iostream3 build is shared across all configs in the build root. -main.SConscript('ext/iostream3/SConscript', - variant_dir = joinpath(build_root, 'iostream3')) - -# libfdt build is shared across all configs in the build root. -main.SConscript('ext/libfdt/SConscript', - variant_dir = joinpath(build_root, 'libfdt')) - -# fputils build is shared across all configs in the build root. -main.SConscript('ext/fputils/SConscript', - variant_dir = joinpath(build_root, 'fputils')) - -# DRAMSim2 build is shared across all configs in the build root. -main.SConscript('ext/dramsim2/SConscript', - variant_dir = joinpath(build_root, 'dramsim2')) - -# DRAMPower build is shared across all configs in the build root. -main.SConscript('ext/drampower/SConscript', - variant_dir = joinpath(build_root, 'drampower')) - -# nomali build is shared across all configs in the build root. -main.SConscript('ext/nomali/SConscript', - variant_dir = joinpath(build_root, 'nomali')) +# builds in ext are shared across all configs in the build root. +ext_dir = abspath(joinpath(str(main.root), 'ext')) +for root, dirs, files in os.walk(ext_dir): + if 'SConscript' in files: + build_dir = os.path.relpath(root, ext_dir) + main.SConscript(joinpath(root, 'SConscript'), + variant_dir=joinpath(build_root, build_dir)) ################################################### # -- 2.30.2