Makefile: pass `LDFLAGS` to compiler

Message ID 1292175098.13905.58.camel@mattotaupa
State New
Headers

Commit Message

Paul Menzel Dec. 12, 2010, 5:31 p.m. UTC
  Dear Jörg,


Am Samstag, den 25.09.2010, 13:15 +0200 schrieb Joerg Bornkessel:

[…]

> we have an open bug [1] to all versions of VDR  on gentoo
> 
> we changed any weeks befor our default profiles to use LDFLAGS
> on compile prozesses.
> 
> <snipp news-info about this from 2010-08-01>
> 
>        -Wl,--as-needed has been added to the default profile's LDFLAGS.
> 
>        This option optimizes the linking process, only linking binaries to
>        libraries that are trully needed. This way, fewer libraries are loaded
>        at runtime and fewer packages need to be rebuilt after library updates.
> 
> </snap>
> 
> For more information on --as-needed, read [2].
> 
> Plz. let us check is it possible to add a fix generally to the
> Makefile to respect the LDFLAGS or should i fixed always localy on
> gentoo Disti.
> 
> fixed should it be in this part of Makefile
> 
> -# The main program:
> -
> -vdr: $(OBJS) $(SILIB)
> -    $(CXX) $(CXXFLAGS) -rdynamic $(OBJS) $(LIBS) $(LIBDIRS) $(SILIB) -o vdr
> 
> +# The main program:
> +
> +vdr: $(OBJS) $(SILIB)
> +    $(CXX) $(CXXFLAGS) -rdynamic $(LDFLAGS) $(OBJS) $(LIBS) $(LIBDIRS) $(SILIB) -o vdr
> 
>
> [1] http://bugs.gentoo.org/show_bug.cgi?id=333493
> [2] http://www.gentoo.org/proj/en/qa/asneeded.xml

Should `LDFLAGS` also be passed to the compiler when building the
plugins?

I made a patch from your message which does not include any changes to
the plugins.


Thanks,

Paul

8<-------------------------------------------------------------------->8
Date: Sun, 12 Dec 2010 18:19:42 +0100

Some distributions pass special flags to the linker [1][2]. Respect those by using `LDFLAGS`.

[1] http://cgit.openembedded.org/cgit.cgi/openembedded/tree/recipes/vdr/vdr-1.7.10/linkerflags.patch
[2] http://www.linuxtv.org/pipermail/vdr/2010-September/023623.html

Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
---
 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
  

Comments

Joerg Bornkessel Dec. 12, 2010, 11:29 p.m. UTC | #1
> Dear Jörg,


> Am Samstag, den 25.09.2010, 13:15 +0200 schrieb Joerg Bornkessel:

> […]


>> [2] http://www.gentoo.org/proj/en/qa/asneeded.xml

> Should `LDFLAGS` also be passed to the compiler when building the
> plugins?

We have this fixed global on Gentoo for all plugins.
All plugin Makefile's are sed'ed/patched to use the LDFLAGS.

> I made a patch from your message which does not include any changes to
> the plugins.


I dont know, what distri you use,
one way would be to fix this in the make.global ( used up from
vdr-1.7.(not shure yet)) and inherit this in the plugin Makefile.

Should be standard in the vdr-1.7.x adapted plugin Makefiles
  
Paul Menzel Dec. 13, 2010, 10:29 a.m. UTC | #2
Am Montag, den 13.12.2010, 00:29 +0100 schrieb Joerg Bornkessel:

> > Am Samstag, den 25.09.2010, 13:15 +0200 schrieb Joerg Bornkessel:
> 
> > […]
> 
> 
> >> [2] http://www.gentoo.org/proj/en/qa/asneeded.xml
> 
> > Should `LDFLAGS` also be passed to the compiler when building the
> > plugins?
> 
> We have this fixed global on Gentoo for all plugins.
> All plugin Makefile's are sed'ed/patched to use the LDFLAGS.

Sorry, I do not know Gentoo’s build system. I found the patch for VDR
[1] and the ebuild file [2].

I was wondering why skincurses had no patch applied or change regarding
`LDFLAGS` [3] and for example vdr-burn [4] has a separate patch. Then I
found `vdr-plugin.eclass` [5] where the replacement is done using `sed`.

> > I made a patch from your message which does not include any changes to
> > the plugins.
>
> I dont know, what distri you use,

I am using the OpenEmbedded framework [6].

> one way would be to fix this in the make.global ( used up from
> vdr-1.7.(not shure yet)) and inherit this in the plugin Makefile.
> 
> Should be standard in the vdr-1.7.x adapted plugin Makefiles

