免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1249 | 回复: 0

automake自动生成makefile[总结] [复制链接]

论坛徽章:
0
发表于 2009-10-15 16:09 |显示全部楼层
kernel:2.6.27.30-170.2.82_ND5_1.i686.PAE
1.you should create your source code by hand.
e.g. you can write a simple code, like main.c"main(void) {}";
2.use the command autoscan, this command will generate two files:autoscan.log, configure.scan;
3.next step is the most important, you should change the name of the configure.scan instead of configure.in;
and then edit the file configure.in, you should place the FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS in your own definations, and the most important step is to add a sentence "AM_INIT_MAKE(PACKAGE-NAME, VERSION)" into configure.in, and replace the AC_OUTPUT to AC_OUTPUT([Makefile])
4.use aclocal to generate the "aclocal.m4" and "autom4te.cache", these files are used to deine the local marco
5.use autoconf to generate the configure file
6.use autoheader to generate the config.h.in.This tool is used to copy the additional symbols from user usually, if you do not add the additional symbols, then you needn't execute this command.
7.Before automake.
  Create a new file Makefile.am, this file will be used by automake command. It's the configuration files, and we need create it by self.
  The content like the following:
  -----------------------------
  AUTOMAKE_OPTIONS=foreign
  bin_PROGRAMS=bin-name
  bin-name_SOURCES=sourcecode
  -----------------------------
==========================================================================
  Tip:
  1).the AUTOMAKE_OPTION can used to configure the automake, the 'foreign' means only check the requires file. another is 'gnits', the default is 'gnu'. If default, you should create these files 'COPYING,NEWS,INSTALL,README' and so on;
  2).bin_PROGRAMS used to define the execute filename, if you have a lot, you should use space to split them. for example: bin_PROGRAMS=a b c
  3).exec-name_SOURCES to define the source code that can be used to generate the exec-name. If the target exec-name needs 1.c 1.h, then you should write like this: exec-name_SOURCES=1.c 1.h
==========================================================================
  Caution: if you define a lot exe-names, you should write the exe-name_SOURCES for each.
  for a instance, bin_PROGRAMS=a b c
                  a_SOURCES=a.c
                  b_SOURCES=b.c
                  c_SOURCES=c.c
8.use automake to generate the Makefile.in
  #automake --add-missing
  option '--add-missing' let automake add the requires scripts when running.
9.Verify, use ./configure to generate the Makefile.
10.test it. #make && make install
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/103900/showart_2071047.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP