Next: , Up: Some example packages   [Index]


17.1 The simplest GNU program

hello is renowned for its classic simplicity and versatility. What better place to begin a tour? The below shows what could be used as the Hello distribution’s Makefile.am.

bin_PROGRAMS = hello
hello_SOURCES = hello.c version.c getopt.c getopt1.c getopt.h
hello_LDADD = @ALLOCA@
info_TEXINFOS = hello.texi
hello_TEXINFOS = gpl.texi

EXTRA_DIST = testdata

check-local: hello
        @echo expect no output from diff
        ./hello > test.out
        diff -c $(srcdir)/testdata test.out
        rm -f test.out

Of course, Automake also requires some minor changes to configure.in. The new configure.in would read:

dnl Process this file with autoconf to produce a configure script.
AC_INIT(hello.c)
VERSION=1.3
AC_SUBST(VERSION)
PACKAGE=hello
AC_SUBST(PACKAGE)
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_STDC_HEADERS
AC_HAVE_HEADERS(string.h fcntl.h sys/file.h)
AC_ALLOCA
AC_OUTPUT(Makefile)

If Hello were really going to use Automake, the version.c file would probably be deleted, or changed so as to be automatically generated.