How to pass an argument with spaces to a make command.
In this article, I document for my future self how to pass an argument with spaces to a make command.
For context, in my makefile, I have a command that uses alembic to generate migrations for some SQLAlchemy models.
The detail of the command depends on context, but here it is for completeness sake:
cd src && poetry run alembic revision --autogenerate -m '$(msg)'
msg is the argument I need to pass in when running the command.
Assuming I have just added a
user table, and would like to run the migration for it. The command is as follows:
make msg="add user table" make-migration
msg is is separated by spaces. And for the command to work, the argument in the
make-migration has to be surrounded by a space like so: