autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: building a smiple hello_world


From: Ralf Wildenhues
Subject: Re: building a smiple hello_world
Date: Wed, 8 Sep 2004 09:59:24 +0200
User-agent: Mutt/1.4.1i

* Fred J. wrote on Tue, Sep 07, 2004 at 11:04:57PM CEST:
> 
> I constructed an simple program but not sure if there
> is something wrong.
> $automake gives this error
> configure.ac:7: required file `./ltmain.sh' not found

Ok, seems you have gotten over that one.

> I use the run file to save typing, any problem with
> using it with ever project I create?

No, except that it's overkill.

> many thanks
> 
> :~/Hello_world$ tree.
> =============
> |-- Makefile.am
> |-- configure.ac
> |-- run
> `-- src
> ***|-- Makefile.am
> ***|-- hello.cpp
> ***`-- prnt
> *****|-- Makefile.am
> *****|-- print.cpp
> *****`-- print.h
> 
*snip*
> 
> Hello_world/configure.ac
> ===============
> AC_INIT(src/hello.cpp)
> AM_INIT_AUTOMAKE(hello,0.1)
> AM_CONFIG_HEADER(config.h)
> AC_PROG_CC
> AC_PROG_CXX
> AC_PROG_INSTALL
> AC_PROG_LIBTOOL
> AC_OUTPUT(Makefile src/Makefile src/prnt/Makefile)

Using `autoupdate' will change these invocation to a newer form.
This is mostly a stylistic issue, however.

> src/Makefile.am
> ==========
> bin_PROGRAMS = hello
> hello_SOURCES = print.h print.cpp hello.cpp

You do not have files print.h print.cpp here.  Remove them from this
line[1].

> SUBDIRS = prnt

Change this to
  SUBDIRS = prnt .
so things in there are built first.

> LDADD = prnt/libprnt.a
> 
> prnt/Makefile.am
> ===========
> noinst_LIBRARIES = libprnt.a
> libprnt_a_SOURCES = print.h print.cpp
> INCLUDES = address@hidden@/

The INCLUDES line should not be necessary.
However, in src/Makefile.am it would be advisable to include
$(srcdir)/print for print.h

*snip*
> 
> Hello_world/run
> ==========
> #!/bin/bash
> 
> echo *************************autoheader
*snip*

Two comments on this script:  You might not have known it, but if you
don't quote the arguments of echo (and, FWIW, any shell line), they are
undergoing globbing.  You'll see what I mean when you do
$ touch FOOautoheader BARautoheader
$ echo *************************autoheader

Secondly, all of this can be accomplished with fewer commands (except
this, which is really only needed once):
> touch NEWS README AUTHORS ChangeLog stamp-h

$ autoreconf -v -i -f
$ ./configure
$ make


* Fred J. wrote on Wed, Sep 08, 2004 at 09:30:10AM CEST:
> I am getting this error:
> **************************************************
> make[3]: Entering directory
> `/home/sam/Hello_world/src'
> make[3]: *** No rule to make target `print.cpp',
> needed by `print.o'.  Stop.
> make[3]: Leaving directory `/home/sam/Hello_world/src'
> ***************************************************

This is fixed by [1].

Please do not start a new thread for essentially the same question.
Also, a lot of this is explained in the Autoconf manual.

Regards,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]