mardi 23 février 2021

Makefie: target inside a if statement

I try to run a target inside another target if a condition is satisfied.

Here is a MVP for my Makefile

val = 2

.PHONY: target1
target1:
   clear

.PHONY: target2
target2:
ifeq ($(val), 2)
    target1
else
    @echo 'wrong value'
endif

If I replace target1(inside the if statement) by @echo 'success' the code works properly so I guess the if statement is correct. However when running make target2 I obtain the following error

make: target1: Command not found

Aucun commentaire:

Enregistrer un commentaire