Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

GNU autotools - custom target and installed programs

 
   Soft32 Home -> Linux -> App Development RSS
Next:  [News] Video Demo of Fedora 11, Features Roundup  
Author Message
Nick Birnie

External


Since: Jun 13, 2009
Posts: 4



(Msg. 1) Posted: Sat Jun 13, 2009 5:20 am
Post subject: GNU autotools - custom target and installed programs
Archived from groups: comp>os>linux>development>apps (more info?)

Hi there,

I have a small project that is configured and compiled with autotools.

I want to generate a custom make target to builds a special
configuration such that it can be run: make <custom-target>. As I
understand automake, this can be done by adding a set of
<custom-target>_PROGRAMS, <custom-target>_SOURCES etc. to my
Makefile.am's as well as a phony target <custom-target> which depends on
one of the <custom-target>_PROGRAM. So having done that, it works very
well and make happily builds my custom configuration. However it is also
being called by the default 'all' target which is not ideal.
Furthermore, the 'install' target installs the custom configuration
which is also undesirable.

Does anybody here know how I can prevent this behaviour by automake?

Thanks,

Nick
Back to top
Login to vote
William Pursell

External


Since: Jan 05, 2009
Posts: 9



(Msg. 2) Posted: Sat Jun 13, 2009 5:20 am
Post subject: Re: GNU autotools - custom target and installed programs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Nick Birnie <nick.birnie+use...@gmail.com> wrote:

> I want to generate a custom make target to builds a special
> configuration such that it can be run: make <custom-target>. As I
> understand automake, this can be done by adding a set of
> <custom-target>_PROGRAMS, <custom-target>_SOURCES etc. to my
> Makefile.am's as well as a phony target <custom-target> which depends on
> one of the <custom-target>_PROGRAM. So having done that, it works very
> well and make happily builds my custom configuration. However it is also
> being called by the default 'all' target which is not ideal.
> Furthermore, the 'install' target installs the custom configuration
> which is also undesirable.
>
> Does anybody here know how I can prevent this behaviour by automake?

If you just want a simple rule in the makefile, put it directly in
Makefile.am
as you want it to appear in the resulting Makefile. eg:

foo: bar baz
touch foo

will touch foo if foo is older than bar or baz only when you invoke
'make foo'
or any rule that lists foo as a dependency. The whole point of the
_PROGRAMS
primary is to add the target to the rules for all, install, etc. so if
you don't
want that behavior then just don't use the automake primaries.
Back to top
Login to vote
Nick Birnie

External


Since: Jun 13, 2009
Posts: 4



(Msg. 3) Posted: Sat Jun 13, 2009 7:20 am
Post subject: Re: GNU autotools - custom target and installed programs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 06/13/2009 09:42 AM, William Pursell wrote:
> Nick Birnie<nick.birnie+use...@gmail.com> wrote:
>
>> I want to generate a custom make target to builds a special
>> configuration such that it can be run: make<custom-target>. As I
>> understand automake, this can be done by adding a set of
>> <custom-target>_PROGRAMS,<custom-target>_SOURCES etc. to my
>> Makefile.am's as well as a phony target<custom-target> which
>> depends on one of the<custom-target>_PROGRAM. So having done that,
>> it works very well and make happily builds my custom
>> configuration. However it is also being called by the default 'all'
>> target which is not ideal. Furthermore, the 'install' target
>> installs the custom configuration which is also undesirable.
>>
>> Does anybody here know how I can prevent this behaviour by
>> automake?
>
> If you just want a simple rule in the makefile, put it directly in
> Makefile.am as you want it to appear in the resulting Makefile. eg:
>
> foo: bar baz touch foo
>
> will touch foo if foo is older than bar or baz only when you invoke
> 'make foo' or any rule that lists foo as a dependency. The whole
> point of the _PROGRAMS primary is to add the target to the rules for
> all, install, etc. so if you don't want that behavior then just
> don't use the automake primaries.

Not really a solution though, because I'd need to write all the targets
manually, so defeating the purpose of using automake in the first place.

Some reading at the automake/autoconf doumentation later, there is a
prefix, 'noinst_' that inhibits adding automake '_PROGRAMS' or
'_LIBRARIES' targets to the install-am target. Used as below works
perfectly for my application.

noinst_PROGRAMS = <special-config>

However I still don't want this configuration being built by the default
target, effectively doubling the compilation time. Any ideas?

Thanks,

Nick
Back to top
Login to vote
William Pursell

External


Since: Jan 05, 2009
Posts: 9



