Browse Source

tools/create-ccan-tree: Add basic waf support

This adds a "waf" buildtype to create-ccan-tree. When passed it
generates a basic wscript for building everything into a libccan.a

It doesn't support running the generator, so you need to provide
config.h

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
Michael Ellerman 13 years ago
parent
commit
b1f28e1722
1 changed files with 14 additions and 2 deletions
  1. 14 2
      tools/create-ccan-tree

+ 14 - 2
tools/create-ccan-tree

@@ -10,7 +10,7 @@ options:
   -a, --copy-all         copy all files in module tree (not just sources
   -a, --copy-all         copy all files in module tree (not just sources
 		         required for build)
 		         required for build)
   -b, --build-type=TYPE  generate build infrastructure of TYPE
   -b, --build-type=TYPE  generate build infrastructure of TYPE
-                         (one of 'make', 'make+config', 'automake')
+                         (one of 'make', 'make+config', 'automake', 'waf')
 EOF
 EOF
 }
 }
 
 
@@ -60,7 +60,7 @@ fi
 
 
 # check --build-type argument sanity
 # check --build-type argument sanity
 case "$build_type" in
 case "$build_type" in
-	''|'make'|'make+config'|'automake')
+	''|'make'|'make+config'|'automake'|'waf')
 		;;
 		;;
 	*)
 	*)
 		echo "Invalid build type '$build_type'" >&2
 		echo "Invalid build type '$build_type'" >&2
@@ -209,6 +209,18 @@ objs = \$(patsubst %.c, %.o, \$(wildcard ccan/*/*.c))
 EOF
 EOF
 fi
 fi
 
 
+if [ "$build_type" = "waf" ]
+then
+	echo "Adding waf wscript"
+	cat > "$tmpdir/wscript" << EOF
+def build(ctx):
+    ctx(features     = 'c cstlib',
+        source       = ctx.path.ant_glob('**/*.c'),
+        target       = 'ccan',
+        includes     = '.')
+EOF
+fi
+
 mv "$tmpdir" "$outdir"
 mv "$tmpdir" "$outdir"
 echo "Done. ccan source tree built in $outdir"
 echo "Done. ccan source tree built in $outdir"