How to create multiple goals by calling only one team?

I have a Makefile as shown below:

.PHONY: all

all: aaa.2 bbb.2

aaa.2 : aaa.1 common.1
    create_2 $@

bbb.2 : bbb.1 common.1
    create_2 $@

The create_2 program takes a lot of time, but it can immediately create several% .2 files, so I would like to call create_2 only once.

For example, if common.1 has changed, I would like it to be create_2 aaa.2 bbb.2called instead of create_2 aaa.2and create_2 bbb.2.

I tried with the recipe create_2 $?for the goal of "everything", but to no avail.

I am looking for a solution that works with both gmake and clearmake (in gnu compatibility mode).

+2
source share
2 answers

Make is mostly file-oriented, and what you want is process-oriented, so ... maybe this justifies the fact that this is an awful kludge:

.PHONY: all

all: marker

aaa.2 : aaa.1 common.1
    @touch $@

bbb.2 : bbb.1 common.1
    @touch $@

marker: aaa.2 bbb.2
    create_2 $?
    @touch $@

, marker aaa.2 bbb.2 , . , .

+2

:

.PHONY: all

all: file1 file2
>---@if [ -f work ]; then \
>--->---touch file1 file2; \
>--->---echo "touch file1 file 2"; \
>---fi
>---rm -f work

file1:
>---touch work
file2:
>---touch work

, , . , , work1 work2 work if, , . GNU .

0

All Articles