Make C bindings installable with DESTDIR support.
authorRobert Collins <robertc@robertcollins.net>
Sat, 15 Apr 2006 06:35:22 +0000 (16:35 +1000)
committerRobert Collins <robertc@robertcollins.net>
Sat, 15 Apr 2006 06:35:22 +0000 (16:35 +1000)
c/Makefile
c/SConstruct

index db6c5cec001cc913da32bbcce7b5276bab448437..0de9221062cafaa02f52fc4f1a4ab4300d0eba32 100644 (file)
@@ -1,5 +1,5 @@
 all:
-       scons
+       scons -Q
 
 check:
        scons check
@@ -7,4 +7,7 @@ check:
 clean:
        scons -c
 
-.PHONY: all check clean
+install:
+       scons install
+
+.PHONY: all check clean install
index af4c0e5d742ad03bf78c17b54bed9c77afe276e0..7f08c10f846229b299f841ab8df98a93e1b0e51b 100644 (file)
@@ -1,5 +1,17 @@
 # setup our tools
+import os.path
+
+default_root = os.path.expanduser('~/local/')
+DESTDIR=ARGUMENTS.get('DESTDIR', default_root)
+if DESTDIR[-1] != '/':
+  DESTDIR += '/'
+include = os.path.join(DESTDIR, "include", "subunit")
+lib = os.path.join(DESTDIR, "lib")
+# bin = "#export/$PLATFORM/bin"
 env = Environment()
+Export('env')
+
+# support tools
 def run_test_scripts(source, target, env, for_signature):
     """Run all the sources as executable scripts which return 0 on success."""
     # TODO: make this cross platform compatible.
@@ -15,4 +27,8 @@ test_child = Program('tests/test_child.c',
     CPPPATH='include',
     LIBPATH='lib')
 env.TestRC('check', test_child, LIBPATH='lib')
+installs = []
+installs.append(env.Install(lib, subunit))
+installs.append(env.Install(include, 'include/subunit/child.h'))
+env.Alias('install', installs)
 Default(subunit)