Makefile은 대상 목록을 가져옵니다.

Makefile은 대상 목록을 가져옵니다.

대부분의 경우 제대로 작동하는 를 얻기 위해 다음 코드를 사용합니다 makefile targets list. 그러나 이와 같이 makefile을 사용하면 전체가 아닌 두 개의 대상만 얻게 됩니다.

다른 명령이 표시되지 않습니다

고양이Makefile

command: ## Command description
    @echo "Execution log"

another-command: ## Command description
    @echo "Execution log"

command2: ## Command description
    @echo "Execution log" 

출력은 다음과 같습니다

command
command2

왜 명령을 받지 못하는지 모르겠습니다 another-command. 이것이 코드입니다.

`make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\\\/t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' `;

무엇이 문제가 될 수 있습니까?

나는 이것을 참고로 사용한다. make의 모든 대상을 나열하는 방법은 무엇입니까?

여기에 이미지 설명을 입력하세요

답변1

$ make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\\\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}'
command
Makefile
command2
another-command

내 문자 세트에는 백슬래시와 탭이 있고, 귀하의 세트에는 백슬래시, 슬래시 및 "t"가 있습니다.

그리고 "another"에는 "t"가 포함됩니다 ;-)

steeldriver에 대한 크레딧

관련 정보