Tôi có ngăn xếp phần mềm tạo một số tệp trung gian như một phần của quá trình xây dựng. Có một số vấn đề nảy sinh và sự phá vỡ xây dựng. Tôi muốn xem các tệp được tạo trung gian đó. Để tôi ngạc nhiên những tập tin đang bị xóa như là một phần của quá trình xây dựng.Cách hoàn tác xóa tệp trung gian
Removing intermediate files...
rm fact_test_without_proxies.c fact_test_main.c fact_test_without_proxies.o
Tôi đã trải qua Makefiles Tôi không thấy bất kỳ quy tắc rõ ràng nào xóa chúng. Có thể có bất kỳ quy tắc tiềm ẩn nào để xóa các tệp trung gian. Nếu có, tôi làm cách nào để vô hiệu hóa các quy tắc tiềm ẩn đó?
Tôi chỉ thấy bản in Removing intermediate files...
chỉ khi thực hiện được thực hiện với tùy chọn --debug
.
[email protected]:~/coding/factorial/ut$ make --debug
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
This program built for x86_64-pc-linux-gnu
Reading makefiles...
Updating goal targets....
File `check' does not exist.
File `test_dept_run' does not exist.
File `fact_test' does not exist.
File `fact_using_proxies.o' does not exist.
File `fact_test_without_proxies' does not exist.
File `fact_test_without_proxies.o' does not exist.
File `fact_test_without_proxies.c' does not exist.
File `fact_test_main.c' does not exist.
Must remake target `fact_test_main.c'.
nm -p fact_test.o | build_main_from_symbols >fact_test_main.c
Successfully remade target file `fact_test_main.c'.
Must remake target `fact_test_without_proxies.c'.
cp fact_test_main.c fact_test_without_proxies.c
Successfully remade target file `fact_test_without_proxies.c'.
Must remake target `fact_test_without_proxies.o'.
gcc -I../src -c -o fact_test_without_proxies.o fact_test_without_proxies.c
Successfully remade target file `fact_test_without_proxies.o'.
Must remake target `fact_test_without_proxies'.
gcc fact_test_without_proxies.o fact.o fact_test.o -o fact_test_without_proxies
fact.o: In function `unknown':
fact.c:(.text+0x67): undefined reference to `do_update'
collect2: ld returned 1 exit status
make: *** [fact_test_without_proxies] Error 1
Removing intermediate files...
rm fact_test_without_proxies.c fact_test_main.c fact_test_without_proxies.o
Cảm ơn bạn thực sự đã giúp :) – Kamath
Không chỉ vậy, sử dụng. PRECIOUS có nghĩa là những tệp này sẽ không bị xóa ngay cả khi Thực hiện thành công thành công (nghĩa là, không bị giết hoặc bị gián đoạn). "Ngoài ra, nếu mục tiêu là một tập tin trung gian, nó sẽ không bị xóa sau khi nó không còn cần thiết, như thường được thực hiện. [...] Trong trường hợp này, nó trùng lặp với mục tiêu đặc biệt .SECONDARY." - https://www.gnu.org/software/make/manual/make.html – PonyEars
+1: không giống như '.SECONDARY', đây là POSIX: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ make.html –