That is what my patch is for. I will send an updated patch.


Thanks,

Paul


[1] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-video/vdr/files/vdr-1.6.0-ldflags.patch?view=markup
[2] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-video/vdr/vdr-1.6.0_p2-r5.ebuild?view=markup
[3] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-plugins/vdr-skincurses/ChangeLog?view=markup
[4] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-plugins/vdr-burn/files/vdr-burn-0.2.0_beta1_ldflags.diff?revision=1.1&view=markup
[5] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/vdr-plugin.eclass?view=markup
[6] http://www.openembedded.org/
  
Paul Menzel Dec. 13, 2010, 10:56 a.m. UTC | #3
Am Montag, den 13.12.2010, 11:29 +0100 schrieb Paul Menzel:
> Am Montag, den 13.12.2010, 00:29 +0100 schrieb Joerg Bornkessel:
> 
> > > Am Samstag, den 25.09.2010, 13:15 +0200 schrieb Joerg Bornkessel:
> > 
> > > […]
> > 
> > 
> > >> [2] http://www.gentoo.org/proj/en/qa/asneeded.xml
> > 
> > > Should `LDFLAGS` also be passed to the compiler when building the
> > > plugins?
> > 
> > We have this fixed global on Gentoo for all plugins.
> > All plugin Makefile's are sed'ed/patched to use the LDFLAGS.
> 
> Sorry, I do not know Gentoo’s build system. I found the patch for VDR
> [1] and the ebuild file [2].
> 
> I was wondering why skincurses had no patch applied or change regarding
> `LDFLAGS` [3] and for example vdr-burn [4] has a separate patch. Then I
> found `vdr-plugin.eclass` [5] where the replacement is done using `sed`.
> 
> > > I made a patch from your message which does not include any changes to
> > > the plugins.
> >
> > I dont know, what distri you use,
> 
> I am using the OpenEmbedded framework [6].
> 
> > one way would be to fix this in the make.global ( used up from
> > vdr-1.7.(not shure yet)) and inherit this in the plugin Makefile.
> > 
> > Should be standard in the vdr-1.7.x adapted plugin Makefiles
> 
> That is what my patch is for. I will send an updated patch.

One question left. Why does not `LDFLAGS` need to be passed in the
implicit rules?

        ### Implicit rules:
        
        %.o: %.c
        	$(CXX) $(CXXFLAGS) $(LDFLAGS) -c $(DEFINES) $(INCLUDES) $<


Thanks,

Paul


> [1] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-video/vdr/files/vdr-1.6.0-ldflags.patch?view=markup
> [2] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-video/vdr/vdr-1.6.0_p2-r5.ebuild?view=markup
> [3] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-plugins/vdr-skincurses/ChangeLog?view=markup
> [4] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-plugins/vdr-burn/files/vdr-burn-0.2.0_beta1_ldflags.diff?revision=1.1&view=markup
> [5] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/vdr-plugin.eclass?view=markup
> [6] http://www.openembedded.org/
  
Joerg Bornkessel Dec. 13, 2010, 10:03 p.m. UTC | #4
> Am Montag, den 13.12.2010, 00:29 +0100 schrieb Joerg Bornkessel:

>> > Am Samstag, den 25.09.2010, 13:15 +0200 schrieb Joerg Bornkessel:

> I was wondering why skincurses had no patch applied or change regarding
> `LDFLAGS` [3] and for example vdr-burn [4] has a separate patch. Then I
> found `vdr-plugin.eclass` [5] where the replacement is done using `sed`.

some plugins (just a handfull) create beside on the plugin lib a helper lib or bin.
to fix the makefile in this part will not fixed by the vdr-plugin.eclass.
See this depended bug for vdr-burn

http://bugs.gentoo.org/show_bug.cgi?id=339328
http://bugs.gentoo.org/attachment.cgi?id=249154


> I am using the OpenEmbedded framework [6].

hmm, sounds interresting,
On what Hardware will this run, then?

>> one way would be to fix this in the make.global ( used up from
>> vdr-1.7.(not shure yet)) and inherit this in the plugin Makefile.
>> 
>> Should be standard in the vdr-1.7.x adapted plugin Makefiles

> That is what my patch is for. I will send an updated patch.


> Thanks,

> Paul


> [1]
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-video/vdr/files/vdr-1.6.0-ldflags.patch?view=markup
> [2]
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-video/vdr/vdr-1.6.0_p2-r5.ebuild?view=markup
> [3]
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-plugins/vdr-skincurses/ChangeLog?view=markup
> [4]
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/media-plugins/vdr-burn/files/vdr-burn-0.2.0_beta1_ldflags.diff?revision=1.1&view=markup
> [5]
> http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/vdr-plugin.eclass?view=markup
> [6] http://www.openembedded.org/
  
