File: prepare.devel

package info (click to toggle)
xcache 2.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,724 kB
  • sloc: ansic: 8,175; php: 4,557; awk: 285; sh: 135; makefile: 75
file content (105 lines) | stat: -rwxr-xr-x 2,685 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#! /bin/bash
SELF="$0"

if test -e prepare.devel.inc ; then
	. prepare.devel.inc
else
	echo prepare.devel.inc is required, see prepare.devel.inc.example >&2
	exit
fi

CTAGS=`which ctags 2>/dev/null || which exuberant-ctags 2>/dev/null `
AWK=`which gawk 2>/dev/null || which awk 2>/dev/null `

make_all() {
	make_opcode_spec_def.h
	make_const_string
	test -e tags && echo tags exists, skipping. use \""$0" tags\" to rebuild || make_tags
}

make_clean() {
 	make_clean_const_string
	echo "*" rm -f tags opcode_spec_def.h
	rm -f tags opcode_spec_def.h
}

make_const_string() {
	make_const_string_opcodes_php4.x.h
	make_const_string_opcodes_php5.0.h
	make_const_string_opcodes_php5.1.h
	make_const_string_opcodes_php5.4.h
	make_const_string_opcodes_php6.x.h
}

make_clean_const_string() {
	echo "*" rm -f const_string_opcodes_php*.h{,.tmp}
	rm -f const_string_opcodes_php*.h
}

make_const_string_opcodes_php4.x.h() {
	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"
}

make_const_string_opcodes_php5.0.h() {
	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"
}

make_const_string_opcodes_php5.1.h() {
	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"
}

make_const_string_opcodes_php5.4.h() {
	precheck const_string_opcodes_php5.4.h "${PHP5_4_DIR}/Zend/zend_vm_def.h"  && "$AWK" -f ./mkopcode.awk < "$I" > "$O.tmp" && mv "$O.tmp" "$O"
}

make_const_string_opcodes_php6.x.h() {
	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"
}

make_opcode_spec_def.h() {
	precheck "opcode_spec_def.h" "${EA_DIR}/opcodes.c" && "$AWK" -f ./mkopcode_spec.awk < "$I" > "$O"
}

make_tags() {
	if test -z "$CTAGS" ; then
		echo tool ctags not found, skip building tags >&2
		return
	fi

	if test -d "${PHP_DEVEL_DIR}" ; then
		echo "* Making tags with ${PHP_DEVEL_DIR}"
		"$CTAGS" -R . "${PHP_DEVEL_DIR}/main" "${PHP_DEVEL_DIR}/Zend" "${PHP_DEVEL_DIR}/TSRM" "${PHP_DEVEL_DIR}/ext/standard"
	else
		echo "* Making tags without php source files"
		"$CTAGS" -R .
	fi
}

error() {
	echo "$@" >&2
}

precheck() {
	if test -e "$2" ; then :; else
		error X skipping "$1" because "$2" not found
		return 1
	fi
	if test "$1" -ot "$2" ; then :; else
		echo O "$1" is up to date.
		return 1
	fi
	O="$1"
	I="$2"
	echo "* Making $1 from $2"
	return 0
}

if test -z "$1" ; then
	make_all
else
	while ! test -z "$1" ; do
		eval "make_$1"
		shift
	done
fi