Barry Smith <[email protected]> writes:
>>> runex123: REQUIRE = parmetis mumps 64-bit-indices
>
>    Ok, I don’t understand this syntax at all, there is no mention of
>    REQUIRE used in this way in the gnumake manual.  How are you
>    proposing to use this variable?

REQUIRE is just a normal (target-specific) variable, it is not
interpreted specially by make.  Consider the attached makefile.

$ make allrun
Creating executable foo.exe
Running runfoo1
Skipping runfoo2 due to unmet requirements: C
Creating executable bar.exe
Running runbar1
rm bar.exe foo.exe

ENABLED = A B

# Helper function
unmet_requirements = $(filter-out $(ENABLED),$(REQUIRE))

%.exe :
        @echo Creating executable $@
        @touch $@

run% :
        @$(if $(unmet_requirements),echo "Skipping $@ due to unmet 
requirements:" $(unmet_requirements),echo Running $@)

runfoo1 : REQUIRE = A B
runfoo1 : foo.exe

runfoo2 : REQUIRE = A C
runfoo2 : foo.exe

runbar1 : REQUIRE = A
runbar1 : bar.exe

allrun : runfoo1 runfoo2 runbar1

.INTERMEDIATE: foo.exe bar.exe

Attachment: pgpvpKXKOclFv.pgp
Description: PGP signature

Reply via email to