changeset 10:455db4624bce

Check update on build
author Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp>
date Fri, 31 Jan 2014 22:58:46 +0900
parents 8cd28e3368fd
children 9dca7035ab93
files build.sh
diffstat 1 files changed, 18 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Fri Jan 31 19:20:25 2014 +0900
+++ b/build.sh	Fri Jan 31 22:58:46 2014 +0900
@@ -12,6 +12,21 @@
     fi
 }
 
+slide_name_from_full_path() {
+    echo $1 | sed -e 's/.[^.]*$/.html/'
+}
+
+
+need_build() {
+    slide_name=`slide_name_from_full_path $1`
+
+    if [ "${slide_name}" -ot "$1" ]; then
+        return 0    # if exist slide and newer than src, not needed.
+    fi
+
+    return 1
+}
+
 build() {
     ${build_command} build $1 -o `dirname $1` ${build_template_option}
 }
@@ -19,7 +34,9 @@
 build_slides() {
     target_list=`find "$(dirname $0)/${slide_root_dirname}" -name "${build_target_filename}"`
     for target in ${target_list}; do
-        build $target
+        if need_build $target; then
+            build $target
+        fi
     done
 }
 
@@ -28,4 +45,3 @@
 
 command_check
 build_slides
-