| [52] | 1 | #! /bin/bash |
|---|
| [7] | 2 | SELF="$0" |
|---|
| [1] | 3 | |
|---|
| [43] | 4 | if test -e prepare.devel.inc ; then |
|---|
| 5 | . prepare.devel.inc |
|---|
| [3] | 6 | else |
|---|
| [43] | 7 | echo prepare.devel.inc is required, see prepare.devel.inc.example >&2 |
|---|
| [3] | 8 | exit |
|---|
| 9 | fi |
|---|
| [1] | 10 | |
|---|
| [3] | 11 | CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null ` |
|---|
| 12 | AWK=`which gawk 2>/dev/null || which awk 2>/dev/null ` |
|---|
| [1] | 13 | |
|---|
| [3] | 14 | make_all() { |
|---|
| 15 | make_opcode_spec_def.h |
|---|
| 16 | make_const_string |
|---|
| [7] | 17 | test -e tags && echo tags exists, skipping. use \""$0" tags\" to rebuild || make_tags |
|---|
| [3] | 18 | } |
|---|
| 19 | |
|---|
| 20 | make_clean() { |
|---|
| 21 | make_clean_const_string |
|---|
| 22 | echo "*" rm -f tags opcode_spec_def.h |
|---|
| [1] | 23 | rm -f tags opcode_spec_def.h |
|---|
| [3] | 24 | } |
|---|
| [1] | 25 | |
|---|
| [3] | 26 | make_const_string() { |
|---|
| 27 | make_const_string_opcodes_php4.x.h |
|---|
| 28 | make_const_string_opcodes_php5.0.h |
|---|
| 29 | make_const_string_opcodes_php5.1.h |
|---|
| [485] | 30 | make_const_string_opcodes_php5.3.h |
|---|
| [3] | 31 | make_const_string_opcodes_php6.x.h |
|---|
| 32 | } |
|---|
| [1] | 33 | |
|---|
| [3] | 34 | make_clean_const_string() { |
|---|
| [43] | 35 | echo "*" rm -f const_string_opcodes_php*.h{,.tmp} |
|---|
| [3] | 36 | rm -f const_string_opcodes_php*.h |
|---|
| 37 | } |
|---|
| [1] | 38 | |
|---|
| [3] | 39 | make_const_string_opcodes_php4.x.h() { |
|---|
| [43] | 40 | precheck const_string_opcodes_php4.x.h "${PHP4_x_DIR}/Zend/zend_compile.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O" |
|---|
| [3] | 41 | } |
|---|
| [1] | 42 | |
|---|
| [3] | 43 | make_const_string_opcodes_php5.0.h() { |
|---|
| [52] | 44 | precheck const_string_opcodes_php5.0.h "${PHP5_0_DIR}/Zend/zend_compile.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O" |
|---|
| [3] | 45 | } |
|---|
| [1] | 46 | |
|---|
| [3] | 47 | make_const_string_opcodes_php5.1.h() { |
|---|
| [43] | 48 | precheck const_string_opcodes_php5.1.h "${PHP5_1_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O" |
|---|
| [3] | 49 | } |
|---|
| [1] | 50 | |
|---|
| [485] | 51 | make_const_string_opcodes_php5.3.h() { |
|---|
| 52 | precheck const_string_opcodes_php5.3.h "${PHP5_3_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O" |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| [3] | 55 | make_const_string_opcodes_php6.x.h() { |
|---|
| [43] | 56 | precheck const_string_opcodes_php6.x.h "${PHP6_x_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O" |
|---|
| [3] | 57 | } |
|---|
| [1] | 58 | |
|---|
| [3] | 59 | make_opcode_spec_def.h() { |
|---|
| 60 | precheck "opcode_spec_def.h" "${EA_DIR}/opcodes.c" && "$AWK" -f ./mkopcode_spec.awk < "$I" > "$O" |
|---|
| 61 | } |
|---|
| [1] | 62 | |
|---|
| [3] | 63 | make_tags() { |
|---|
| 64 | if test -z "$CTAGS" ; then |
|---|
| [7] | 65 | echo tool ctags not found, skip building tags >&2 |
|---|
| [3] | 66 | return |
|---|
| 67 | fi |
|---|
| [1] | 68 | |
|---|
| [3] | 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 | } |
|---|
| [1] | 77 | |
|---|
| [3] | 78 | error() { |
|---|
| 79 | echo "$@" >&2 |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | precheck() { |
|---|
| [52] | 83 | if test -e "$2" ; then :; else |
|---|
| [3] | 84 | error X skipping "$1" because "$2" not found |
|---|
| 85 | return 1 |
|---|
| 86 | fi |
|---|
| [52] | 87 | if test "$1" -ot "$2" ; then :; else |
|---|
| [3] | 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 | |
|---|
| 97 | if test -z "$1" ; then |
|---|
| 98 | make_all |
|---|
| 99 | else |
|---|
| 100 | while ! test -z "$1" ; do |
|---|
| 101 | eval "make_$1" |
|---|
| 102 | shift |
|---|
| 103 | done |
|---|
| 104 | fi |
|---|
| 105 | |
|---|