Re: [PATCH v3] Makefile: pass `LDFLAGS` to compiler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Date: Sun, 12 Dec 2010 18:19:42 +0100

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

Instead of [1] this patch was made using the following command based on `vdr-plugin.eclass` [3].

	find PLUGINS -name Makefile | xargs sed -i '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'

Additionally the main Makefile and the script `newplugin` are changed too.

The changes have been present in OpenEmbedded and Gentoo for a while already and can be assumend tested.

The implicit rules are not changed. This could been done easily using the following command.

	$ find PLUGINS -name Makefile | xargs sed -i 's/$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $</$(CXX) $(CXXFLAGS) $(LDFLAGS) -c $(DEFINES) $(INCLUDES) $</'

[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
[3] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/vdr-plugin.eclass?view=markup (code line 232)

Signed-off-by: Paul Menzel <paulepanter@xxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Joerg Bornkessel <ml@xxxxxxxxxxx>
---
v2 â v3: Change script `newplugin`. Patch submitted by Joerg [4].

[4] http://www.linuxtv.org/pipermail/vdr/2010-December/024068.html
---
 Makefile                         |    2 +-
 PLUGINS/src/dvbsddevice/Makefile |    2 +-
 PLUGINS/src/hello/Makefile       |    2 +-
 PLUGINS/src/osddemo/Makefile     |    2 +-
 PLUGINS/src/pictures/Makefile    |    2 +-
 PLUGINS/src/servicedemo/Makefile |    4 ++--
 PLUGINS/src/skincurses/Makefile  |    2 +-
 PLUGINS/src/status/Makefile      |    2 +-
 PLUGINS/src/svdrpdemo/Makefile   |    2 +-
 newplugin                        |    2 +-
 10 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 26f54ea..48e3309 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:
 
diff --git a/PLUGINS/src/dvbsddevice/Makefile b/PLUGINS/src/dvbsddevice/Makefile
index 32d0f50..afc801b 100644
--- a/PLUGINS/src/dvbsddevice/Makefile
+++ b/PLUGINS/src/dvbsddevice/Makefile
@@ -99,7 +99,7 @@ i18n: $(I18Nmsgs) $(I18Npot)
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/hello/Makefile b/PLUGINS/src/hello/Makefile
index a5703f6..9e51cf7 100644
--- a/PLUGINS/src/hello/Makefile
+++ b/PLUGINS/src/hello/Makefile
@@ -99,7 +99,7 @@ i18n: $(I18Nmsgs)
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/osddemo/Makefile b/PLUGINS/src/osddemo/Makefile
index d9ed4c5..eb98160 100644
--- a/PLUGINS/src/osddemo/Makefile
+++ b/PLUGINS/src/osddemo/Makefile
@@ -72,7 +72,7 @@ $(DEPFILE): Makefile
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/pictures/Makefile b/PLUGINS/src/pictures/Makefile
index 19c6fc6..a573363 100644
--- a/PLUGINS/src/pictures/Makefile
+++ b/PLUGINS/src/pictures/Makefile
@@ -99,7 +99,7 @@ i18n: $(I18Nmsgs) $(I18Npot)
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/servicedemo/Makefile b/PLUGINS/src/servicedemo/Makefile
index 18bfd26..8cba989 100644
--- a/PLUGINS/src/servicedemo/Makefile
+++ b/PLUGINS/src/servicedemo/Makefile
@@ -74,11 +74,11 @@ $(DEPFILE): Makefile
 ### Targets:
 
 libvdr-$(PLUGIN1).so: $(PLUGIN1).o
-	$(CXX) $(CXXFLAGS) -shared $(PLUGIN1).o -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGIN1).o -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 libvdr-$(PLUGIN2).so: $(PLUGIN2).o
-	$(CXX) $(CXXFLAGS) -shared $(PLUGIN2).o -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGIN2).o -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/skincurses/Makefile b/PLUGINS/src/skincurses/Makefile
index 080c3e6..e1e3ae6 100644
--- a/PLUGINS/src/skincurses/Makefile
+++ b/PLUGINS/src/skincurses/Makefile
@@ -99,7 +99,7 @@ i18n: $(I18Nmsgs) $(I18Npot)
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -lncursesw -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -lncursesw -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/status/Makefile b/PLUGINS/src/status/Makefile
index 556a09e..fa59016 100644
--- a/PLUGINS/src/status/Makefile
+++ b/PLUGINS/src/status/Makefile
@@ -72,7 +72,7 @@ $(DEPFILE): Makefile
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/svdrpdemo/Makefile b/PLUGINS/src/svdrpdemo/Makefile
index 4a803c6..1101634 100644
--- a/PLUGINS/src/svdrpdemo/Makefile
+++ b/PLUGINS/src/svdrpdemo/Makefile
@@ -72,7 +72,7 @@ $(DEPFILE): Makefile
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/newplugin b/newplugin
index ffc43d3..0c498f0 100755
--- a/newplugin
+++ b/newplugin
@@ -158,7 +158,7 @@ i18n: \$(I18Nmsgs) \$(I18Npot)
 ### Targets:
 
 libvdr-\$(PLUGIN).so: \$(OBJS)
-	\$(CXX) \$(CXXFLAGS) -shared \$(OBJS) -o \$\@
+	\$(CXX) \$(CXXFLAGS) \$(LDFLAGS) -shared \$(OBJS) -o \$\@
 	\@cp --remove-destination \$\@ \$(LIBDIR)/\$\@.\$(APIVERSION)
 
 dist: clean
-- 
1.7.2.3
From 774e9db004fcef15c34871b0cab60dd04078e6d4 Mon Sep 17 00:00:00 2001
From: Paul Menzel <paulepanter@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 12 Dec 2010 18:19:42 +0100
Subject: [PATCH] Makefile: pass `LDFLAGS` to compiler

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

Instead of [1] this patch was made using the following command based on `vdr-plugin.eclass` [3].

	find PLUGINS -name Makefile | xargs sed -i '/LDFLAGS/!s:-shared:$(LDFLAGS) -shared:'

Additionally the main Makefile and the script `newplugin` are changed too.

The changes have been present in OpenEmbedded and Gentoo for a while already and can be assumend tested.

The implicit rules are not changed. This could been done easily using the following command.

	$ find PLUGINS -name Makefile | xargs sed -i 's/$(CXX) $(CXXFLAGS) -c $(DEFINES) $(INCLUDES) $</$(CXX) $(CXXFLAGS) $(LDFLAGS) -c $(DEFINES) $(INCLUDES) $</'

