1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add support to pass a Makefile (#31853)

This commit is contained in:
guilhermeoki 2017-10-18 08:19:24 -02:00 committed by John R Barker
parent 4acd0de8f0
commit a35b4449ee

View file

@ -37,6 +37,12 @@ options:
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 = '''
@ -57,6 +63,12 @@ EXAMPLES = '''
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
@ -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
@ -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
@ -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']
)