亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2983 | 回復: 6
打印 上一主題 下一主題

[C++] 如何改動makefile來避免沒有改動過的.c文件重復編譯 [復制鏈接]

論壇徽章:
0
跳轉到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2016-02-25 14:52 |只看該作者 |倒序瀏覽
本帖最后由 qfmeal 于 2016-02-25 14:55 編輯

我知道只有改動過源文件,make的時候才會重新編譯。

我現(xiàn)在的情況是:
1.所有源文件沒動過,時間戳沒有變,任何操作都沒有;
2.生成的中間文件和目標文件都在,沒動過;
3.我的makefile是把不同目錄生成的所有中間文件都移到同一個obj目錄,最后在鏈接生成目標文件;
$(CUR_OBJ_CPP):%.o:%.cpp
        $(CC) $(CFLAGS) -c $^ -o $(OBJ_OUTPUT)/$@

但是每次 make的時候,所有的文件都會編譯一遍,現(xiàn)在文件多了,每次編譯很慢,所以想問下大牛們,這個問題怎么解決。

論壇徽章:
0
2 [報告]
發(fā)表于 2016-02-25 15:15 |只看該作者
那就用  make -j     多核編譯

論壇徽章:
0
3 [報告]
發(fā)表于 2016-03-04 21:54 |只看該作者
檢查系統(tǒng)時間

論壇徽章:
44
15-16賽季CBA聯(lián)賽之浙江
日期:2021-10-11 02:03:59程序設計版塊每日發(fā)帖之星
日期:2016-07-02 06:20:0015-16賽季CBA聯(lián)賽之新疆
日期:2016-04-25 10:55:452016科比退役紀念章
日期:2016-04-23 00:51:2315-16賽季CBA聯(lián)賽之山東
日期:2016-04-17 12:00:2815-16賽季CBA聯(lián)賽之福建
日期:2016-04-12 15:21:2915-16賽季CBA聯(lián)賽之遼寧
日期:2016-03-24 21:38:2715-16賽季CBA聯(lián)賽之福建
日期:2016-03-18 12:13:4015-16賽季CBA聯(lián)賽之佛山
日期:2016-02-05 00:55:2015-16賽季CBA聯(lián)賽之佛山
日期:2016-02-04 21:11:3615-16賽季CBA聯(lián)賽之天津
日期:2016-11-02 00:33:1215-16賽季CBA聯(lián)賽之浙江
日期:2017-01-13 01:31:49
4 [報告]
發(fā)表于 2016-03-05 14:43 |只看該作者
回復 1# qfmeal

  1. $(CUR_OBJ_CPP):$(OBJ_OUTPUT)/%.o:%.cpp
  2.         $(CC) $(CFLAGS) -c $^ -o $@
復制代碼

論壇徽章:
11
2015年迎新春徽章
日期:2015-03-04 09:55:282017金雞報曉
日期:2017-02-08 10:39:4215-16賽季CBA聯(lián)賽之遼寧
日期:2016-12-15 10:24:1715-16賽季CBA聯(lián)賽之佛山
日期:2016-11-30 09:04:2015-16賽季CBA聯(lián)賽之江蘇
日期:2016-04-29 15:56:1215-16賽季CBA聯(lián)賽之同曦
日期:2016-04-12 13:21:182016猴年福章徽章
日期:2016-02-18 15:30:3415-16賽季CBA聯(lián)賽之山東
日期:2016-02-16 11:37:52每日論壇發(fā)貼之星
日期:2016-02-07 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-02-07 06:20:0015-16賽季CBA聯(lián)賽之新疆
日期:2018-01-09 16:25:37
5 [報告]
發(fā)表于 2016-03-11 12:09 |只看該作者
makefile太弱了,要用scons

論壇徽章:
84
每日論壇發(fā)貼之星
日期:2015-12-29 06:20:00每日論壇發(fā)貼之星
日期:2016-01-16 06:20:00每周論壇發(fā)貼之星
日期:2016-01-17 22:22:00程序設計版塊每日發(fā)帖之星
日期:2016-01-20 06:20:00每日論壇發(fā)貼之星
日期:2016-01-20 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-21 06:20:00每日論壇發(fā)貼之星
日期:2016-01-21 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-23 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-31 06:20:00數(shù)據(jù)庫技術版塊每日發(fā)帖之星
日期:2016-01-16 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-16 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-14 06:20:00
6 [報告]
發(fā)表于 2016-03-11 13:27 |只看該作者
1. 寫對target依賴

2. 用 ccache

論壇徽章:
84
每日論壇發(fā)貼之星
日期:2015-12-29 06:20:00每日論壇發(fā)貼之星
日期:2016-01-16 06:20:00每周論壇發(fā)貼之星
日期:2016-01-17 22:22:00程序設計版塊每日發(fā)帖之星
日期:2016-01-20 06:20:00每日論壇發(fā)貼之星
日期:2016-01-20 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-21 06:20:00每日論壇發(fā)貼之星
日期:2016-01-21 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-23 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-31 06:20:00數(shù)據(jù)庫技術版塊每日發(fā)帖之星
日期:2016-01-16 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-16 06:20:00程序設計版塊每日發(fā)帖之星
日期:2016-01-14 06:20:00
7 [報告]
發(fā)表于 2016-03-11 13:38 |只看該作者
有一段時間 gcc 默認就是 ccache 的符號鏈接,剛看了一下 fedora 23 發(fā)現(xiàn)又變回去了. 需要自己設置一下

官網(wǎng)地址:
    https://ccache.samba.org/

Features

    Keeps statistics on hits/misses.
    Automatic cache size management.
    Can cache compilations that generate warnings.
    Easy installation.
    Low overhead.
    Optionally uses hard links where possible to avoid copies.

Limitations

    Only knows how to cache the compilation of a single C/C++/Objective-C/Objective-C++ file. Other types of compilations (multi-file compilation, linking, etc) will silently fall back to running the real compiler.
    Only works with GCC and compilers that behave similar enough.
    Some compiler flags are not supported. If such a flag is detected, ccache will silently fall back to running the real compiler.

Why bother?

If you ever run make clean; make, you can probably benefit from ccache. It is common for developers to do a clean build of a project for a whole host of reasons, and this throws away all the information from your previous compilations. By using ccache, recompilation goes much faster.

Another reason to use ccache is that the same cache is used for builds in different directories. If you have several versions or branches of a software stored in different directories, many of the object files in a build directory can probably be taken from the cache even if they were compiled for another version or branch.

A third scenario is using ccache to speed up clean builds performed by servers or build farms that regularly check that the code is buildable.

You can also share the cache between users, which can be very useful on shared compilation servers.


*Is it safe?*

Yes. The most important aspect of a compiler cache is to always produce exactly the same output that the real compiler would produce. This includes providing exactly the same object files and exactly the same compiler warnings that would be produced if you use the real compiler. The only way you should be able to tell that you are using ccache is the speed.

ccache has been coded very carefully to try to provide these guarantees. However, if you experience any bugs, please report them.
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復

  

北京盛拓優(yōu)訊信息技術有限公司. 版權所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關心和支持過ChinaUnix的朋友們 轉載本站內容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP