diff --git a/easybuild/easyblocks/generic/configuremake.py b/easybuild/easyblocks/generic/configuremake.py index b8a057c24d..a208462f74 100644 --- a/easybuild/easyblocks/generic/configuremake.py +++ b/easybuild/easyblocks/generic/configuremake.py @@ -65,6 +65,7 @@ DEFAULT_CONFIGURE_CMD = './configure' DEFAULT_BUILD_CMD = 'make' DEFAULT_INSTALL_CMD = 'make install' +DEFAULT_BUILD_TARGET = '' def check_config_guess(config_guess): @@ -175,6 +176,7 @@ def extra_options(extra_vars=None): extra_vars = EasyBlock.extra_options(extra=extra_vars) extra_vars.update({ 'build_cmd': [DEFAULT_BUILD_CMD, "Build command to use", CUSTOM], + 'build_targets': [DEFAULT_BUILD_TARGET, "Target name (string) or list of target names to build", CUSTOM], 'build_type': [None, "Value to provide to --build option of configure script, e.g., x86_64-pc-linux-gnu " "(determined by config.guess shipped with EasyBuild if None," " False implies to leave it up to the configure script)", CUSTOM], @@ -320,14 +322,21 @@ def build_step(self, verbose=False, path=None): if self.cfg['parallel']: paracmd = "-j %s" % self.cfg['parallel'] - cmd = ' '.join([ - self.cfg['prebuildopts'], - self.cfg.get('build_cmd') or DEFAULT_BUILD_CMD, - paracmd, - self.cfg['buildopts'], - ]) - - (out, _) = run_cmd(cmd, path=path, log_all=True, simple=False, log_output=verbose) + targets = self.cfg['build_targets'] or DEFAULT_BUILD_TARGET + # ensure strings are converted to list + targets = [targets] if isinstance(targets, str) else targets + + for target in targets: + cmd = ' '.join([ + self.cfg['prebuildopts'], + self.cfg.get('build_cmd') or DEFAULT_BUILD_CMD, + target, + paracmd, + self.cfg['buildopts'], + ]) + self.log.info("Building target '%s'", target) + + (out, _) = run_cmd(cmd, path=path, log_all=True, simple=False, log_output=verbose) return out