source: trunk/devel/prepare @ 1007

Last change on this file since 1007 was 1007, checked in by moo, 21 months ago

typo

  • Property svn:eol-style set to native
File size: 2.8 KB
RevLine 
[52]1#! /bin/bash
[7]2SELF="$0"
[1]3
[1007]4if test -e devel/prepare.cfg ; then
5    . devel/prepare.cfg
[3]6else
[1007]7    echo devel/prepare.cfg is required, see devel/prepare.cfg >&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() {
[982]15    make_xc_opcode_spec_def.h
16    make_xc_const_string
[7]17    test -e tags && echo tags exists, skipping. use \""$0" tags\" to rebuild || make_tags
[3]18}
19
20make_clean() {
[982]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
[3]24}
[1]25
[982]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
[3]32}
[1]33
[982]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
[3]37}
[1]38
[982]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"
[3]41}
[1]42
[982]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"
[3]45}
[1]46
[982]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"
[3]49}
[1]50
[982]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"
[821]53}
54
[982]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"
[3]57}
[1]58
[982]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"
[3]61}
[1]62
[3]63make_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]78error() {
79    echo "$@" >&2
80}
81
82precheck() {
[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
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.