DEV Community

Romain Lespinasse
Romain Lespinasse

Posted on • Edited on

2 2

Create a wrapper task in Makefile

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"
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode
  • use sub-command line with $(MAKE)
run-all-tasks:
    @$(MAKE) run-task1
    @$(MAKE) run-task2
    @$(MAKE) run-task3
Enter fullscreen mode Exit fullscreen mode

You can also create a wrapper task to run all tasks with a specific naming.

This will enable you to don't known all task names.
Useful when using include mechanism in your makefile.

include makefile-with-run-tasks.mk

run-all-tasks:
    @grep -E '^[\.a-zA-Z0-9_%-]+:.*$$' $(MAKEFILE_LIST) \
        | cut -d ":" -f2 | grep "^run-task" | sort -u \
        | xargs $(MAKE)
Enter fullscreen mode Exit fullscreen mode

So when you run it, the run-all-tasks task will run all run-task tasks.

$ make run-all-tasks
run task 1
run task 2
run task 3
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more