Allow command line overrides for built documentation.
authorW. Trevor King <wking@drexel.edu>
Fri, 22 Oct 2010 14:06:03 +0000 (10:06 -0400)
committerW. Trevor King <wking@drexel.edu>
Fri, 22 Oct 2010 14:06:03 +0000 (10:06 -0400)
For example, to install without documentation, use:
  $ make DOC= install
which overrides Makefile's default DOC definition, setting it to the
empty string.

Makefile
setup.py

index 120963b5b89c244e743bfbbf76ce58e2f817dccb..e4f2de9c91f4af3db125f61a82b561caf3907f89 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,9 @@ XP = /usr/bin/xsltproc --nonet --param man.charmap.use.subset "0" \
 PREFIX = ${HOME}
 INSTALL_OPTIONS = "--prefix=${PREFIX}"
 
+# Select the documentation you wish to build
+DOC = sphinx man
+
 # Directories with semantic meaning
 DOC_DIR := doc
 MAN_DIR := ${DOC_DIR}/man
@@ -58,7 +61,7 @@ build: $(LIBBE_VERSION)
        python setup.py build
 
 .PHONY: doc
-doc: sphinx man
+doc: $(DOC)
 
 .PHONY: install
 install: build doc
index da1ebad892645ec66899ed0da0a389ad97080b0f..b7fb8396f6b0c2493358af44f663c8b52f1d5ef5 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -1,11 +1,19 @@
 #!/usr/bin/env python
 
 from distutils.core import setup
+import os.path
+
 from libbe import _version
 
 rev_id = _version.version_info["revision"]
 rev_date = _version.version_info["date"]
 
+data_files = []
+
+man_path = os.path.join('doc', 'man', 'be.1')
+if os.path.exists(man_path):
+    data_files.append(('share/man/man1', [man_path]))
+
 setup(
     name='Bugs Everywhere',
     version=rev_date,
@@ -20,7 +28,5 @@ setup(
               'libbe.ui.util',
               'libbe.util'],
     scripts=['be'],
-    data_files=[
-        ('share/man/man1', ['doc/man/be.1']),
-        ]
+    data_files=data_files,
     )