Re: Problems getting dependencies compiled before executable....
[EMAIL PROTECTED] writes: Thanks for the info. I really appreciate it. What is the easiest way then to tell system to go to a different directory to build a dependency if it is not built yet?? Either by having the SUBDIRS done in the right order as Alexandre already mentioned, or adding something like this to the Makefile.am: bar/libbar.la: cd bar $(MAKE) libbar.la
Re: Problems getting dependencies compiled before executable....
Assar == Assar Westerlund [EMAIL PROTECTED] writes: [...] Assar bar/libbar.la: Assar cd bar $(MAKE) libbar.la Unless you declare this rule as PHONY (or list all the dependencies of bar/libbar.la and the dependencies thereof) this introduces a bug in the case the library already exists. Your program will be linked to the old library, and then the library will be rebuilt when make enter the subdirectory as part of the SUBDIRS recursion. -- Alexandre Duret-Lutz
RE: Problems getting dependencies compiled before executable....
Alexandre Thanks for the info. I really appreciate it. What is the easiest way then to tell system to go to a different directory to build a dependency if it is not built yet?? By the way, if you don't mind me asking, what is the point of _DEPENDENCIES when you can just add library to _LDADD and Autotools will update dependency list automatically from that??? Chris Original Message Subject: Re: Problems getting dependencies compiled before executable From: Alexandre Duret-Lutz [EMAIL PROTECTED] Date: Sat, June 14, 2003 12:19 pm To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] Chris == Chris Seberino [EMAIL PROTECTED] writes: [...] Chris If a dependency of a target is not built, then Makefile Chris should build the dependency first. That is not what Chris is happening here. Why can't Makefile go to right Chris directory to build the dependency??? [...] Because the rules to build this dependency are in the subdirectory not in the current one. See http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html for some background. You can tell Automake you want the subdirectory built *after* the current one by changing src/Makefile.am's SUBDIRS definition to SUBDIRS = . exec Alternatively, you can merge src/exec/Makefile.am into src/Makefiles.am. It's ok to write things like noinst_LIBRARIES = libfoo.a libfoo_a_SOURCES = foo.c bin_PROGRAMS = exec/main exec_main_SOURCES = exec/main.c exec_main_LDADD = libfoo.a -- Alexandre Duret-Lutz
Re: Problems getting dependencies compiled before executable....
Hi, [EMAIL PROTECTED] writes: By the way, if you don't mind me asking, what is the point of _DEPENDENCIES when you can just add library to _LDADD and Autotools will update dependency list automatically from that??? Usually, there's no point. However, there can be cases where automake cannot figure out that a library is part of link line, for example when the list of libraries is AC_SUBSTed in. - Hari -- Raja R Harinath -- [EMAIL PROTECTED]
Re: Problems getting dependencies compiled before executable....
Chris == Chris Seberino [EMAIL PROTECTED] writes: [...] Chris If a dependency of a target is not built, then Makefile Chris should build the dependency first. That is not what Chris is happening here. Why can't Makefile go to right Chris directory to build the dependency??? [...] Because the rules to build this dependency are in the subdirectory not in the current one. See http://www.tip.net.au/~millerp/rmch/recu-make-cons-harm.html for some background. You can tell Automake you want the subdirectory built *after* the current one by changing src/Makefile.am's SUBDIRS definition to SUBDIRS = . exec Alternatively, you can merge src/exec/Makefile.am into src/Makefiles.am. It's ok to write things like noinst_LIBRARIES = libfoo.a libfoo_a_SOURCES = foo.c bin_PROGRAMS = exec/main exec_main_SOURCES = exec/main.c exec_main_LDADD = libfoo.a -- Alexandre Duret-Lutz
Re: Problems getting dependencies compiled before executable....
For files in same directory, it does compile according to dependencies order. But for directories, it follows the order you give. Why does it not do automatically according to dependency, I do not know. I think it is good if you have the dependencies between modules clearly with you while designing and use it to give the order to automake. with regards, Santosh. On Wed, 11 Jun 2003 [EMAIL PROTECTED] wrote: 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-x3 seberino seberino 4096 Jun 10 11:23 ./ drwxrwxr-x 15 seberino seberino 4096 Jun 10 10:51 ../ -rwxrwxr-x1 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-x4 seberino seberino 4096 Jun 10 11:24 src/ ./src: total 44 drwxrwxr-x4 seberino seberino 4096 Jun 10 11:24 ./ drwxrwxr-x3 seberino seberino 4096 Jun 10 11:23 ../ drwxrwxr-x2 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-x2 seberino seberino 4096 Jun 10 11:24 ./ drwxrwxr-x4 seberino seberino 4096 Jun 10 11:24
Re: Problems getting dependencies compiled before executable....
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-x3 seberino seberino 4096 Jun 10 11:23 ./ drwxrwxr-x 15 seberino seberino 4096 Jun 10 10:51 ../ -rwxrwxr-x1 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-x4 seberino seberino 4096 Jun 10 11:24 src/ ./src: total 44 drwxrwxr-x4 seberino seberino 4096 Jun 10 11:24 ./ drwxrwxr-x3 seberino seberino 4096 Jun 10 11:23 ../ drwxrwxr-x2 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-x2 seberino seberino 4096 Jun 10 11:24 ./ drwxrwxr-x4 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
Re: Problems getting dependencies compiled before executable....
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-x3 seberino seberino 4096 Jun 10 11:23 ./ drwxrwxr-x 15 seberino seberino 4096 Jun 10 10:51 ../ -rwxrwxr-x1 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-x4 seberino seberino 4096 Jun 10 11:24 src/ ./src: total 44 drwxrwxr-x4 seberino seberino 4096 Jun 10 11:24 ./ drwxrwxr-x3 seberino seberino 4096 Jun 10 11:23 ../ drwxrwxr-x2 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-x2 seberino seberino 4096 Jun 10 11:24 ./ drwxrwxr-x4 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?
Re: Problems getting dependencies compiled before executable....
[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?