나는이 귀하의 요구 사항을 만족시킬 수 있는지 확실하지 않습니다, 그러나 여기 간다 :
parent.make :
export myfunc1 = my arg is $1
export myfunc2 = $(value myfunc1)
$(info parent testing myfunc1: $(call myfunc1,parent))
all: ; $(MAKE) -f child.make
child.make :
$(info child testing myfunc2: $(call myfunc2,child))
nullrule: ; @true
편집 :
좋아, 어때?
child.make :
myfunc1=$(myfunc2)
$(info child testing myfunc1: $(call myfunc1,child))
nullrule: ; @true
편집 :
하지 너무 빨리. 이것 좀보세요 :
parent.make :
myfunc_base = my arg is $1
export myfunc = $(value myfunc_base)
$(info parent testing myfunc: $(call myfunc_base,parent))
all: ; @$(MAKE) -f child.make
child.make :
$(info child testing myfunc: $(call myfunc,child))
nullrule: ; @$(MAKE) -f grandchild.make
grandchild.make이 전혀 수정없이 작동
$(info grandchild testing myfunc: $(call myfunc,grandchild))
nullrule: ; @true
child.make
또는 grandchild.make
. parent.make
은 myfunc
대신 myfunc_base
으로 전화해야합니다. 문제가 있다면 주위에 방법이 있습니다. 어쩌면 하나 이상입니다.
하나의 가능성, 우리는로 정의를 이동이 실제로는 전혀 호출되지 않습니다 parent
호출 어떤 :
grandparent.make :
myfunc_base = my arg is $1
export myfunc = $(value myfunc_base)
all: ; @$(MAKE) -f child.make
부모를.합니다
$(info parent testing myfunc: $(call myfunc,parent))
all: ; @$(MAKE) -f child.make
myfunc
의 정의 parent.make
에 정의 된 다른 일을해야 할 수 있기 때문에 나는이 가능한하지 않을 수 있습니다 알고 있습니다. 이것이 당신의 상황에 어울리는 지보십시오. 다른 방법이있을 수 있습니다 ...
그건 멋진 트릭입니다. 그러나 부모와 자식 모두 같은 이름을 사용하여 함수를 참조 할 수 있어야하므로 현재의 문제는 실제로 해결되지 않습니다. (이것은 기존의, 절대적이고, 거대하고, 복잡한 make 설정에 있습니다). 내 폴백 옵션은 이러한 파일을 별도의 파일로 정의하고 모든 서브 프로세스 인스턴스에 해당 파일을 포함시키는 것입니다.하지만 이는 이상적인 것보다 적습니다. – mtoossi
편집과 관련하여 이것은 실제적이지 않습니다. 많은 기능이 있으며 각각에 대해 2 개의 추가 라인을 추가하는 것은 너무 장황합니다. 또한, 여러 단계의 하위 실행 make가 여러 단계로 복잡해지면서 더욱 복잡해졌습니다. 어쨌든, 이것이 유일하게 사용 가능한 옵션이기 때문에 귀하의 답변을 수락 할 것입니다! – mtoossi