(Msg. 4) Posted: Sat Jun 13, 2009 7:03 pm
Post subject: Re: GNU autotools - custom target and installed programs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 13 June, 11:36, Nick Birnie <nick.birnie+use...@gmail.com> wrote:
> On 06/13/2009 09:42 AM, William Pursell wrote:
>
>
>
> > Nick Birnie<nick.birnie+use...@gmail.com>  wrote:
>
> >> I want to generate a custom make target to builds a special
> >> configuration such that it can be run: make<custom-target>. As I
> >> understand automake, this can be done by adding a set of
> >> <custom-target>_PROGRAMS,<custom-target>_SOURCES etc. to my
> >> Makefile.am's as well as a phony target<custom-target>  which
> >> depends on one of the<custom-target>_PROGRAM. So having done that,
> >> it works very well and make happily builds my custom
> >> configuration. However it is also being called by the default 'all'
> >> target which is not ideal. Furthermore, the 'install' target
> >> installs the custom configuration which is also undesirable.
>
> >> Does anybody here know how I can prevent this behaviour by
> >> automake?
>
> > If you just want a simple rule in the makefile, put it directly in
> > Makefile.am as you want it to appear in the resulting Makefile.  eg:
>
> > foo: bar baz touch foo
>
> > will touch foo if foo is older than bar or baz only when you invoke
> > 'make foo' or any rule that lists foo as a dependency.  The whole
> > point of the _PROGRAMS primary is to add the target to the rules for
> > all, install, etc. so if you don't want that behavior then just
> > don't use the automake primaries.
>
> Not really a solution though, because I'd need to write all the targets
> manually, so defeating the purpose of using automake in the first place.
>
> Some reading at the automake/autoconf doumentation later, there is a
> prefix, 'noinst_' that inhibits adding automake '_PROGRAMS' or
> '_LIBRARIES' targets to the install-am target. Used as below works
> perfectly for my application.
>
> noinst_PROGRAMS = <special-config>
>
> However I still don't want this configuration being built by the default
> target, effectively doubling the compilation time. Any ideas?

You might be happy using check_PROGRAMS. It's not
really intended for what you are describing, but will
probably do what you want. (The program will only
be built with 'make check' or 'make <special-config>')
Back to top
Login to vote
Nick Birnie

External


Since: Jun 13, 2009
Posts: 4



(Msg. 5) Posted: Sat Jun 13, 2009 11:20 pm
Post subject: Re: GNU autotools - custom target and installed programs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 06/14/2009 03:03 AM, William Pursell wrote:
> On 13 June, 11:36, Nick Birnie<nick.birnie+use...@gmail.com> wrote:
>> On 06/13/2009 09:42 AM, William Pursell wrote:
>>
>>
>>
>>> Nick Birnie<nick.birnie+use...@gmail.com> wrote:
>>>> I want to generate a custom make target to builds a special
>>>> configuration such that it can be run: make<custom-target>. As
>>>> I understand automake, this can be done by adding a set of
>>>> <custom-target>_PROGRAMS,<custom-target>_SOURCES etc. to my
>>>> Makefile.am's as well as a phony target<custom-target> which
>>>> depends on one of the<custom-target>_PROGRAM. So having done
>>>> that, it works very well and make happily builds my custom
>>>> configuration. However it is also being called by the default
>>>> 'all' target which is not ideal. Furthermore, the 'install'
>>>> target installs the custom configuration which is also
>>>> undesirable. Does anybody here know how I can prevent this
>>>> behaviour by automake?
>>> If you just want a simple rule in the makefile, put it directly
>>> in Makefile.am as you want it to appear in the resulting
>>> Makefile. eg: foo: bar baz touch foo will touch foo if foo is
>>> older than bar or baz only when you invoke 'make foo' or any rule
>>> that lists foo as a dependency. The whole point of the _PROGRAMS
>>> primary is to add the target to the rules for all, install, etc.
>>> so if you don't want that behavior then just don't use the
>>> automake primaries.
>> Not really a solution though, because I'd need to write all the
>> targets manually, so defeating the purpose of using automake in the
>> first place.
>>
>> Some reading at the automake/autoconf doumentation later, there is
>> a prefix, 'noinst_' that inhibits adding automake '_PROGRAMS' or
>> '_LIBRARIES' targets to the install-am target. Used as below works
>> perfectly for my application.
>>
>> noinst_PROGRAMS =<special-config>
>>
>> However I still don't want this configuration being built by the
>> default target, effectively doubling the compilation time. Any
>> ideas?
>
> You might be happy using check_PROGRAMS. It's not really intended
> for what you are describing, but will probably do what you want.
> (The program will only be built with 'make check' or
> 'make<special-config>')
>

Great idea, thanks!

check_PROGRAMS is actually well suited for this build
configuration compared to noinst_PROGRAMS (which is intended for
building intermediate artefacts such as static libraries.) The
configuration I was trying to build enables CFLAGS such as debugging
symbols and verbose network protocol decodes anyway, so it's quite
suitable for check_PROGRAMS. Besides unit tests are useless when you
have grep!
Back to top
Login to vote
William Pursell

External


Since: Jan 05, 2009
Posts: 9



(Msg. 6) Posted: Sun Jun 14, 2009 6:47 am
Post subject: Re: GNU autotools - custom target and installed programs [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 14 June, 03:35, Nick Birnie <nick.birnie+use...@gmail.com> wrote:
> On 06/14/2009 03:03 AM, William Pursell wrote:
>
>
>
> > On 13 June, 11:36, Nick Birnie<nick.birnie+use...@gmail.com>  wrote:
> >> On 06/13/2009 09:42 AM, William Pursell wrote:
>
> >>> Nick Birnie<nick.birnie+use...@gmail.com>    wrote:
> >>>> I want to generate a custom make target to builds a special
> >>>> configuration such that it can be run: make<custom-target>. As
> >>>>  I understand automake, this can be done by adding a set of
> >>>> <custom-target>_PROGRAMS,<custom-target>_SOURCES etc. to my
> >>>> Makefile.am's as well as a phony target<custom-target> which
> >>>> depends on one of the<custom-target>_PROGRAM. So having done
> >>>> that, it works very well and make happily builds my custom
> >>>> configuration. However it is also being called by the default
> >>>> 'all' target which is not ideal. Furthermore, the 'install'
> >>>> target installs the custom configuration which is also
> >>>> undesirable. Does anybody here know how I can prevent this
> >>>> behaviour by automake?
> >>> If you just want a simple rule in the makefile, put it directly
> >>> in Makefile.am as you want it to appear in the resulting
> >>> Makefile.  eg: foo: bar baz touch foo will touch foo if foo is
> >>> older than bar or baz only when you invoke 'make foo' or any rule
> >>> that lists foo as a dependency.  The whole point of the _PROGRAMS
> >>> primary is to add the target to the rules for all, install, etc.
> >>> so if you don't want that behavior then just don't use the
> >>> automake primaries.
> >> Not really a solution though, because I'd need to write all the
> >> targets manually, so defeating the purpose of using automake in the
> >> first place.
>
> >> Some reading at the automake/autoconf doumentation later, there is
> >>  a prefix, 'noinst_' that inhibits adding automake '_PROGRAMS' or
> >> '_LIBRARIES' targets to the install-am target. Used as below works
> >> perfectly for my application.
>
> >> noinst_PROGRAMS =<special-config>
>
> >> However I still don't want this configuration being built by the
> >> default target, effectively doubling the compilation time. Any
> >> ideas?
>
> > You might be happy using check_PROGRAMS.  It's not really intended
> > for what you are describing, but will probably do what you want.
> > (The program will only be built with 'make check' or
> > 'make<special-config>')
>
> Great idea, thanks!
>
> check_PROGRAMS is actually well suited for this build
> configuration compared to noinst_PROGRAMS (which is intended for
> building intermediate artefacts such as static libraries.) The
> configuration I was trying to build enables CFLAGS such as debugging
> symbols and verbose network protocol decodes anyway, so it's quite
> suitable for check_PROGRAMS. Besides unit tests are useless when you
> have grep!

It sounds like you'd be happier keeping two separate build
directories, one configured with -pg etc, the other without.
Strongly disagree about the utility of unit tests.
Back to top
Login to vote
Display posts from previous:   
Related Topics:
storing the data in ln2440 target board memory - hai.. i using the target board ln2440sbc..and linux OS.. (16Mb flash and 32Mb sdram) i have cross compiled and porte...

How can i register a link protocol for browsers - I want to add an action to the system so that every time a user clicks in a link with for example ..

GTK run error - hi i had created one same application in glad interface designer with c option.the n i compiled the same after that i....

C++ -> mplayer, stdin, stdout, popen / fork / pipe... - Hello everybody. I tried to work this out on my own for about 6 hours non-stop now and I just don't get it working.......

autotools: so many versions installed - Hello, I am running Fedora Core 2 Linux. I am curious as to how come there would be so many versions of the autotools....

[gentoo-user] syslog-ng + automatic respawn of target prog.. - Hi folks, could anyone give me a quick hint how to tell syslog-ng to automatically respawn target programs if they di...
       Soft32 Home -> Linux -> App Development All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]