| [3] | 1 | #!/bin/bash |
|---|
| [1] | 2 | |
|---|
| [3] | 3 | if test -e make.inc ; then |
|---|
| 4 | . make.inc |
|---|
| 5 | else |
|---|
| 6 | echo make.inc is required, see make.inc.example >&2 |
|---|
| 7 | exit |
|---|
| 8 | fi |
|---|
| [1] | 9 | |
|---|
| [3] | 10 | CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null ` |
|---|
| 11 | AWK=`which gawk 2>/dev/null || which awk 2>/dev/null ` |
|---|
| [1] | 12 | |
|---|
| [3] | 13 | make_all() { |
|---|
| 14 | make_opcode_spec_def.h |
|---|
| 15 | make_const_string |
|---|
| 16 | make_tags |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | make_clean() { |
|---|
| 20 | make_clean_const_string |
|---|
| 21 | echo "*" rm -f tags opcode_spec_def.h |
|---|
| [1] | 22 | rm -f tags opcode_spec_def.h |
|---|
| [3] | 23 | } |
|---|
| [1] | 24 | |
|---|
| [3] | 25 | make_const_string() { |
|---|
| 26 | make_const_string_opcodes_php4.x.h |
|---|
| 27 | make_const_string_opcodes_php5.0.h |
|---|
| 28 | make_const_string_opcodes_php5.1.h |
|---|
| 29 | make_const_string_opcodes_php6.x.h |
|---|
| 30 | } |
|---|
| [1] | 31 | |
|---|
| [3] | 32 | make_clean_const_string() { |
|---|
| 33 | echo "*" rm -f const_string_opcodes_php*.h |
|---|
| 34 | rm -f const_string_opcodes_php*.h |
|---|
| 35 | } |
|---|
| [1] | 36 | |
|---|
| [3] | 37 | make_const_string_opcodes_php4.x.h() { |
|---|
| 38 | precheck const_string_opcodes_php4.x.h "${PHP4_x_DIR}/Zend/zend_compile.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O" |
|---|
| 39 | } |
|---|
| [1] | 40 | |
|---|
| [3] | 41 | make_const_string_opcodes_php5.0.h() { |
|---|
| 42 | precheck const_string_opcodes_php5.0.h "${PHP5_0_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O" |
|---|
| 43 | } |
|---|
| [1] | 44 | |
|---|
| [3] | 45 | make_const_string_opcodes_php5.1.h() { |
|---|
| 46 | precheck const_string_opcodes_php5.1.h "${PHP5_1_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O" |
|---|
| 47 | } |
|---|
| [1] | 48 | |
|---|
| [3] | 49 | make_const_string_opcodes_php6.x.h() { |
|---|
| 50 | precheck const_string_opcodes_php6.x.h "${PHP6_x_DIR}/Zend/zend_vm_def.h" && "$AWK" -f ./mkopcode.awk < "$I" > "$O" |
|---|
| 51 | } |
|---|
| [1] | 52 | |
|---|
| [3] | 53 | make_opcode_spec_def.h() { |
|---|
| 54 | precheck "opcode_spec_def.h" "${EA_DIR}/opcodes.c" && "$AWK" -f ./mkopcode_spec.awk < "$I" > "$O" |
|---|
| 55 | } |
|---|
| [1] | 56 | |
|---|
| [3] | 57 | make_tags() { |
|---|
| 58 | if test -z "$CTAGS" ; then |
|---|
| 59 | echo ctags not found, skip building tags >&2 |
|---|
| 60 | return |
|---|
| 61 | fi |
|---|
| [1] | 62 | |
|---|
| [3] | 63 | if test -d "${PHP_DEVEL_DIR}" ; then |
|---|
| 64 | echo "* Making tags with ${PHP_DEVEL_DIR}" |
|---|
| 65 | "$CTAGS" -R . "${PHP_DEVEL_DIR}/main" "${PHP_DEVEL_DIR}/Zend" "${PHP_DEVEL_DIR}/TSRM" "${PHP_DEVEL_DIR}/ext/standard" |
|---|
| 66 | else |
|---|
| 67 | echo "* Making tags without php source files" |
|---|
| 68 | "$CTAGS" -R . |
|---|
| 69 | fi |
|---|
| 70 | } |
|---|
| [1] | 71 | |
|---|
| [3] | 72 | error() { |
|---|
| 73 | echo "$@" >&2 |
|---|
| 74 | } |
|---|
| 75 | |
|---|
| 76 | precheck() { |
|---|
| 77 | if ! test -e "$2" ; then |
|---|
| 78 | error X skipping "$1" because "$2" not found |
|---|
| 79 | return 1 |
|---|
| 80 | fi |
|---|
| 81 | if ! test "$1" -ot "$2" ; then |
|---|
| 82 | echo O "$1" is up to date. |
|---|
| 83 | return 1 |
|---|
| 84 | fi |
|---|
| 85 | O="$1" |
|---|
| 86 | I="$2" |
|---|
| 87 | echo "* Making $1 from $2" |
|---|
| 88 | return 0 |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | if test -z "$1" ; then |
|---|
| 92 | make_all |
|---|
| 93 | else |
|---|
| 94 | while ! test -z "$1" ; do |
|---|
| 95 | eval "make_$1" |
|---|
| 96 | shift |
|---|
| 97 | done |
|---|
| 98 | fi |
|---|
| 99 | |
|---|