source: trunk/prepare.devel @ 43

Last change on this file since 43 was 43, checked in by moo, 8 years ago

less confusing name

File size: 2.4 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_opcode_spec_def.h
16    make_const_string
17    test -e tags && echo tags exists, skipping. use \""$0" tags\" to rebuild || make_tags
18}
19
20make_clean() {
21    make_clean_const_string
22    echo "*" rm -f tags opcode_spec_def.h
23    rm -f tags opcode_spec_def.h
24}
25
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}
32
33make_clean_const_string() {
34    echo "*" rm -f const_string_opcodes_php*.h{,.tmp}
35    rm -f const_string_opcodes_php*.h
36}
37
38make_const_string_opcodes_php4.x.h() {
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"
40}
41
42make_const_string_opcodes_php5.0.h() {
43    precheck const_string_opcodes_php5.0.h "${PHP5_0_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
44}
45
46make_const_string_opcodes_php5.1.h() {
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"
48}
49
50make_const_string_opcodes_php6.x.h() {
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"
52}
53
54make_opcode_spec_def.h() {
55    precheck "opcode_spec_def.h" "${EA_DIR}/opcodes.c" && "$AWK" -f ./mkopcode_spec.awk < "$I" > "$O"
56}
57
58make_tags() {
59    if test -z "$CTAGS" ; then
60        echo tool ctags not found, skip building tags >&2
61        return
62    fi
63
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}
72
73error() {
74    echo "$@" >&2
75}
76
77precheck() {
78    if ! test -e "$2" ; then
79        error X skipping "$1" because "$2" not found
80        return 1
81    fi
82    if ! test "$1" -ot "$2" ; then
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.