Linux Automake Use Tutorial instance __linux

Source: Internet
Author: User
Tags automake

Install Command:

Apt-get Install Automake

Automake instance:

Helloworld.c

#include <stdio.h>
#include <string.h>
extern int output (char* data);
int main ()
{
	int n=15;
	printf ("Hellow World%d \ n");
	Output ("from helloword.c");
	return 0;
}

Output.c

#include <stdio.h>
#include <string.h>
int output (char* data)
{
	printf ("Output data= %s\n ", data);
	return 0;
}

1. Execute the Order:

AutoScan

2, modify the Configure.scan and renamed to Configure.ac

#-*-autoconf-*-

# Process This file and autoconf to produce a configure script.

Ac_prereq ([2.68])

Ac_init ([HelloWorld], [2.0], [542335496@qq.com])

Am_init_automake (helloworld,2.0)

Ac_config_srcdir ([output.c])

Ac_config_headers ([config.h])

# Checks for programs.

Ac_prog_cc

# Checks for libraries.

# Checks for header files.

Ac_check_headers ([string.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

Ac_output (Makefile)

Command: MV Configure.scan configure.ac

Gedit Configure.ac

3. Execute the Order:

Aclocal produces aclocal.m4 file, which is a successful configuration

Autoconf produces configure file, which is a successful configuration

4. Execute the Order:

Autoheader Generation Config.h.in

5. Create and edit makefile.am files:

Gedit makefile.am

Content is:

automake_options= Foreign

bin_programs= HelloWorld

helloworld_sources= HELLOWORLD.C output.c

6, Automake--add-missing generate makefile.in file, no output information can be successful

7./configure

8, make

9. Make install compilation complete

10. Operation:

./helloworld

11, packaging and publishing, generate helloworld-2.0.tar.gz:

Make Dist




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.