1. 程式人生 > >懶人學習automake, Makefile.am,configure.ac

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

add mit cal view thread art programs 51cto readme

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

步驟:

[plain] view plain copy
  1. [[email protected] hello]# autoscan .///在當前文件夾中搜索
  2. [[email protected] hello]# cp configure.scan configure.ac //復制文件
  3. [[email protected] hello]# vi configure.ac //編輯文件
  4. 編輯configure.ac,加入下面一行:
  5. AM_INIT_AUTOMAKE(hello,1.0) //automake所必備的宏,必須添加
  6. [[email protected] hello]# aclocal //執行aclocal生成aclocal.m4文件
  7. [[email protected] hello]# autoconf //執行autoconf生成configure文件
  8. [[email protected] hello]# autoheader
  9. [[email protected] hello]# automake --add-missing
  10. [[email protected] hello]# touch NEWS; touch README; touch AUTHORS; touch ChangeLog //創建NEWS等文件,如果沒有自動生成,手工創建
  11. [[email protected] hello]# automake --add-missing //再運行一次
  12. [[email protected] hello]# ./configure //配置,生成Makefile文件
  13. [[email protected] 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. bin_PROGRAMS = parser_main
  4. parser_main_SOURCES = parser_main.cpp \
  5. Parser.cpp \
  6. Lexer.cpp \
  7. SelectStmt.cpp \
  8. InsertStmt.cpp \
  9. UpdateStmt.cpp \
  10. DeleteStmt.cpp \
  11. Stmt.cpp \
  12. Expr.cpp \
  13. Identifier.cpp
  14. ~



參考文獻:

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

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