Created
January 30, 2023 21:20
-
-
Save miteshmap/b52cb549c4a590d286189c69c83e8907 to your computer and use it in GitHub Desktop.
Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Split all arguments for easier use in commands. | |
# You can now use the variables: ${ARGS} ${ARG_1} ${ARG_2} ${ARG_3} ${ARG_REST} | |
# @see https://stackoverflow.com/questions/2214575/passing-arguments-to-make-run#answer-45003119 | |
ARGS = $(filter-out $@,$(MAKECMDGOALS)) | |
ARG_1 = $(word 1, ${ARGS}) | |
ARG_2 = $(word 2, ${ARGS}) | |
ARG_3 = $(word 3, ${ARGS}) | |
ARG_REST = $(wordlist 2, 100, ${ARGS}) | |
## We use the following rule/recipe to prevent errors messages when passing arguments in make commands | |
## @see https://stackoverflow.com/a/6273809/1826109 | |
%: | |
@: | |
run: | |
ddev exec -d /var/www/html/docroot ${ARG_1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment