[vlc-commits] python: conditional compilation based on presence of include files
Olivier Aubert
git at videolan.org
Wed Mar 1 18:15:32 CET 2017
vlc/python | branch: master | Olivier Aubert <contact at olivieraubert.net> | Wed Mar 1 18:05:25 2017 +0100| [f30f33458945cfc7e3418045753af67dad727889] | committer: Olivier Aubert
python: conditional compilation based on presence of include files
Add some explanation messages in the Makefile and the README file to
specify what is expected.
Closes #26
> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=f30f33458945cfc7e3418045753af67dad727889
---
Makefile | 36 +++++++++++++++++++++++++++++++-----
README.rst | 13 ++++++++++++-
2 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 0294c37..f244522 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,39 @@
+DEV_INCLUDE_DIR=../../include/vlc
+INSTALLED_INCLUDE_DIR=/usr/include/vlc
MODULE_NAME=generated/vlc.py
VERSIONED_NAME=generated/2.2/vlc.py
-all: $(MODULE_NAME) $(VERSIONED_NAME)
+DEV_INCLUDES=$(wildcard $(DEV_INCLUDE_DIR)/*.h)
+INSTALLED_INCLUDES=$(wildcard $(INSTALLED_INCLUDE_DIR)/*.h)
-$(MODULE_NAME): generator/generate.py generator/header.py generator/footer.py generator/override.py ../../include/vlc/*.h
- python generator/generate.py ../../include/vlc/*.h -o $@
+ifneq ($(DEV_INCLUDES),)
+TARGETS+=dev
+endif
+ifneq ($(INSTALLED_INCLUDES),)
+TARGETS+=installed
+endif
+ifeq ($(TARGETS),)
+TARGETS=missing
+endif
-$(VERSIONED_NAME): generator/generate.py generator/header.py generator/footer.py generator/override.py /usr/include/vlc/*.h
- python generator/generate.py /usr/include/vlc/*.h -o $@
+all: $(TARGETS)
+
+missing:
+ @echo "Cannot find include files either from a source tree in $(DEV_INCLUDE_DIR) or from installed includes in $(INSTALLED_INCLUDE_DIR)."
+ exit 0
+
+.ONESHELL:
+dev: $(MODULE_NAME)
+ @if [ ! -d $(DEV_INCLUDE_DIR) ]; then echo "The bindings directory must be placed in a VLC source tree as vlc/bindings/python to generate the dev version of the bindings. If you want to generate against installed include files, use the 'installed' target." ; exit 1 ; fi
+
+installed: $(VERSIONED_NAME)
+ @if [ ! -d $(INSTALLED_INCLUDE_DIR) ]; then echo "Cannot find the necessary VLC include files in $(INSTALLED_INCLUDE_DIR). Make sure a full VLC install is present on the system." ; exit 1 ; fi
+
+$(MODULE_NAME): generator/generate.py generator/header.py generator/footer.py generator/override.py $(DEV_INCLUDES)
+ python generator/generate.py $(DEV_INCLUDES) -o $@
+
+$(VERSIONED_NAME): generator/generate.py generator/header.py generator/footer.py generator/override.py $(INSTALLED_INCLUDES)
+ python generator/generate.py $(INSTALLED_INCLUDES) -o $@
doc: $(MODULE_NAME)
-epydoc -v -o doc $<
diff --git a/README.rst b/README.rst
index be53d1a..1d1d326 100644
--- a/README.rst
+++ b/README.rst
@@ -21,10 +21,21 @@ You can get the latest version of the code generator from
<https://github.com/oaubert/python-vlc/> or
<http://git.videolan.org/?p=vlc/bindings/python.git>.
-To generate the vlc.py module and its documentation, use
+The code expects to be placed inside a VLC source tree, in
+vlc/bindings/python, so that it finds the development include files,
+or to find the installed include files in /usr/include (on Debian,
+install libvlc-dev).
+
+To generate the vlc.py module and its documentation, for both the
+development version and the installed VLC version, use
make
+If you want to generate the bindings from an installed version of the
+VLC includes, use the 'installed' target:
+
+ make installed
+
To install it for development purposes (add a symlink to your Python
library) simply do
More information about the vlc-commits
mailing list