Thanks for the reply. I would do it as you said also. My goal was to find out why _DEPENDENCIES is not doing
what I think it should. Even though this example is contrived, the same problem happens in examples that are not. If a dependency of a target is not built, then Makefile should build the dependency first. That is not what is happening here. Why can't Makefile go to right directory to build the dependency??? Chris -------- Original Message -------- Subject: Re: Problems getting dependencies compiled before executable.... From: Santosh <[EMAIL PROTECTED]> Date: Wed, June 11, 2003 10:12 pm To: [EMAIL PROTECTED] Why not have the executable outside and the library in a subdirectory. That is how I put my libraries. src/main.c src/helperfunctions/helperfunctions.a with regards, Santosh. On Tue, 10 Jun 2003 [EMAIL PROTECTED] wrote: > Assar > > Thanks for the email. I am using Red Hat 8 which means > automake 1.6 and autoconf 2.53. I spent some time > creating a very *simple* example like you requested. > I'd be very grateful if you looked at it.... > > In order to show you my problem with _DEPENDENCIES I > intentionally put the executable in src/exec and > the library stuff in src. Since the executable in > src/exec cannot be built without the library in src > being built *first*, I was hoping build process would > realize this and adjust accordingly. It didn't and > I got error message I want to fix. > > Here are the contents of 2 Makefile.am's that need to be fixed..... > > src/Makefile.am: > ----------------------------------------- > > noinst_LIBRARIES = libhelperfunctions.a > libhelperfunctions_a_SOURCES = printmessage1.c > printmessage1.h > printmessage2.c > printmessage2.h > printmessage3.c > printmessage3.h > SUBDIRS = exec > > > src/exec/Makefile.am > ----------------------------------------- > > bin_PROGRAMS = main > main_SOURCES = main.c > main_LDADD = -lhelperfunctions -lpthread -lm > main_DEPENDENCIES = ../libhelperfunctions.a > main_LDFLAGS = -L ../ > INCLUDES = -I ../ > > Here is what happens when I type make at top of source tree > (BTW: $(top_srcdir) = /home/seberino/MAIN/Wb/efe2).... > > Making all in src > make[1]: Entering directory `/home/seberino/MAIN/Wb/efe2/src' > Making all in exec > make[2]: Entering directory `/home/seberino/MAIN/Wb/efe2/src/exec' > make[2]: *** No rule to make target `../libhelperfunctions.a', > needed by `main'. Stop. > make[2]: Leaving directory `/home/seberino/MAIN/Wb/efe2/src/exec' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/seberino/MAIN/Wb/efe2/src' > make: *** [all-recursive] Error 1 > > > Here is a listing of entire source tree before doing anything... > > > (laptop /home/seberino/MAIN/Wb/efe2) % ls -lR > .: > total 24 > drwxrwxr-x 3 seberino seberino 4096 Jun 10 11:23 ./ > drwxrwxr-x 15 seberino seberino 4096 Jun 10 10:51 ../ > -rwxrwxr-x 1 seberino seberino 149 Jun 10 10:51 bootstrap > -rw-rw-r-- 1 seberino seberino 177 Jun 10 10:58 configure.ac > -rw-rw-r-- 1 seberino seberino 14 Jun 10 10:51 Makefile.am > drwxrwxr-x 4 seberino seberino 4096 Jun 10 11:24 src/ > > ./src: > total 44 > drwxrwxr-x 4 seberino seberino 4096 Jun 10 11:24 ./ > drwxrwxr-x 3 seberino seberino 4096 Jun 10 11:23 ../ > drwxrwxr-x 2 seberino seberino 4096 Jun 10 11:24 exec/ > -rw-rw-r-- 1 seberino seberino 380 Jun 10 10:56 Makefile.am > -rw-rw-r-- 1 seberino seberino 189 Jun 10 10:51 > printmessage1.c -rw-rw-r-- 1 seberino seberino 249 Jun 10 > 10:51 printmessage1.h -rw-rw-r-- 1 seberino seberino 189 Jun > 10 10:51 printmessage2.c -rw-rw-r-- 1 seberino seberino 249 > Jun 10 10:51 printmessage2.h -rw-rw-r-- 1 seberino seberino > 189 Jun 10 10:51 printmessage3.c -rw-rw-r-- 1 seberino seberino > 249 Jun 10 10:51 printmessage3.h > > ./src/exec: > total 16 > drwxrwxr-x 2 seberino seberino 4096 Jun 10 11:24 ./ > drwxrwxr-x 4 seberino seberino 4096 Jun 10 11:24 ../ > -rw-rw-r-- 1 seberino seberino 625 Jun 10 10:51 main.c > -rw-rw-r-- 1 seberino seberino 202 Jun 10 11:07 Makefile.am > > > Thanks! > > Chris > > > > > -------- Original Message -------- > Subject: Re: Problems getting dependencies compiled before > executable.... From: Assar Westerlund <[EMAIL PROTECTED]> > Date: Fri, June 6, 2003 10:38 pm > To: <[EMAIL PROTECTED]> > > <[EMAIL PROTECTED]> writes: > > I would have preferred that build system would see > > > > myprogram_DEPENDENCIES = libmylibrary.a > > > > and automatically known to build library FIRST. > > Why don't you use myprogram_LDADD = libmylibrary.a ? > > I'm not able to reproduce your problem. Can you tell us what > version of automake you're running and show us a minimal example > that shows the problem? > > > > > -- Santosh Gangwani Software Engineer, Technology and Consultancy Centre (TCC), IIIT (International Institute of Information Technology) Opposite CMC, Gachibowli Hyderabad - 500019 Ph: 91-40-3001967, 91-40-3001969 Fax: 91-40-3001413