'Makefile: use a target from a project.mk file

I have a Makefile in the workspace folder. There are individual projects where there are project.mk files.

In the main Makefile, I want to use targets from the individual project.mk files.

all: buildUIProject1 buildUIProject2

Where buildUIProject1 is a target in project.mk

buildUIProject1: $(shell find src -name *)
  npm run build

How can I accomplish this?



Solution 1:[1]

What you'd do is a recipe for the buildUIProject1 that runs make (recursively) on project.mk. In the main makefile:

buildUIProject1:
    $(MAKE) -C project1/folder -f project.mk $@

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Andreas