From 546acdaac7e02497259122da83b2ccd4a2a13348 Mon Sep 17 00:00:00 2001 From: Paul Fariello Date: Thu, 23 Apr 2020 21:10:36 +0200 Subject: [PATCH] Add option to choose a specific make executable (#212) * Add option to choose a specific make executable * Add changelog fragment * Fix pep8 issues * Add ending dot to make option description Co-Authored-By: Felix Fontein Co-authored-by: Felix Fontein --- changelogs/fragments/212-make-path-option.yml | 2 ++ plugins/modules/system/make.py | 20 +++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/212-make-path-option.yml diff --git a/changelogs/fragments/212-make-path-option.yml b/changelogs/fragments/212-make-path-option.yml new file mode 100644 index 0000000000..42b89593d6 --- /dev/null +++ b/changelogs/fragments/212-make-path-option.yml @@ -0,0 +1,2 @@ +minor_changes: + - "Add a make option to the make module to be able to choose a specific make executable" diff --git a/plugins/modules/system/make.py b/plugins/modules/system/make.py index 4dd459d425..c9160ed7a8 100644 --- a/plugins/modules/system/make.py +++ b/plugins/modules/system/make.py @@ -39,6 +39,10 @@ options: description: - Use a custom Makefile. type: path + make: + description: + - Use a specific make binary. + type: path ''' EXAMPLES = r''' @@ -109,15 +113,19 @@ def main(): params=dict(type='dict'), chdir=dict(type='path', required=True), file=dict(type='path'), + make=dict(type='path'), ), supports_check_mode=True, ) - # Build up the invocation of `make` we are going to use - # For non-Linux OSes, prefer gmake (GNU make) over make - make_path = module.get_bin_path('gmake', required=False) - if not make_path: - # Fall back to system make - make_path = module.get_bin_path('make', required=True) + + make_path = module.params['make'] + if make_path is None: + # Build up the invocation of `make` we are going to use + # For non-Linux OSes, prefer gmake (GNU make) over make + make_path = module.get_bin_path('gmake', required=False) + if not make_path: + # Fall back to system make + make_path = module.get_bin_path('make', required=True) make_target = module.params['target'] if module.params['params'] is not None: make_parameters = [k + '=' + str(v) for k, v in iteritems(module.params['params'])]