source: trunk/make.devel @ 3

Last change on this file since 3 was 3, checked in by moo, 9 years ago

rewrite as bash script

File size: 2.2 KB
Line 
1#!/bin/bash
2
3if test -e make.inc ; then
4    . make.inc
5else
6    echo make.inc is required, see make.inc.example >&2
7    exit
8fi
9
10CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null `
11AWK=`which gawk 2>/dev/null || which awk 2>/dev/null `
12
13make_all() {
14    make_opcode_spec_def.h
15    make_const_string
16    make_tags
17}
18
19make_clean() {
20    make_clean_const_string
21    echo "*" rm -f tags opcode_spec_def.h
22    rm -f tags opcode_spec_def.h
23}
24
25make_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}
31
32make_clean_const_string() {
33    echo "*" rm -f const_string_opcodes_php*.h
34    rm -f const_string_opcodes_php*.h
35}
36
37make_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}
40
41make_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}
44
45make_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}
48
49make_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}
52
53make_opcode_spec_def.h() {
54    precheck "opcode_spec_def.h" "${EA_DIR}/opcodes.c" && "$AWK" -f ./mkopcode_spec.awk < "$I" > "$O"
55}
56
57make_tags() {
58    if test -z "$CTAGS" ; then
59        echo ctags not found, skip building tags >&2
60        return
61    fi
62
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}
71
72error() {
73    echo "$@" >&2
74}
75
76precheck() {
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
91if test -z "$1" ; then
92    make_all
93else
94    while ! test -z "$1" ; do
95        eval "make_$1"
96        shift
97    done
98fi
99
Note: See TracBrowser for help on using the repository browser.