In makefile, you can define tasks and run them individually (e.g.make run-task1 run-task2 run-task3
)
run-task1:@echo"run task 1"run-task2:@echo"run task 2"run-task3:@echo"run task 3"
When you want to run tasks from another tasks (e.g.make run-all-tasks
), you can
run-all-tasks:run-task1 run-task2 run-task3
- use sub-command line with
$(MAKE)
run-all-tasks:@$(MAKE) run-task1@$(MAKE) run-task2@$(MAKE) run-task3
You can also create awrapper
task to run all tasks with a specific naming.
This will enable you to don't known all task names.
Useful when usinginclude
mechanism in your makefile.
include makefile-with-run-tasks.mkrun-all-tasks:@grep-E'^[\.a-zA-Z0-9_%-]+:.*$$'$(MAKEFILE_LIST)\ |cut-d":"-f2 |grep"^run-task" |sort-u\ | xargs$(MAKE)
So when you run it, therun-all-tasks
task will run allrun-task
tasks.
$make run-all-tasksrun task 1run task 2run task 3
Top comments(0)
Subscribe
For further actions, you may consider blocking this person and/orreporting abuse