Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make: Add support to pass a Makefile #31853

Merged
merged 1 commit into from
Oct 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions lib/ansible/modules/system/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@
description:
- cd into this directory before running make
required: true
file:
description:
- Use file as a Makefile
required: false
default: none
version_added: 2.5
'''

EXAMPLES = '''
Expand All @@ -57,6 +63,12 @@
params:
NUM_THREADS: 4
BACKEND: lapack

# Pass a file as a Makefile
- make:
chdir: /home/ubuntu/cool-project
target: all
file: /some-project/Makefile
'''

# TODO: Disabled the RETURN as it was breaking docs building. Someone needs to
Expand Down Expand Up @@ -103,6 +115,7 @@ def main():
target=dict(required=False, default=None, type='str'),
params=dict(required=False, default=None, type='dict'),
chdir=dict(required=True, default=None, type='path'),
file=dict(required=False, default=None, type='path')
),
)
# Build up the invocation of `make` we are going to use
Expand All @@ -113,7 +126,10 @@ def main():
else:
make_parameters = []

base_command = [make_path, make_target]
if module.params['file'] is not None:
base_command = [make_path, "--file", module.params['file'], make_target]
else:
base_command = [make_path, make_target]
base_command.extend(make_parameters)

# Check if the target is already up to date
Expand Down Expand Up @@ -144,7 +160,8 @@ def main():
stderr=err,
target=module.params['target'],
params=module.params['params'],
chdir=module.params['chdir']
chdir=module.params['chdir'],
file=module.params['file']
)


Expand Down