HOME ABOUT WEB GITHUB TOP BOTTOM PREV NEXT
autoconf example: A Small Hello World
- Copyright Notice
- Create File: “README”
- Create File: “Makefile.am”
- Create File: “configure.ac”
- Create File: “src/Makefile.am”
- Create File: “src/main.c”
- RUN
Copyright Notice
// START Mon 28 Feb 2022 22:30:00 WIB
// Copyright (c) Free Software Foundation, Inc.
// Verbatim copying and distribution of this entire article is permitted in any medium,
// provided this notice is preserved.
// URL: https://www.gnu.org/savannah-checkouts/gnu/automake/manual/html_node/Hello-World.html
Create File: “README”
This is a demonstration package for GNU Automake.
Type 'info Automake' to read the Automake manual.
Create File: “Makefile.am”
SUBDIRS = src
dist_doc_DATA = README
Create File: “configure.ac”
AC_INIT([amhello], [1.0], [bug-automake@gnu.org])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_PROG_CC
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
Create File: “src/Makefile.am”
bin_PROGRAMS = hello
hello_SOURCES = main.c
Create File: “src/main.c”
#include <config.h>
#include <stdio.h>
// *** CHANGE THIS! **************
#define MYNAME "Your-GitHub-Account"
int
main (void)
{
puts ("Hello World!");
puts ("I am " MYNAME ".");
puts ("This is " PACKAGE_STRING ".");
return 0;
}
RUN
autoreconf --install
./configure
make
src/hello
make distcheck
make clean