-

贤钟的博客

一个人的奋斗
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

开始学习C语言

Posted on 2010-08-07 23:35  贤钟  阅读(344)  评论(1编辑  收藏  举报

现在越来越感觉到C语言的重要,因为在LINUX系统里,学习C是必须的。以前用JAVA开发软件,太占用资源了,而且对LINUX系统没有更深的了解。

先找一篇文章学习:在博客园找到这一篇 从0开始学习linux C编程  文档没有排版好,感觉比较乱。

 

学习到makefile文件的编写发现出现“missing separator.  Stop”。

[root@aspcn c1]#make
makefile:2: *** missing separator.  Stop.

makefile文件内容

 

main:main.o mytool1.o mytool2.o
  gcc -o main main.o mytool1.o mytool2.o
main.o:main.c mytool1.h mytool2.h
  gcc -c main.c
mytool1.o:mytool1.c mytool1.h
  gcc -c mytool1.c
mytool2.o:mytool2.c mytool2.h
  gcc -c mytool2.c

 

在gcc命令行前面用tab键,不能用空格。才能编译通过。

make在读取Makefile过程中不能解析其中包含的内容。GNU make在读取Makefile时根据各种分隔符(:, =, [TAB]字符等)识别Makefile的每一行内容。这些错误意味着make不能发现一个合法的分隔符。
出现这些错误信息的可能的原因是(或许是编辑器,绝大部分是ms-windows的编辑器)在Makefile中的命令之前使用了4个(或者8个)空格代替了[Tab]字符。这种情况,将产生上述的第二种形式产生错误信息。且记,所有的命令行都应该是以[Tab]字符开始的。

 

 

 

 

明天研究autoscan生成configure 。

赠送2个虚拟主机,服务器在美国。 支持PHP+mysql程序,主机面板是cp,空间200M  月流量 5G。允许绑定国际域名,

如果没有国际域名赠送二级域名。必须是博客园才能申请。

虚拟主机服务器时间 >12个月,

服务器探针 http://www.xianzhong.net/i.php 

 

需要的回复,格式为:

 

1、网站地址

2、联系方式

3、空间用途

 

只有2个名额,明天早上起来开通,等E-MAIL通知。

 

 

活动结束,发现只有一个人申请免费空间,申请人  pro.charm@gmail.com  ,2个名额的资源合并一起, 400M的PHP空间、月流量10G ,2个MYSQL数据库。

 

下午研究configure 命令发现一篇不错的文章,地址  http://hi.baidu.com/yzkuang/blog/item/557e4f24423d8136c9955908.html  

引用文章--------------------------标题 图解autoscan、aclocal、autoheader、automake、autoconf、configure、make

 

1.autoscan (autoconf): 扫描源代码以搜寻普通的可移植性问题,比如检查编译器,库,头文件等,生成文件configure.scan,它是configure.ac的一个雏形。

    your source files --> [autoscan*] --> [configure.scan] --> configure.ac

 

2.aclocal (automake):根据已经安装的宏,用户定义宏和acinclude.m4文件中的宏将configure.ac文件所需要的宏集中定义到文件 aclocal.m4中。aclocal是一个perl 脚本程序,它的定义是:“aclocal - create aclocal.m4 by scanning configure.ac”

 

user input files   optional input     process          output files
================   ==============     =======          ============

                    acinclude.m4 - - - - -.
                                          V
                                      .-------,
configure.ac ------------------------>|aclocal|
                 {user macro files} ->|       |------> aclocal.m4
                                      `-------'
3.autoheader(autoconf): 根据configure.ac中的某些宏,比如cpp宏定义,运行m4,声称config.h.in

user input files    optional input     process          output files
================    ==============     =======          ============

                    aclocal.m4 - - - - - - - .
                                             |
                                             V
                                     .----------,
configure.ac ----------------------->|autoheader|----> autoconfig.h.in
                                     `----------'

4.automake: automake将Makefile.am中定义的结构建立Makefile.in,然后configure脚本将生成的Makefile.in文件转换为Makefile。如果在configure.ac中定义了一些特殊的宏,比如AC_PROG_LIBTOOL,它会调用libtoolize,否则它会自己产生config.guess和config.sub

user input files   optional input   processes          output files
================   ==============   =========          ============

                                     .--------,
                                     |        | - - -> COPYING
                                     |        | - - -> INSTALL
                                     |        |------> install-sh
                                     |        |------> missing
                                     |automake|------> mkinstalldirs
configure.ac ----------------------->|        |
Makefile.am  ----------------------->|        |------> Makefile.in
                                     |        |------> stamp-h.in
                                 .---+        | - - -> config.guess
                                 |   |        | - - -> config.sub
                                 |   `------+-'
                                 |          | - - - -> config.guess
                                 |libtoolize| - - - -> config.sub
                                 |          |--------> ltmain.sh
                                 |          |--------> ltconfig
                                 `----------'

5.autoconf:将configure.ac中的宏展开,生成configure脚本。这个过程可能要用到aclocal.m4中定义的宏。

user input files   optional input   processes          output files
================   ==============   =========          ============

aclocal.m4 ,autoconfig.h.in - - - - - - -.
                                         V
                                     .--------,
configure.ac ----------------------->|autoconf|------> configure
 
6. ./configure的过程

.-------------> [config.cache] configure* --------------------------+-------------> config.log | [config.h.in] -. v .--> [autoconfig.h]
+-------> config.status* -+ Makefile.in ---' `--> Makefile
 
7. make过程
 
[autoconfig.h] -.
+--> make* ---> 程序
Makefile ---'
 
.---------,
                   config.site - - ->|         |
                  config.cache - - ->|configure| - - -> config.cache
                                     |         +-,
                                     `-+-------' |
                                       |         |----> config.status
                   config.h.in ------->|config-  |----> config.h
                   Makefile.in ------->|  .status|----> Makefile
                                       |         |----> stamp-h
                                       |         +--,
                                     .-+         |  |
                                     | `------+--'  |
                   ltmain.sh ------->|ltconfig|-------> libtool
                                     |        |     |
                                     `-+------'     |
                                       |config.guess|
                                       | config.sub |
                                       `------------'

.--------,
                   Makefile ------>|        |
                   config.h ------>|  make  |
{project sources} ---------------->|        |--------> {project targets}
                                 .-+        +--,
                                 | `--------'  |
                                 |   libtool   |
                                 |   missing   |
                                 |  install-sh |
                                 |mkinstalldirs|
                                 `-------------'

 

 

----------------------------------引用结束

 

 

 

 

 

 

 


--
---