C语言automake

  1. 编辑hello.c
#include <stdio.h>

void colorprint(char* str, char* color)
{
        printf("\033[%sm",color);
        printf("%s\n",str);
        printf("\033[0m");
}

void debug(char* str)
{
        colorprint(str, "34");
}

void warning(char* str)
{
        colorprint(str, "33");
}

void info(char* str)
{
        colorprint(str, "32");
}

void error(char* str)
{
        colorprint(str, "31");
}

int main()
{
        char* str = "hello world";
        char* color = "0";
        colorprint(str,color);
        debug(str);
        info(str);
        warning(str);
        error(str);
        return 0;
}
  1. autoscan
    在这里插入图片描述
  2. aclocal确定缺少的文件,将configure.scan重命名
    在这里插入图片描述
  3. vim configure.ac
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(hello,1.0)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE

AC_OUTPUT(Makefile)

  1. autoheader
    在这里插入图片描述
  2. autoconf
    在这里插入图片描述
  3. vim Makefile.am 文件内容如下
bin_PROGRAMS=hello
hello_SOURCES=hello.c
  1. touch NEWS README AUTHORS ChangeLog

  2. automake --add-missing
    在这里插入图片描述

  3. ./configure
    在这里插入图片描述

  4. make
    在这里插入图片描述

  5. ./hello
    在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值