금요일, 10월 10, 2008

Makefile에서 :: (double colon, two consecutive colon) 은?

wince에서 makefile을 보면 target과 그것의 dependency를 지정하는 : 는 알겠지만 빈번히 등장하는 ::은 무엇인가?

이것은 두개이상의 description block을 사용하여 target을 update할 때 사용한다.target이 하나 description block에서 어떤 dependency와 command가 정의되어 있고, 다음에 또 다른 description block에서 이전과는 다른 dependency와 command가 정의될 경우 :: 가 쓰인다.

이럴경우 update된 dependent가 어떤거냐에 따라 처리하는 description block이 달라진다.모든 description block이 처리될 수도 있고, 일부 description block이 처리될 수도 있고, 모든 description block이 처리되지 않을 수도 있다. 즉 마치 서로 완전히 다른 target을 처리하는 것과 같이 행동하므로 별개의 description block이라고 볼 수 있다.

target.lib :: one.asm two.asm three.asm
ML one.asm two.asm three.asm
LIB target -+one.obj -+two.obj -+three.obj;

target.lib :: four.c five.c
CL /c four.c five.c
LIB target -+four.obj -+five.obj;

이 경우 asm file이 update되었을 경우 첫번째 description block이 수행되고 c file이 update되면 두번째 description block이 수행된다. asm file과 c file이 모두 update 되었다면 두 description block이 모두 수행되고, 아무것도 update되지 않았다면 어떤 description block도 수행되지 않는다.

이것은 주로 target을 update할때 사용되는데 dependent의 종류에 따라서 target을 update하기 위한 command의 종류가 다른 경우 사용한다.

댓글 없음: