source: branches/1.3/prepare.devel @ 604

Last change on this file since 604 was 604, checked in by moo, 5 years ago

set svn:eol-style to native

  • Property svn:eol-style set to native
File size: 2.4 KB
RevLine 
[52]1#! /bin/bash
[7]2SELF="$0"
[1]3
[43]4if test -e prepare.devel.inc ; then
5    . prepare.devel.inc
[3]6else
[43]7    echo prepare.devel.inc is required, see prepare.devel.inc.example >&2
[3]8    exit
9fi
[1]10
[3]11CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null `
12AWK=`which gawk 2>/dev/null || which awk 2>/dev/null `
[1]13
[3]14make_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
20make_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]26make_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
30    make_const_string_opcodes_php6.x.h
31}
[1]32
[3]33make_clean_const_string() {
[43]34    echo "*" rm -f const_string_opcodes_php*.h{,.tmp}
[3]35    rm -f const_string_opcodes_php*.h
36}
[1]37
[3]38make_const_string_opcodes_php4.x.h() {
[43]39    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]40}
[1]41
[3]42make_const_string_opcodes_php5.0.h() {
[52]43    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]44}
[1]45
[3]46make_const_string_opcodes_php5.1.h() {
[43]47    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]48}
[1]49
[3]50make_const_string_opcodes_php6.x.h() {
[43]51    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]52}
[1]53
[3]54make_opcode_spec_def.h() {
55    precheck "opcode_spec_def.h" "${EA_DIR}/opcodes.c" && "$AWK" -f ./mkopcode_spec.awk < "$I" > "$O"
56}
[1]57
[3]58make_tags() {
59    if test -z "$CTAGS" ; then
[7]60        echo tool ctags not found, skip building tags >&2
[3]61        return
62    fi
[1]63
[3]64    if test -d "${PHP_DEVEL_DIR}" ; then
65        echo "* Making tags with ${PHP_DEVEL_DIR}"
66        "$CTAGS" -R . "${PHP_DEVEL_DIR}/main" "${PHP_DEVEL_DIR}/Zend" "${PHP_DEVEL_DIR}/TSRM" "${PHP_DEVEL_DIR}/ext/standard"
67    else
68        echo "* Making tags without php source files"
69        "$CTAGS" -R .
70    fi
71}
[1]72
[3]73error() {
74    echo "$@" >&2
75}
76
77precheck() {
[52]78    if test -e "$2" ; then :; else
[3]79        error X skipping "$1" because "$2" not found
80        return 1
81    fi
[52]82    if test "$1" -ot "$2" ; then :; else
[3]83        echo O "$1" is up to date.
84        return 1
85    fi
86    O="$1"
87    I="$2"
88    echo "* Making $1 from $2"
89    return 0
90}
91
92if test -z "$1" ; then
93    make_all
94else
95    while ! test -z "$1" ; do
96        eval "make_$1"
97        shift
98    done
99fi
100
Note: See TracBrowser for help on using the repository browser.