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.