Joerg Bornkessel Dec. 13, 2010, 10:12 p.m. UTC | #5
> Am Montag, den 13.12.2010, 11:29 +0100 schrieb Paul Menzel:
>> Am Montag, den 13.12.2010, 00:29 +0100 schrieb Joerg Bornkessel:
>> 
>> > > Am Samstag, den 25.09.2010, 13:15 +0200 schrieb Joerg Bornkessel:
>> > 
>> > > […]
>> > 
>> > 
>> > >> [2] http://www.gentoo.org/proj/en/qa/asneeded.xml
>> > 
>> > > Should `LDFLAGS` also be passed to the compiler when building the
>> > > plugins?
>> > 
>> > We have this fixed global on Gentoo for all plugins.
>> > All plugin Makefile's are sed'ed/patched to use the LDFLAGS.
>> 
>> Sorry, I do not know Gentoo’s build system. I found the patch for VDR
>> [1] and the ebuild file [2].
>> 
>> I was wondering why skincurses had no patch applied or change regarding
>> `LDFLAGS` [3] and for example vdr-burn [4] has a separate patch. Then I
>> found `vdr-plugin.eclass` [5] where the replacement is done using `sed`.
>> 
>> > > I made a patch from your message which does not include any changes to
>> > > the plugins.
>> >
>> > I dont know, what distri you use,
>> 
>> I am using the OpenEmbedded framework [6].
>> 
>> > one way would be to fix this in the make.global ( used up from
>> > vdr-1.7.(not shure yet)) and inherit this in the plugin Makefile.
>> > 
>> > Should be standard in the vdr-1.7.x adapted plugin Makefiles
>> 
>> That is what my patch is for. I will send an updated patch.

> One question left. Why does not `LDFLAGS` need to be passed in the
> implicit rules?

>         ### Implicit rules:
>         
>         %.o: %.c
>                 $(CXX) $(CXXFLAGS) $(LDFLAGS) -c $(DEFINES) $(INCLUDES) $<

In this part will only create/compiled the object files, $(OBJS),
files with .o extension.
It is not needed to link here against LDFLAGS,
Linked will only the final lib
  
Paul Menzel Dec. 13, 2010, 10:34 p.m. UTC | #6
Am Montag, den 13.12.2010, 23:03 +0100 schrieb Joerg Bornkessel:
> > Am Montag, den 13.12.2010, 00:29 +0100 schrieb Joerg Bornkessel:
> 
> >> > Am Samstag, den 25.09.2010, 13:15 +0200 schrieb Joerg Bornkessel:
> 
> > I was wondering why skincurses had no patch applied or change regarding
> > `LDFLAGS` [3] and for example vdr-burn [4] has a separate patch. Then I
> > found `vdr-plugin.eclass` [5] where the replacement is done using `sed`.
> 
> some plugins (just a handfull) create beside on the plugin lib a helper lib or bin.
> to fix the makefile in this part will not fixed by the vdr-plugin.eclass.
> See this depended bug for vdr-burn
> 
> http://bugs.gentoo.org/show_bug.cgi?id=339328
> http://bugs.gentoo.org/attachment.cgi?id=249154

Thanks, actually I read that ticket before sending my message. It is
great that you confirmed my guess. Could you reply to my »PATCH v2« if
you have time please so that Klaus knows it is ready to be committed.

> > I am using the OpenEmbedded framework [6].
> 
> hmm, sounds interresting,
> On what Hardware will this run, then?

I am planning on using the BeagleBoard [8] which is ARM Cortex A8 based.

T. Brinkmann is working on getting VDR to run on the BeagleBoard too
[9], but there are some problems to use it as the output device.


Thanks,

Paul


[7] http://www.vdr-wiki.de/wiki/index.php/Ångström
[8] http://beagleboard.org/
[9] http://groups.google.com/group/beagleboard/msg/1b3fabd83fa9190e
  

Patch

diff --git a/Makefile b/Makefile
index cca4d55..e12e2b2 100644
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,7 @@  $(DEPFILE): Makefile
 # The main program:
 
 vdr: $(OBJS) $(SILIB)
-	$(CXX) $(CXXFLAGS) -rdynamic $(OBJS) $(LIBS) $(LIBDIRS) $(SILIB) -o vdr
+	$(CXX) $(CXXFLAGS) -rdynamic $(LDFLAGS) $(OBJS) $(LIBS) $(LIBDIRS) $(SILIB) -o vdr
 
 # The libsi library: