makefile的問題 - Linux

Table of Contents

makefile有個好處是可以自行判斷檔案有沒有被改過,沒改過就不必重編

有個問題想請教一下..
http://www.study-area.org/cyril/opentools/opentools/makefile.html
這個網頁的例子
如果有很多個.cpp檔
就必須要有每個.cpp對應的target
例如command.cpp,就有command.o這個target
command.o :command.c command.h
$(CC) -o command.o command.c

但問題來了,當.cpp檔有幾百幾千個,又想要能自行判斷每個檔案是否被改過
這樣寫makefile不就xxx.o這樣的target也得要寫幾百幾千個 = =
請問有比較輕鬆的寫法嗎?

謝謝大家

--

All Comments

Audriana avatarAudriana2013-08-24
Dinah avatarDinah2013-08-26
有autoconf automake可以幫你
James avatarJames2013-08-27