[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
[3] http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/vdr-plugin.eclass?view=markup (code line 232)

Signed-off-by: Paul Menzel <paulepanter@xxxxxxxxxxxxxxxxxxxxx>
---
 Makefile                         |    2 +-
 PLUGINS/src/dvbsddevice/Makefile |    2 +-
 PLUGINS/src/hello/Makefile       |    2 +-
 PLUGINS/src/osddemo/Makefile     |    2 +-
 PLUGINS/src/pictures/Makefile    |    2 +-
 PLUGINS/src/servicedemo/Makefile |    4 ++--
 PLUGINS/src/skincurses/Makefile  |    2 +-
 PLUGINS/src/status/Makefile      |    2 +-
 PLUGINS/src/svdrpdemo/Makefile   |    2 +-
 newplugin                        |    2 +-
 10 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Makefile b/Makefile
index 26f54ea..48e3309 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:
 
diff --git a/PLUGINS/src/dvbsddevice/Makefile b/PLUGINS/src/dvbsddevice/Makefile
index 32d0f50..afc801b 100644
--- a/PLUGINS/src/dvbsddevice/Makefile
+++ b/PLUGINS/src/dvbsddevice/Makefile
@@ -99,7 +99,7 @@ i18n: $(I18Nmsgs) $(I18Npot)
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/hello/Makefile b/PLUGINS/src/hello/Makefile
index a5703f6..9e51cf7 100644
--- a/PLUGINS/src/hello/Makefile
+++ b/PLUGINS/src/hello/Makefile
@@ -99,7 +99,7 @@ i18n: $(I18Nmsgs)
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/osddemo/Makefile b/PLUGINS/src/osddemo/Makefile
index d9ed4c5..eb98160 100644
--- a/PLUGINS/src/osddemo/Makefile
+++ b/PLUGINS/src/osddemo/Makefile
@@ -72,7 +72,7 @@ $(DEPFILE): Makefile
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/pictures/Makefile b/PLUGINS/src/pictures/Makefile
index 19c6fc6..a573363 100644
--- a/PLUGINS/src/pictures/Makefile
+++ b/PLUGINS/src/pictures/Makefile
@@ -99,7 +99,7 @@ i18n: $(I18Nmsgs) $(I18Npot)
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/servicedemo/Makefile b/PLUGINS/src/servicedemo/Makefile
index 18bfd26..8cba989 100644
--- a/PLUGINS/src/servicedemo/Makefile
+++ b/PLUGINS/src/servicedemo/Makefile
@@ -74,11 +74,11 @@ $(DEPFILE): Makefile
 ### Targets:
 
 libvdr-$(PLUGIN1).so: $(PLUGIN1).o
-	$(CXX) $(CXXFLAGS) -shared $(PLUGIN1).o -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGIN1).o -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 libvdr-$(PLUGIN2).so: $(PLUGIN2).o
-	$(CXX) $(CXXFLAGS) -shared $(PLUGIN2).o -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(PLUGIN2).o -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/skincurses/Makefile b/PLUGINS/src/skincurses/Makefile
index 080c3e6..e1e3ae6 100644
--- a/PLUGINS/src/skincurses/Makefile
+++ b/PLUGINS/src/skincurses/Makefile
@@ -99,7 +99,7 @@ i18n: $(I18Nmsgs) $(I18Npot)
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -lncursesw -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -lncursesw -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/status/Makefile b/PLUGINS/src/status/Makefile
index 556a09e..fa59016 100644
--- a/PLUGINS/src/status/Makefile
+++ b/PLUGINS/src/status/Makefile
@@ -72,7 +72,7 @@ $(DEPFILE): Makefile
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/PLUGINS/src/svdrpdemo/Makefile b/PLUGINS/src/svdrpdemo/Makefile
index 4a803c6..1101634 100644
--- a/PLUGINS/src/svdrpdemo/Makefile
+++ b/PLUGINS/src/svdrpdemo/Makefile
@@ -72,7 +72,7 @@ $(DEPFILE): Makefile
 ### Targets:
 
 libvdr-$(PLUGIN).so: $(OBJS)
-	$(CXX) $(CXXFLAGS) -shared $(OBJS) -o $@
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) -o $@
 	@cp --remove-destination $@ $(LIBDIR)/$@.$(APIVERSION)
 
 dist: clean
diff --git a/newplugin b/newplugin
index ffc43d3..0c498f0 100755
--- a/newplugin
+++ b/newplugin
@@ -158,7 +158,7 @@ i18n: \$(I18Nmsgs) \$(I18Npot)
 ### Targets:
 
 libvdr-\$(PLUGIN).so: \$(OBJS)
-	\$(CXX) \$(CXXFLAGS) -shared \$(OBJS) -o \$\@
+	\$(CXX) \$(CXXFLAGS) \$(LDFLAGS) -shared \$(OBJS) -o \$\@
 	\@cp --remove-destination \$\@ \$(LIBDIR)/\$\@.\$(APIVERSION)
 
 dist: clean
-- 
1.7.2.3

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
vdr mailing list
vdr@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux