Re: Create a custom target
Hi John Thanks a lot it worked and it made my day :-) I would really appreciate if you could pass me some useful links regarding automake. I wonder where do we get those big target list automatically appended to all.I would like to know more about automake. Sure, just add it to the all-local target as a dependency, like this: all-local: extra --john -- View this message in context: http://www.nabble.com/Create-a-custom-target-tp18299452p23210529.html Sent from the Gnu - Automake - General mailing list archive at Nabble.com.
Re: Create a custom target
See my online Autotools book at freesoftwaremagazine: http://www.freesoftwaremagazine.com/books/autotools_a_guide_to_autoconf_automake_libtool Chapter 4 is all about automake. This book is due to be published by No Starch Press in October 09. John On 4/24/2009 12:16 AM, automake wrote: Hi John Thanks a lot it worked and it made my day :-) I would really appreciate if you could pass me some useful links regarding automake. I wonder where do we get those big target list automatically appended to all.I would like to know more about automake. Sure, just add it to the all-local target as a dependency, like this: all-local: extra --john
Re: Create a custom target
On Thursday 2009-04-23 04:54, automake wrote: Hi I have a similar problem with giving a customized target. I have included target into Makefile.am as extra: ...nm ...link But the default target for makefiles from configure.ac is all. Is there a way to add this target to all sub-targets? You could use the include directive to slurp in 'extra' from a separate file.
Re: Create a custom target
On 4/22/2009 8:54 PM, automake wrote: Hi I have a similar problem with giving a customized target. I have included target into Makefile.am as extra: ...nm ...link But the default target for makefiles from configure.ac is all. Is there a way to add this target to all sub-targets? Sure, just add it to the all-local target as a dependency, like this: all-local: extra --john
Re: Create a custom target
Hi I have a similar problem with giving a customized target. I have included target into Makefile.am as extra: ...nm ...link But the default target for makefiles from configure.ac is all. Is there a way to add this target to all sub-targets? Ralf Wildenhues wrote: Hello Tavian, * Tavian Barnes wrote on Sun, Jul 06, 2008 at 07:28:30AM CEST: Hi, guys. I have a question: how do I create a custom target, and selectively compile some code, and run the compiled executable, when this target is chosen? Specifically, I have a benchmarking suite for a library I wrote, and I want to compile the code in the bench/ directory, and run the executable, when the user types 'make bench'. I tried looking this up in the manual, but couldn't find it; sorry if I missed something obvious. Most of the Makefile.am text is copied verbatim into the Makefile.in (and from there into the Makefile). So if you want to add custom targets, just write plain make rules: bench: prerequisites... ... compile ... .PHONY: bench Cheers, Ralf -- View this message in context: http://www.nabble.com/Create-a-custom-target-tp18299452p23189404.html Sent from the Gnu - Automake - General mailing list archive at Nabble.com.
Re: Create a custom target
On Sun, Jul 6, 2008 at 11:25 PM, Ralf Wildenhues [EMAIL PROTECTED] wrote: Hello Tavian, please don't top-post, thank you. Sorry, I got lazy. Stupid GMail. * Tavian Barnes wrote on Sun, Jul 06, 2008 at 07:45:23PM CEST: On Sun, Jul 6, 2008 at 1:59 AM, Ralf Wildenhues [EMAIL PROTECTED] wrote: Most of the Makefile.am text is copied verbatim into the Makefile.in (and from there into the Makefile). So if you want to add custom targets, just write plain make rules: bench: prerequisites... ... compile ... .PHONY: bench Okay, but how do I then get automake to handle the compilation? I don't want to type in the compilation commands myself; that's what automake is for. If I add the benchmarking program to noinst_PROGRAMS, it compiles when 'make' is run, rather than only when 'make bench' is run. Ah, ok. Then you can use something like: EXTRA_PROGRAMS = prog prog_SOURCES = ... bench: prog$(EXEEXT) execute prog$(EXEEXT)... .PHONY: bench This works great, thanks. What does .PHONY do? Also, when I wrote a custom target in bench/Makefile.am, the root makefile didn't seem to notice, and running make bench from the root of the project simply gave make: Nothing to be done for `bench'. Either you look into nonrecursive Makefiles, or you will have to write a forwarding target, e.g.: bench: cd bench $(MAKE) $(AM_MAKEFLAGS) bench .PHONY: bench Ha, that's almost exactly what I ended up writing. If you have several of those nonstandard targets you need to forward, you may want to copy the (slightly more involved) way automake handles recursive targets. Hope that helps. Cheers, Ralf Thanks a lot, -- Tavian Barnes
Re: Create a custom target
* Tavian Barnes wrote on Mon, Jul 07, 2008 at 03:39:07PM CEST: On Sun, Jul 6, 2008 at 11:25 PM, Ralf Wildenhues wrote: EXTRA_PROGRAMS = prog prog_SOURCES = ... bench: prog$(EXEEXT) execute prog$(EXEEXT)... .PHONY: bench This works great, thanks. What does .PHONY do? Tell 'make' that the 'bench' target is not a file but some action that should be taken, even if a file named 'bench' should happen to exist and have a new time stamp. '.PHONY' is a feature of 'make' and has no specific connection with automake; the GNU make manual documents it: http://www.gnu.org/software/make/manual/html_node/Phony-Targets.html. Cheers, Ralf
Create a custom target
Hi, guys. I have a question: how do I create a custom target, and selectively compile some code, and run the compiled executable, when this target is chosen? Specifically, I have a benchmarking suite for a library I wrote, and I want to compile the code in the bench/ directory, and run the executable, when the user types 'make bench'. I tried looking this up in the manual, but couldn't find it; sorry if I missed something obvious. -- Tavian Barnes
Re: Create a custom target
Hello Tavian, * Tavian Barnes wrote on Sun, Jul 06, 2008 at 07:28:30AM CEST: Hi, guys. I have a question: how do I create a custom target, and selectively compile some code, and run the compiled executable, when this target is chosen? Specifically, I have a benchmarking suite for a library I wrote, and I want to compile the code in the bench/ directory, and run the executable, when the user types 'make bench'. I tried looking this up in the manual, but couldn't find it; sorry if I missed something obvious. Most of the Makefile.am text is copied verbatim into the Makefile.in (and from there into the Makefile). So if you want to add custom targets, just write plain make rules: bench: prerequisites... ... compile ... .PHONY: bench Cheers, Ralf
Re: Create a custom target
Okay, but how do I then get automake to handle the compilation? I don't want to type in the compilation commands myself; that's what automake is for. If I add the benchmarking program to noinst_PROGRAMS, it compiles when 'make' is run, rather than only when 'make bench' is run. Also, when I wrote a custom target in bench/Makefile.am, the root makefile didn't seem to notice, and running make bench from the root of the project simply gave make: Nothing to be done for `bench'. On Sun, Jul 6, 2008 at 1:59 AM, Ralf Wildenhues [EMAIL PROTECTED] wrote: Hello Tavian, * Tavian Barnes wrote on Sun, Jul 06, 2008 at 07:28:30AM CEST: Hi, guys. I have a question: how do I create a custom target, and selectively compile some code, and run the compiled executable, when this target is chosen? Specifically, I have a benchmarking suite for a library I wrote, and I want to compile the code in the bench/ directory, and run the executable, when the user types 'make bench'. I tried looking this up in the manual, but couldn't find it; sorry if I missed something obvious. Most of the Makefile.am text is copied verbatim into the Makefile.in (and from there into the Makefile). So if you want to add custom targets, just write plain make rules: bench: prerequisites... ... compile ... .PHONY: bench Cheers, Ralf -- Tavian Barnes
Re: Create a custom target
Hello Tavian, please don't top-post, thank you. * Tavian Barnes wrote on Sun, Jul 06, 2008 at 07:45:23PM CEST: On Sun, Jul 6, 2008 at 1:59 AM, Ralf Wildenhues [EMAIL PROTECTED] wrote: Most of the Makefile.am text is copied verbatim into the Makefile.in (and from there into the Makefile). So if you want to add custom targets, just write plain make rules: bench: prerequisites... ... compile ... .PHONY: bench Okay, but how do I then get automake to handle the compilation? I don't want to type in the compilation commands myself; that's what automake is for. If I add the benchmarking program to noinst_PROGRAMS, it compiles when 'make' is run, rather than only when 'make bench' is run. Ah, ok. Then you can use something like: EXTRA_PROGRAMS = prog prog_SOURCES = ... bench: prog$(EXEEXT) execute prog$(EXEEXT)... .PHONY: bench Also, when I wrote a custom target in bench/Makefile.am, the root makefile didn't seem to notice, and running make bench from the root of the project simply gave make: Nothing to be done for `bench'. Either you look into nonrecursive Makefiles, or you will have to write a forwarding target, e.g.: bench: cd bench $(MAKE) $(AM_MAKEFLAGS) bench .PHONY: bench If you have several of those nonstandard targets you need to forward, you may want to copy the (slightly more involved) way automake handles recursive targets. Hope that helps. Cheers, Ralf