懶人學習automake, Makefile.am,configure.ac

已經存在Makefile.am,如何生成Makefile?html


步驟:linux

[plain] view plain copy spa

  1. [root@localhost hello]# autoscan .///在當前文件夾中搜索  .net

  2.   

  3. [root@localhost hello]# cp configure.scan configure.ac //複製文件  htm

  4. [root@localhost hello]# vi configure.ac //編輯文件  blog

  5.   

  6.     編輯configure.ac,加入下面一行:  get

  7.     AM_INIT_AUTOMAKE(hello,1.0)      //automake所必備的宏,必須添加  thread

  8.   

  9. [root@localhost hello]# aclocal     //執行aclocal生成aclocal.m4文件  配置

  10. [root@localhost hello]# autoconf   //執行autoconf生成configure文件  date

  11. [root@localhost hello]# autoheader  

  12. [root@localhost hello]# automake --add-missing  

  13. [root@localhost hello]# touch NEWS; touch README; touch AUTHORS; touch ChangeLog    //建立NEWS等文件,若是沒有自動生成,手工建立  

  14. [root@localhost hello]# automake --add-missing //再運行一次  

  15. [root@localhost hello]# ./configure    //配置,生成Makefile文件  

  16. [root@localhost hello]# make     //執行make命令  



以上過程可能出現一些警告,請忽略。最後,給出一個Makefile.am的內容做爲例子:

[plain] view plain copy

  1. AM_LDFLAGS = -lpthread -lc -lm -lrt -ldl  

  2. CXXFLAGS = -D__STDC_LIMIT_MACROS -g -Wall -DORDER_SERIALIZE #-O2 -fno-strict-aliasing  

  3.   

  4. bin_PROGRAMS = parser_main  

  5. parser_main_SOURCES = parser_main.cpp \  

  6.                 Parser.cpp \  

  7.                 Lexer.cpp \  

  8.     SelectStmt.cpp \  

  9.     InsertStmt.cpp \  

  10.     UpdateStmt.cpp \  

  11.     DeleteStmt.cpp \  

  12.     Stmt.cpp \  

  13.     Expr.cpp \  

  14.                 Identifier.cpp  

  15. ~                                  




參考文獻:

http://os.51cto.com/art/201006/207098.htm

http://os.51cto.com/art/201006/207099.htm

http://os.51cto.com/art/201006/207101.htm


如何寫Makefile.am

相關文章
相關標籤/搜索