[v4] Gather necessary options for build in Make.global and include it.
Commit Message
Without this patch, if some options in `Makefile` were set outside `Makefile` and no `Make.config` existed with the necessary options, builds could fail. [1][2][3]
Therefore include strictly necessary options in `Make.global` and include this in all the Makefiles before `Make.config`.
[1] http://www.linuxtv.org/pipermail/vdr/2009-July/020977.html
[2] http://www.linuxtv.org/pipermail/vdr/2009-December/021807.html
[3] http://www.linuxtv.org/pipermail/vdr/2010-January/022235.html
v2: Use `include` instead of `-include` to get a warning/error if it is not present. [4]
v3: Change according to Frank’s comments [5].
• Delete options set in `Make.global` from other Makefiles.
• Leave adding `-fPIC` to `C[XX]FLAGS` in `Make.config.template` as the flags get reset including `Make.config`.
• Modify `newplugin`.
v4: Actually provide a working patch. Thanks to Klaus [6].
• Only use `$(VDRDIR)` after it has been defined.
• Escape `$` in Perl script `newplugin`.
[4] http://www.gnu.org/software/make/manual/make.html#Include
[5] http://www.linuxtv.org/pipermail/vdr/2010-January/022243.html
[6] http://www.linuxtv.org/pipermail/vdr/2010-February/022325.html
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
---
Make.config.template | 1 -
Make.global | 14 ++++++++++++++
Makefile | 3 +--
PLUGINS/src/dvbsddevice/Makefile | 8 +++++---
PLUGINS/src/hello/Makefile | 6 +++++-
PLUGINS/src/osddemo/Makefile | 6 +++++-
PLUGINS/src/pictures/Makefile | 6 +++++-
PLUGINS/src/servicedemo/Makefile | 6 +++++-
PLUGINS/src/skincurses/Makefile | 6 +++++-
PLUGINS/src/status/Makefile | 6 +++++-
PLUGINS/src/svdrpdemo/Makefile | 6 +++++-
newplugin | 8 +++++---
12 files changed, 60 insertions(+), 16 deletions(-)
create mode 100644 Make.global
@@ -19,7 +19,6 @@ CXXFLAGS = -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
ifdef PLUGIN
CFLAGS += -fPIC
CXXFLAGS += -fPIC
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
endif
### The directory environment:
new file mode 100644
@@ -0,0 +1,14 @@
+#
+# Strictly necessary Makefile options for the Video Disk Recorder
+#
+# See the main source file 'vdr.c' for copyright information and
+# how to reach the author.
+
+# Plugins need to be compiled with position independent code, otherwise linking
+# VDR against it will fail.
+ifdef PLUGIN
+CFLAGS += -fPIC
+CXXFLAGS += -fPIC
+endif
+
+DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
@@ -32,6 +32,7 @@ CONFDIR = $(VIDEODIR)
DOXYGEN = /usr/bin/doxygen
DOXYFILE = Doxyfile
+include Make.global
-include Make.config
SILIB = $(LSIDIR)/libsi.a
@@ -60,8 +61,6 @@ DEFINES += -DLIRC_DEVICE=\"$(LIRC_DEVICE)\" -DRCU_DEVICE=\"$(RCU_DEVICE)\"
DEFINES += -D_GNU_SOURCE
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-
DEFINES += -DVIDEODIR=\"$(VIDEODIR)\"
DEFINES += -DCONFDIR=\"$(CONFDIR)\"
DEFINES += -DPLUGINDIR=\"$(PLUGINLIBDIR)\"
@@ -18,7 +18,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -26,6 +26,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include $(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -45,8 +49,6 @@ INCLUDES += -I$(VDRDIR)/include
DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"$(PLUGIN)"'
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-
### The object files (add further files here):
OBJS = $(PLUGIN).o dvbsdffdevice.o dvbsdffosd.o
@@ -18,7 +18,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -26,6 +26,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include $(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -16,7 +16,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -24,6 +24,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include $(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -18,7 +18,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -26,6 +26,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include $(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -18,7 +18,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN1).c | awk '{ pr
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -26,6 +26,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include $(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -18,7 +18,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -26,6 +26,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include $(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -16,7 +16,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -24,6 +24,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include $(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -16,7 +16,7 @@ VERSION = $(shell grep 'static const char \*VERSION *=' $(PLUGIN).c | awk '{ pri
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -24,6 +24,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include $(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include $(VDRDIR)/Make.config
@@ -77,7 +77,7 @@ VERSION = \$(shell grep 'static const char \\*VERSION *=' \$(PLUGIN).c | awk '{
### The C++ compiler and options:
CXX ?= g++
-CXXFLAGS ?= -fPIC -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
+CXXFLAGS ?= -g -O2 -Wall -Woverloaded-virtual -Wno-parentheses
### The directory environment:
@@ -85,6 +85,10 @@ VDRDIR = ../../..
LIBDIR = ../../lib
TMPDIR = /tmp
+### Make sure that necessary options are included:
+
+include \$(VDRDIR)/Make.global
+
### Allow user defined options to overwrite defaults:
-include \$(VDRDIR)/Make.config
@@ -104,8 +108,6 @@ INCLUDES += -I\$(VDRDIR)/include
DEFINES += -D_GNU_SOURCE -DPLUGIN_NAME_I18N='"\$(PLUGIN)"'
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-
### The object files (add further files here):
OBJS = \$(PLUGIN).o