Re: Dependency issues after adding new sources.

2009-09-14 Thread Dave Steenburgh
My apologies for not replying sooner; I certainly appreciate everyone's
input.  This weekend just got crazy.

On Fri, Sep 11, 2009 at 1:59 PM, Ralf Wildenhues wrote:

 - do you use AM_MAINTAINER_MODE?  If yes, then please
   ./configure --enable-maintainer-mode


I do not; should I?


 - can you do the following:
   echo 'int unused_function () { return 0; }'  foo.c
   echo 'program_SOURCES += foo.c'  Makefile.am
   make


Well, now I'm baffled, because this works just fine.  So, it seems, does my
entire build.

- What system are you on, what compiler, 'make' program do you use?


I work primarily with Cygwin on Windows XP.
$ g++-4 -v
...
gcc version 4.3.2 20080827 (beta) 2 (GCC)
$ make -v
GNU Make 3.81
...

So adding another source now works just fine.  Since the problem manifested,
I've done all kinds of things while trying to fix the problem.  autoreconf
-vfi, ./config.status --recheck, ./config.status depfiles (which always
seems to do nothing at all), ./config.status (which actually replaces the
.deps directory if I've deleted it, but wasn't creating a file for the new
source until after the actual problem was fixed), make, make clean, make
[specific .o file], touch [various header files].  One, or a combination, of
those commands must have fixed the problem.

Supposing this issue rears its ugly head again (and I'm sure it will,
because it's already happened many times), I'll come here first so maybe
someone can figure out what I'm doing wrong.


Re: Dependency issues after adding new sources.

2009-09-14 Thread Ralf Wildenhues
* Dave Steenburgh wrote on Mon, Sep 14, 2009 at 04:40:50PM CEST:
 My apologies for not replying sooner; I certainly appreciate everyone's
 input.  This weekend just got crazy.

No problem at all, I sometimes take months to reply.

 On Fri, Sep 11, 2009 at 1:59 PM, Ralf Wildenhues wrote:
 
  - do you use AM_MAINTAINER_MODE?  If yes, then please
./configure --enable-maintainer-mode
 
 
 I do not; should I?

No.

 So adding another source now works just fine.  Since the problem manifested,
 I've done all kinds of things while trying to fix the problem.  autoreconf
 -vfi, ./config.status --recheck,

 ./config.status depfiles (which always seems to do nothing at all),

Yeah, it operates only on those makefiles which have also been listed as
command line arguments to config.status.

 ./config.status (which actually replaces the
 .deps directory if I've deleted it, but wasn't creating a file for the new
 source until after the actual problem was fixed),

It merely ensures that all files included by the makefiles exist; if one
doesn't exist yet, then it creates a dummy file.

 make, make clean, make
 [specific .o file], touch [various header files].  One, or a combination, of
 those commands must have fixed the problem.

Hmm.

 Supposing this issue rears its ugly head again (and I'm sure it will,
 because it's already happened many times), I'll come here first so maybe
 someone can figure out what I'm doing wrong.

The most helpful is when you also have time stamp information from
*before* running that 'make' which doesn't rebuild.  I know it sounds
almost impossible to get reliably, but that's what usually leads
straight to the answer.

Cheers,
Ralf




Dependency issues after adding new sources.

2009-09-11 Thread Dave Steenburgh
Please excuse my ignorance, but my search fu is weak, and I think the
authors of tfm are conspiring to bewilder me.  I have read several tutorials
and discussions on how to use the autotools, but to be honest my
understanding of them is extremely limited at best.
I have this problem with several of my programs, but it's most frustrating
with my current program, which at the moment has a flat directory structure.
 The program in question is developed little by little, so from time to time
I need to add new source files to the program's _SOURCES in Makefile.am.  I
was under the impression that after doing so, running make from the build
directory would magically figure everything out and build the program
correctly.  What happens instead is the Makefile appears to be regenerated,
but my new sources are not included in it.  I have tried multiple methods to
fix this, most of them to no avail.  Currently, the new sources are built
and are linked into the executable, but most of the old sources aren't being
rebuilt when a common header is changed.  The only thing that fixes all the
issues is to start with an empty build directory and re-run the configure
script.  I doubt that it's really necessary to create a new build directory
every time I add a new class.  So what could I be doing wrong?  I will
gladly share any information about my build environment that may help a
diagnosis, but I'd prefer to keep the code private.


Re: Dependency issues after adding new sources.

2009-09-11 Thread John Calcote

Hi Dave,

On 9/11/2009 9:24 AM, Dave Steenburgh wrote:

Please excuse my ignorance, but my search fu is weak, and I think the
authors of tfm are conspiring to bewilder me.  I have read several tutorials
and discussions on how to use the autotools, but to be honest my
understanding of them is extremely limited at best.
I have this problem with several of my programs, but it's most frustrating
with my current program, which at the moment has a flat directory structure.
  The program in question is developed little by little, so from time to time
I need to add new source files to the program's _SOURCES in Makefile.am.  I
was under the impression that after doing so, running make from the build
directory would magically figure everything out and build the program
correctly.  What happens instead is the Makefile appears to be regenerated,
but my new sources are not included in it.  I have tried multiple methods to
fix this, most of them to no avail.  Currently, the new sources are built
and are linked into the executable, but most of the old sources aren't being
rebuilt when a common header is changed.  The only thing that fixes all the
issues is to start with an empty build directory and re-run the configure
script.  I doubt that it's really necessary to create a new build directory
every time I add a new class.  So what could I be doing wrong?  I will
gladly share any information about my build environment that may help a
diagnosis, but I'd prefer to keep the code private.
   


Please share at least one of your Makefile.am files with us - preferably 
the one containing the _SOURCES directive that you modified.


Thanks,
John





Re: Dependency issues after adding new sources.

2009-09-11 Thread Xochitl Lunde
automake-bounces+xochitl_lunde=tripplite@gnu.org wrote on 09/11/2009 
10:24:58 AM:

 Please excuse my ignorance, but my search fu is weak, and I think the
 authors of tfm are conspiring to bewilder me.  I have read several 
tutorials
 and discussions on how to use the autotools, but to be honest my
 understanding of them is extremely limited at best.
 I have this problem with several of my programs, but it's most 
frustrating
 with my current program, which at the moment has a flat directory 
structure.
  The program in question is developed little by little, so from time to 
time
 I need to add new source files to the program's _SOURCES in Makefile.am. 
 I
 was under the impression that after doing so, running make from the 
build
 directory would magically figure everything out and build the program
 correctly.  What happens instead is the Makefile appears to be 
regenerated,
 but my new sources are not included in it.  I have tried multiple 
methods to
 fix this, most of them to no avail.  Currently, the new sources are 
built
 and are linked into the executable, but most of the old sources aren't 
being
 rebuilt when a common header is changed.  The only thing that fixes all 
the
 issues is to start with an empty build directory and re-run the 
configure
 script.  I doubt that it's really necessary to create a new build 
directory
 every time I add a new class.  So what could I be doing wrong?  I will
 gladly share any information about my build environment that may help a
 diagnosis, but I'd prefer to keep the code private.
 

Sometimes just 'make' will figure it out for you and sometimes not.  I'm 
sorry I don't know the specifics, but for example, if you add source file 
to 'Makefile.am', and forget the trailing '\' to append the next source 
file then it will not regenerate correctly for you until you fix the 
problem and re-run the whole shebang.  If you make interesting changes in 
Makefile.am or configure.ac, it's most reliable to just run the whole 
build again from the command line in the directory where your configure.ac 
is stored.

$ aclocal;autoconf;automake --add-missing;./configure your-options-here

If it turns out you are still missing some needed build files after doing 
this, you can try running 'autoreconf --force --install', which does help 
me sometimes on certain systems after a fresh source checkout.  Then after 
all that you should be good to run 'make'.  If you edit 'Makefile.am' or 
'configure.ac', then you want to run that command line again with 
aclocal;autoconf;automake and configure.  Sometimes you have to do it, and 
sometimes not. It sort of depends on what you change whether or not you 
can get away with just running 'make' again.  Note that if you are 
changing code, you don't have to do this, only if you are changing 
'Makefile.am' or 'configure.ac'.  If you are only changing code then you 
can run 'make clean' and 'make' as much as you like without redoing the 
Makefiles.

Your new source files might end up missing, because I think 'automake' 
command is responsible for translating 'Makefile.am' into 'Makefile.in'. 
Then './configure' will create all the Makefiles listed in AC_OUTPUT from 
all 'Makefile.in'.  If you typed 'make' and automake tried to regenerate 
the 'Makefile.in', but there was a mistake in 'Makefile.am', then you are 
stuck until you fix 'Makefile.am' and run that long command line again.


Re: Dependency issues after adding new sources.

2009-09-11 Thread Ralf Wildenhues
Hello Dave,

* Dave Steenburgh wrote on Fri, Sep 11, 2009 at 05:24:58PM CEST:
 I have this problem with several of my programs, but it's most frustrating
 with my current program, which at the moment has a flat directory structure.
  The program in question is developed little by little, so from time to time
 I need to add new source files to the program's _SOURCES in Makefile.am.  I
 was under the impression that after doing so, running make from the build
 directory would magically figure everything out and build the program
 correctly.

That should typically work; so let's find out why it doesn't work for
you:

- do you use AM_MAINTAINER_MODE?  If yes, then please
   ./configure --enable-maintainer-mode

so that autotools are rerun when and as needed.

- can you do the following:
   echo 'int unused_function () { return 0; }'  foo.c
   echo 'program_SOURCES += foo.c'  Makefile.am
   make

(please adjust the program_SOURCES variable to match your names) and
post all output of these commands literally (i.e., cut and paste)?

- What system are you on, what compiler, 'make' program do you use?

 What happens instead is the Makefile appears to be regenerated,
 but my new sources are not included in it.  I have tried multiple methods to
 fix this, most of them to no avail.  Currently, the new sources are built
 and are linked into the executable, but most of the old sources aren't being
 rebuilt when a common header is changed.  The only thing that fixes all the
 issues is to start with an empty build directory and re-run the configure
 script.

Ah, that sounds like only dependency tracking is not enabled.  Please
try passing --enable-dependency-tracking to configure (which also turns
on slow dependency extractor mechanisms).  Show us the configure output,
esp. where it says dependency mode of 

The point here is that without the switch, only fast dependency
extractors are tried out: those which can be run as side-effects from
compilation.

 I doubt that it's really necessary to create a new build directory
 every time I add a new class.  So what could I be doing wrong?  I will
 gladly share any information about my build environment that may help a
 diagnosis, but I'd prefer to keep the code private.

That's fine really.

Cheers,
Ralf