autotools文档格式.docx

上传人:b****5 文档编号:19842492 上传时间:2023-01-10 格式:DOCX 页数:14 大小:17.56KB
下载 相关 举报
autotools文档格式.docx_第1页
第1页 / 共14页
autotools文档格式.docx_第2页
第2页 / 共14页
autotools文档格式.docx_第3页
第3页 / 共14页
autotools文档格式.docx_第4页
第4页 / 共14页
autotools文档格式.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

autotools文档格式.docx

《autotools文档格式.docx》由会员分享,可在线阅读,更多相关《autotools文档格式.docx(14页珍藏版)》请在冰豆网上搜索。

autotools文档格式.docx

STRING----\n\"

%s\"

\n"

string);

return 

0;

}

//interface 

of 

this 

program

main(int 

argc 

 

char 

**argv){

str_read[1024];

Please 

INPUT 

something 

end 

by 

[ENTER]\n"

);

scanf("

%s"

str_read);

str(str_read 

3、生成configure.ac

configure.ac是automake的输入文件,所以必须先生成该文件。

执行命令:

[root@localhost 

str]# 

ls

src

autoscan

autom4te:

configure.ac:

no 

such 

file 

or 

directory

autoscan:

/usr/bin/autom4te 

failed 

with 

exit 

status:

1

autoscan.log 

configure.scan 

cp 

configure.ac 

修改 

-*- 

Autoconf 

-*-

Process 

to 

produce 

configure 

script.

AC_PREREQ(2.59)

AC_INIT(FULL-PACKAGE-NAME, 

VERSION, 

BUG-REPORT-ADDRESS)

AC_CONFIG_SRCDIR([include/str.h])

AC_CONFIG_HEADER([config.h])

Checks 

for 

programs.

AC_PROG_CC

libraries.

header 

files.

typedefs, 

structures, 

and 

compiler 

characteristics.

library 

functions.

AC_OUTPUT

修改

AC_INIT(str,0.0.1, 

[bug@sounos.org])

FULL-PACKAGE-NAME 

为程序名称,VERSION为当前版本, 

BUG-REPORT-ADDRESS为bug汇报地址

添加[color=red]AM_INIT_AUTOMAKE[/color] 

添加[color=red]AC_CONFIG_FILES([Makefile])[/color]

#AC_INIT(FULL-PACKAGE-NAME, 

AC_INIT(str, 

0.0.1, 

AM_INIT_AUTOMAKE

AC_CONFIG_FILES([Makefile])

4、执行aclocal

aclocal

/usr/share/aclocal/libfame.m4:

6:

warning:

underquoted 

definition 

AM_PATH_LIBFAME

run 

info 

'

(automake)Extending 

aclocal'

see 

5、制作Makefile.am

cat 

Makefile.am

#Makefile.am

bin_PROGRAMS 

str

str_SOURCES 

include/str.h 

src/str.c

str_CPPFLAGS 

-I 

include/

6、autoheader

autoheader

7、automake必须文件:

install-sh

missing

INSTALL

NEWS

README

AUTHORS

ChangeLog

COPYING

depcomp 

其中 

可以通过automake 

-a选项自动生成,所以这里只需要建立如下文件

touch 

NEWS 

README 

AUTHORS 

8、执行automake

-a

installing 

`./install-sh'

`./missing'

Makefile.am:

`./INSTALL'

`./COPYING'

`./compile'

`./depcomp'

9、autoconf

autoconf

aclocal.m4 

config.h.in 

Makefile.am 

ChangeLog 

COPYING 

INSTALL 

Makefile.in 

autom4te.cache 

compile 

install-sh 

missing 

10、执行测试:

执行./configure

./configure 

--prefix=/u

checking 

BSD-compatible 

install... 

/usr/bin/install 

-c

whether 

build 

environment 

is 

sane... 

yes

gawk... 

gawk

sets 

$(MAKE)... 

gcc... 

gcc

default 

output 

name... 

a.out

the 

works... 

we 

are 

cross 

compiling... 

no

suffix 

executables...

object 

files... 

o

using 

GNU 

compiler... 

gcc 

accepts 

-g... 

option 

accept 

ANSI 

C... 

none 

needed

style 

used 

make... 

GNU

dependency 

gcc3

configure:

creating 

./config.status

config.status:

Makefile

config.h

config.h 

unchanged

executing 

depfiles 

commands

执行 

make

make

all-am

make[1]:

Entering 

directory 

`/data/devel/c/str'

if 

-DHAVE_CONFIG_H 

-I. 

include/ 

-g 

-O2 

-MT 

str-str.o 

-MD 

-MP 

-MF 

.deps/str-str.Tpo"

-c 

-o 

`test 

-f 

src/str.c'

|| 

echo 

./'

`src/str.c;

\

then 

mv 

.deps/str-str.Po"

;

else 

rm 

1;

fi

str 

str-str.o

Leaving 

install

install

test 

-z 

/u/bin"

-p 

-- 

str'

/u/bin/str'

Nothing 

be 

done 

`install-data-am'

.

11、测试程序:

/u/bin/str

[ENTER]

abcksdhfklsdklfdjlkfd

----PRINT 

STRING----

abcksdhfklsdklfdjlkfd"

结束语:

这只是一个小例子,如果要把这个用得很好需要不断的磨练。

呵呵,见笑了。

-----

添加测试包:

dist-gzip

!

-d 

str-0.0.1 

find 

-type 

-perm 

-200 

-exec 

chmod 

u+w 

{} 

&

-fr 

str-0.0.1;

};

str-0.0.1

-777 

a+rwx 

\;

-444 

-links 

a+r 

-400 

/bin/sh 

/data/devel/c/str/install-sh 

-m 

-R 

tardir=str-0.0.1 

/data/devel/c/str/missing 

--run 

tar 

chof 

$tardir"

GZIP=--best 

gzip 

>

str-0.0.1.tar.gz

添加一个支持子目录、静态库、自定义configure选项的包

支持子目录Makefile.am 

选项 

SUBDIR 

#Automake 

interface 

SUBDIRS 

支持静态库Makefile.am

EXTRA_DIST 

用于添加除源码外的文件到dist包

interface

hello

hello_SOURCES 

hello.c 

lib/sbase.h

hello_CPPFLAGS 

lib

hello_LDFLAGS 

-static 

lib/libsbase.a

configure.ac

AC_INIT(hello, 

[SounOS@])

#AM 

声明

AC_CONFIG_SRCDIR([src/hello.c])

AC_HEADER_STDC

AC_CHECK_HEADERS([stdint.h 

stdlib.h 

sys/socket.h])

AC_C_CONST

AC_TYPE_SIZE_T

AC_TYPE_UINT32_T

AC_TYPE_UINT64_T

#用于自定义configure 

选项,见acinclude.am

AC_CHECK_EXTRA_OPTIONS

AC_CONFIG_FILES([Makefile

src/Makefile])

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > IT计算机 > 电脑基础知识

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1