Je ne peux pas comprendre pourquoi dans ce qui suit les deux versions différentes donnent des résultats différents:Incohérence ifeq et ifneq
$(INCLUDE_DIR)/%: TRGT_PATH = \
$(INCLUDE_DIR)/$(patsubst $(word 1,$(subst /, ,$(dir $*)))/%,%,$*)
$(INCLUDE_DIR)/%: INCLUDEDS = $(TRGT_PATH)
$(INCLUDED_FILES) : $(INCLUDE_DIR)/%: %
ifeq ($(TRGT_PATH),$(findstring $(TRGT_PATH),$(INCLUDEDS)))
@echo [INC][WARN] File $(TRGT_PATH) already exists while copying from $*
else
@echo $(findstring $(TRGT_PATH),$(INCLUDEDS))
@echo [INC] $* $(TRGT_PATH)
@cp $* $(TRGT_PATH)
endif
Sortie:
[INC][WARN] File include/GeometricObject.h already exists while copying from engine/GeometricObject.h
[INC][WARN] File include/util.h already exists while copying from engine/util.h
[INC][WARN] File include/util.h already exists while copying from test/util.h
Si je change la ligne ifeq ($(TRGT_PATH),$(findstring $(TRGT_PATH),$(INCLUDEDS)))
à la ifneq (,$(findstring $(TRGT_PATH),$(INCLUDEDS)))
la sortie est:
include/GeometricObject.h
[INC] engine/GeometricObject.h include/GeometricObject.h
include/util.h
[INC] engine/util.h include/util.h
include/util.h
[INC] test/util.h include/util.h
Pour autant que je sais $(findstring t,l)
retourne e t
si t
est dans l
et sinon une chaîne vide. Mais la sortie (si VAR
est égal à LIST
) est encore:
foo
bar
Quelqu'un peut-il expliquer?
PS: Je l'ai testé un code plus simple et qui a bien fonctionné ...
J'ai mis à jour la question :) J'espère que ça aide – WorldSEnder