Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Make with arguments

I have python script inside container which needs two arguments to run.
I tried to run the script using Makefile.

For this I made make command:

.PHONY: deploy

deploy:
    @docker exec -it ecosystem python3 deployment/deploy.py $(filter-out $@,$(MAKECMDGOALS))

When I run make deploy server project, the script works, but when it finishes I get the following error: make: *** No rule to make target 'server'. Stop.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

The command line of make is reserved for use by make. You don’t get to use it for your own alternative purposes. Every word on the command line must be either an option or option argument, or a variable assignment, or a target to be built.

When you type make deploy server project you’re telling make to build three targets: deploy, server, and project.

You can’t change this. Make is not a general-purpose scripting language like Python or Perl or even the shell.

You could do it like this instead:

.PHONY: deploy

DEPLOY_ARGS =

deploy:
        @docker exec -it ecosystem python3 deployment/deploy.py $(DEPLOY_ARGS)

then run:

make deploy DEPLOY_ARGS='server project'
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading