 |
|
 |
|
Next: [News] Video Demo of Fedora 11, Features Roundup
|
| Author |
Message |
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 |
|
 |  |
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 |
|
 |  |
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 |
|
 |  |
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 |
|
 |  |
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 |
|
 |  |
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 |
|
 |  |
|
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
|
|
|
|
 |
|
|