]> git.ozlabs.org Git - ccan/commitdiff
tools/create-ccan-tree: Add --build-type=automake
authorJeremy Kerr <jeremy.kerr@canonical.com>
Thu, 24 May 2012 05:48:19 +0000 (13:48 +0800)
committerJeremy Kerr <jeremy.kerr@canonical.com>
Mon, 28 May 2012 13:48:52 +0000 (21:48 +0800)
Add a new build type to create an appropriate Makefile.am for the
newly-created ccan tree.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
tools/create-ccan-tree

index ccfee7c664cdcf3bae592844552a2e291e314ab7..6b258984c93a38904b92ac3143cd7e3733182a4d 100755 (executable)
@@ -10,7 +10,7 @@ options:
   -a, --copy-all         copy all files in module tree (not just sources
                         required for build)
   -b, --build-type=TYPE  generate build infrastructure of TYPE
   -a, --copy-all         copy all files in module tree (not just sources
                         required for build)
   -b, --build-type=TYPE  generate build infrastructure of TYPE
-                         (one of 'make', 'make+config')
+                         (one of 'make', 'make+config', 'automake')
 EOF
 }
 
 EOF
 }
 
@@ -60,7 +60,7 @@ fi
 
 # check --build-type argument sanity
 case "$build_type" in
 
 # check --build-type argument sanity
 case "$build_type" in
-       ''|'make'|'make+config')
+       ''|'make'|'make+config'|'automake')
                ;;
        *)
                echo "Invalid build type '$build_type'" >&2
                ;;
        *)
                echo "Invalid build type '$build_type'" >&2
@@ -162,6 +162,19 @@ done
 
 echo "Adding build infrastructure"
 
 
 echo "Adding build infrastructure"
 
+# generate automake Makefile.am
+automakefile="$tmpdir/Makefile.am"
+if [ "$build_type" = "automake" ]
+then
+       (
+               echo "noinst_LIBRARIES = libccan.a"
+               echo "libccan_a_SOURCES = \\"
+               cd "$tmpdir"
+               find ccan -maxdepth 2 -name '*.[ch]' |
+                       sed -e 's,^,\t,;$!s,$, \\,'
+       ) > "$automakefile"
+fi
+
 makefile="$tmpdir/Makefile"
 if [ "$build_type" = "make" -o "$build_type" = "make+config" ]
 then
 makefile="$tmpdir/Makefile"
 if [ "$build_type" = "make" -o "$build_type" = "make+config" ]
 then