Browse Source

Factor out code building one file

Increase readability: decrease complexity of the build function and
preserve wandering off too much against 80-char "buoy"
Alois Mahdal 10 years ago
parent
commit
b7765b1063
1 changed files with 16 additions and 8 deletions
  1. 16
    8
      setup/mk.sh

+ 16
- 8
setup/mk.sh View File

32
     echo include
32
     echo include
33
 }
33
 }
34
 
34
 
35
-build() {
35
+build1() {
36
     local srcpath dstpath
36
     local srcpath dstpath
37
+    srcpath=$1
38
+    dstpath=${srcpath%.in}
39
+    perl -pe "
40
+        s|__FFOO_DIR__|$shrdir|;
41
+        s|__VERSION__|$(get_version)|;
42
+    " < $srcpath > $dstpath
43
+    echo $dstpath >> built.list
44
+}
45
+
46
+build() {
47
+    local srcpath
37
     find -type f -name '*.in' \
48
     find -type f -name '*.in' \
38
-        | while read srcpath;
39
-          do
40
-              dstpath=${srcpath%.in}
41
-              perl -pe "s|__FFOO_DIR__|$shrdir|;
42
-                        s|__VERSION__|$(get_version)|;" < $srcpath > $dstpath
43
-              echo $dstpath >> built.list
44
-          done
49
+     | while read srcpath;
50
+       do
51
+           build1 "$srcpath"
52
+       done
45
 }
53
 }
46
 
54
 
47
 clean() {
55
 clean() {