GNU make 디버깅
make
업데이트되지 않은 대상의 전제 조건을 찾는 명령 줄 방법 이 있습니까?
make -d
당신을 제공해야 더 당신의 메이크 파일을 디버깅 할 수있는 충분한 정보보다.
경고 : 출력을 분석하는 데 약간의 시간과 노력이 필요하지만 선호하는 편집기에 출력을로드하고 검색을 수행하면 많은 도움이됩니다.
관심이있는 특정 대상을 지정하면 디버깅 출력의 양을 크게 줄일 수 있습니다. 따라서 dodgy
대상 에만 관심이있는 make -d
경우 백 가지를 만드는 대신 다음을 시도해보십시오.
make clean
make -d dodgy
( clean
물론 목표가 있다고 가정 ).
다음 make --debug
과 동일 make -d
하지만 다음을 지정할 수도 있습니다.
make --debug=FLAGS
플래그는 다음과 같습니다.
a
모든 디버깅에 대해 (make -d
및과 동일make --debug
).b
기본적인 디버깅을 위해.v
좀 더 자세한 기본 디버깅을 위해.i
암시 적 규칙의 경우.j
호출 정보.m
메이크 파일 리메이크 중 정보.
make --debug=b
다음 성적표에 표시된 것처럼 필요한 항목에 가장 적합한 옵션 인 것 같습니다 .
pax@paxbox> cat makefile
c:a b
touch c
pax@paxbox> touch a b ; make
touch c
pax@paxbox> make
make: 'c' is up to date.
pax@paxbox> touch a ; make --debug=b
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc. Blah, blah, blah.
Reading makefiles...
Updating goal targets....
Prerequisite 'a' is newer than target 'c'.
Must remake target 'c'.
touch c
Successfully remade target file 'c'.
Make의 "드라 이런"을 찾고 계십니까? 실제로 그렇게하지 않고 make가하는 일을 출력하여 무슨 일이 일어나는지 볼 수 있습니다.
플래그는 -n
다음과 같이 사용합니다 make -n
.
디버거와 더 나은 추적 / 오류 출력이있는 GNU make도 있습니다. Remake
스크린 캐스트 :
http://showmedo.com/videotutorials/video?name=linuxBernsteinMakeDebug1&fromSeriesID=40
귀하의 질문이 약간 명확하지 않습니다. 최근에 수정되지 않은 전제 조건 파일을 보려면 ls -l을 사용하여 수정 시간을 확인하십시오. make가 무엇을하는지보고 싶다면 다음을 시도하십시오.
# Make는이 목표를 언제, 그리고 그 이유를 알려줄 것입니다. sometarget : preq1 preq2 preq3 @echo 만들기 $ @ @echo 다음 preq는 대상보다 최신입니다. $? 어떤 것을하다
내가 일반적으로하는 일은 이전 응답자가 말한 것처럼 -d를 사용하지 않는 것입니다.
나 :
- -p를 사용하여 데이터베이스를 인쇄하고 생성 된 규칙을 확인합니다. 두 번째 확장 규칙이 있고 즉석에서 규칙, 특히 재귀 적 작성을 만드는 경우 유용합니다.
- $ (info) 함수를 많이 사용합니다.
- 이 DrDobbs 기사 디버깅 메이크 파일에 설명 된 팁과 트릭을 사용하십시오.
다음은 값을 인쇄하는 데 사용하는 코드입니다.
define pv
$(info $(1) [$(origin $(1))] : >|$($(1))|<)
endef
define pva
$(foreach t,$(1),$(call pv,$(t)))
endef
define itemizer
$(foreach t,$($(1)),$(info $(t)))
endef
Few times I've also used this (old but still working) interactive make debugger by John Graham-Cumming
i am using make gnu make templates to define the make rules per target;
Templates are like macros that write rules, they are explained here https://www.gnu.org/software/make/manual/html_node/Eval-Function.html
this feature is useful when you have a make system that includes a core makefile to generate all rules per project type; if it says to do a shared library then it writes the rules to compile a shared library; etc. for other types of targets.
in this example: if you add SHOW_RULES=1 to the make command line it also shows the text of the rules that are generated by the PROGRAM_target_setup_template ; along with generating the rules themselves (with eval).
# this one defines the target for real
$(foreach prog, $(TARGETS), $(eval $(call PROGRAM_target_setup_template,$(prog))))
ifneq "$(SHOW_RULES)" ""
$(foreach prog, $(TARGETS), $(info $(call PROGRAM_target_setup_template,$(prog))))
endif
- $(call ... ) invokes the template
- $(info ... ) prints the result of template substitution; ( eval would have invoked parsing of the output and addition to the current make file )
More about my make files here: http://mosermichael.github.io/cstuff/all/projects/2011/06/17/make-system.html
참고URL : https://stackoverflow.com/questions/1745939/debugging-gnu-make
'programing' 카테고리의 다른 글
Android Studio : Gradle 실행을 완료하지 못했습니다. 원인이 비어 있습니다. (0) | 2020.11.04 |
---|---|
Favicon Standard-2019-SVG, ICO, PNG 및 치수? (0) | 2020.11.04 |
양식 인증 : 로그인 페이지로 리디렉션 비활성화 (0) | 2020.11.04 |
SQL“LIKE”문에 해당하는 SQLAlchemy (0) | 2020.11.04 |
HTML5 캔버스 텍스트의 스타일을 굵게 및 / 또는 기울임 꼴로 어떻게 지정합니까? (0) | 2020.11.04 |