source: trunk/devel/prepare.devel @ 982

Last change on this file since 982 was 982, checked in by moo, 2 years ago

move files to subdirs

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1#! /bin/bash
2SELF="$0"
3
4if test -e prepare.devel.inc ; then
5    . prepare.devel.inc
6else
7    echo prepare.devel.inc is required, see prepare.devel.inc.example >&2
8    exit
9fi
10
11CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null `
12AWK=`which gawk 2>/dev/null || which awk 2>/dev/null `
13
14make_all() {
15    make_xc_opcode_spec_def.h
16    make_xc_const_string
17    test -e tags && echo tags exists, skipping. use \""$0" tags\" to rebuild || make_tags
18}
19
20make_clean() {
21    make_clean_xc_const_string
22    echo "*" rm -f tags xc_opcode_spec_def.h
23    rm -f tags xc_opcode_spec_def.h
24}
25
26make_xc_const_string() {
27    make_xc_const_string_opcodes_php4.x.h
28    make_xc_const_string_opcodes_php5.0.h
29    make_xc_const_string_opcodes_php5.1.h
30    make_xc_const_string_opcodes_php5.4.h
31    make_xc_const_string_opcodes_php6.x.h
32}
33
34make_clean_xc_const_string() {
35    echo "*" rm -f main/xc_const_string_opcodes_php*.h{,.tmp}
36    rm -f main/xc_const_string_opcodes_php*.h
37}
38
39make_xc_const_string_opcodes_php4.x.h() {
40    precheck main/xc_const_string_opcodes_php4.x.h "${PHP4_x_DIR}/Zend/zend_compile.h" && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
41}
42
43make_xc_const_string_opcodes_php5.0.h() {
44    precheck main/xc_const_string_opcodes_php5.0.h "${PHP5_0_DIR}/Zend/zend_compile.h" && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
45}
46
47make_xc_const_string_opcodes_php5.1.h() {
48    precheck main/xc_const_string_opcodes_php5.1.h "${PHP5_1_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
49}
50
51make_xc_const_string_opcodes_php5.4.h() {
52    precheck main/xc_const_string_opcodes_php5.4.h "${PHP5_4_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
53}
54
55make_xc_const_string_opcodes_php6.x.h() {
56    precheck main/xc_const_string_opcodes_php6.x.h "${PHP6_x_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./devel/gen_const_string_opcodes.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
57}
58
59make_xc_opcode_spec_def.h() {
60    precheck main/xc_opcode_spec_def.h "${EA_DIR}/opcodes.c" && "$AWK" -f ./devel/gen_xc_opcode_spec.awk < "$I" > "$O"
61}
62
63make_tags() {
64    if test -z "$CTAGS" ; then
65        echo tool ctags not found, skip building tags >&2
66        return
67    fi
68
69    if test -d "${PHP_DEVEL_DIR}" ; then
70        echo "* Making tags with ${PHP_DEVEL_DIR}"
71        "$CTAGS" -R . "${PHP_DEVEL_DIR}/main" "${PHP_DEVEL_DIR}/Zend" "${PHP_DEVEL_DIR}/TSRM" "${PHP_DEVEL_DIR}/ext/standard"
72    else
73        echo "* Making tags without php source files"
74        "$CTAGS" -R .
75    fi
76}
77
78error() {
79    echo "$@" >&2
80}
81
82precheck() {
83    if test -e "$2" ; then :; else
84        error X skipping "$1" because "$2" not found
85        return 1
86    fi
87    if test "$1" -ot "$2" ; then :; else
88        echo O "$1" is up to date.
89        return 1
90    fi
91    O="$1"
92    I="$2"
93    echo "* Making $1 from $2"
94    return 0
95}
96
97if test -z "$1" ; then
98    make_all
99else
100    while ! test -z "$1" ; do
101        eval "make_$1"
102        shift
103    done
104fi
105
Note: See TracBrowser for help on using the repository browser.