项目wangkangluo1

本文介绍了一个自动化构建项目的具体实现过程,包括目录结构、Makefile配置、自动化工具使用等关键步骤,并提供了一个测试用例来验证构建结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一.目录结构和源码:

下载地址http://u.115.com/file/dn9rgh86


目录结构:

   wangkangluo1

        --Makefile.am

        --src

                --Makefile.am

                --findStringsWithoutCase.h

                --findStringsWithoutCase.c

代码如下:

 wangkangluo1

       --Makefile.am

SUBDIRS = src 

wangkangluo1

      --src

            --Makefile.am

AUTOMAKE_OPTIONS=foreign                                                                                                                                                         
lib_LTLIBRARIES
= libwangkangluo1.la

libwangkangluo1_la_SOURCES
= findStringsWithoutCase.c stringsReplace.c

wangkangluo1include_HEADERS
= findStringsWithoutCase.h stringsReplace.h wangkangluo1.h

wangkangluo1includedir
= ${includedir}/wangkangluo1/

  

  

二.makefile步骤:

 $autoscan 

            生成configure.scan  --> 重命名 configure.ac

    代码如下:

     wangkangluo1

           --configure.ac

   

#                                               -*- Autoconf -*-                                                                                                                 
# Process
this file with autoconf to produce a configure script.

AC_PREREQ([
2.65])
AC_INIT(wangkangluo1
, 1.01, 304243050@qq.com)
AM_INIT_AUTOMAKE()
#AC_CONFIG_SRCDIR([src/findWithoutCase.h])
#AC_CONFIG_HEADERS([config.h])

# Checks
for programs.
AC_PROG_CC
AC_PROG_LIBTOOL

# Checks for libraries.

# Checks
for header files.
AC_CHECK_HEADERS([stdlib.h
string.h])

# Checks
for typedefs, structures, and compiler characteristics.

# Checks
for library functions.
AC_FUNC_MALLOC
AC_CHECK_FUNCS([memset pow strstr])

#AC_CONFIG_FILES([Makefile
# src
/Makefile])
AC_OUTPUT(src/Makefile)
  

$ aclocal
$ autoconf
$ libtoolize -f -c
$ automake -a
$ touch NEWS
$ touch README
$ touch AUTHORS
$ touch ChangeLogs
$ automake
$ ./configure
$ make
$ sudo make install
    $sudo ldconfig            <----注意要将环境应用

三.测试:


test.c

#include        <errno.h>                                                                                                                                                        
#include
<math.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
"findWithoutCase.h"

/*
* === FUNCTION ======================================================================
* Name: main
* Description: main function
* =====================================================================================
*/
int
main (
int argc, char *argv[] )
{
char *strings = "fjdkasjfkdjsipho中H";
char *key = "中h";
char *pos = find_strings_without_case(strings, key);
printf (
"\nProgram %s\n\n", pos);
free(pos);
printf (
"\nProgram %s\n\n", argv[0] );

return EXIT_SUCCESS;
}
/* ---------- end of function main ---------- */

  

编译:gcc -g -Wall -O0 test.c -o test -lm  -lwangkangluo1

运行:./test

 

*****output*******
Program 中H

  

转载于:https://www.cnblogs.com/wangkangluo1/archive/2011/07/20/2112059.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值