|
1
|
# This is a wrapper, permitting overriding of the MAKE parameters |
|
2
|
|
|
3
|
# Are we doing a cross-compile for Windows? Set to '.w32' if we are: |
|
4
|
cross= |
|
5
|
|
|
6
|
# Are we doing a clean? Set to 'clean' if so: |
|
7
|
clean= |
|
8
|
|
|
9
|
# Are we doing all platforms? |
|
10
|
doall=0 |
|
11
|
|
|
12
|
postbuild() |
|
13
|
{ |
|
14
|
echo "Finished build" |
|
15
|
} |
|
16
|
|
|
17
|
die() |
|
18
|
{ |
|
19
|
echo $1 |
|
20
|
exit 1 |
|
21
|
} |
|
22
|
|
|
23
|
domake() |
|
24
|
{ |
|
25
|
optsfile="make.opts${cross}" |
|
26
|
( |
|
27
|
if [ -f $optsfile ] |
|
28
|
then |
|
29
|
. $optsfile |
|
30
|
fi |
|
31
|
|
|
32
|
make -f Makefile${cross} ${clean} || die "Could not build!" |
|
33
|
|
|
34
|
if [ "$clean" != "clean" ] |
|
35
|
then |
|
36
|
postbuild |
|
37
|
fi |
|
38
|
) |
|
39
|
|
|
40
|
} |
|
41
|
|
|
42
|
syntax() |
|
43
|
{ |
|
44
|
cat <<EOF |
|
45
|
OPTIONS: |
|
46
|
|
|
47
|
make.sh [help] [cross] [all] [clean] |
|
48
|
|
|
49
|
The options are position-insensitive and additive: |
|
50
|
|
|
51
|
'help' displays this text |
|
52
|
'cross' does a cross-compile for Windows |
|
53
|
'all' does a regular build as well as a cross-compile |
|
54
|
'clean' cleans rather than builds |
|
55
|
|
|
56
|
For example: |
|
57
|
|
|
58
|
make.sh cross clean |
|
59
|
|
|
60
|
Will clean the Windows cross-compiled build. Giving no options will make the |
|
61
|
script do a 'regular' build. |
|
62
|
|
|
63
|
FILES: |
|
64
|
|
|
65
|
In order to override the defaults, you may create a file "make.opts" and/or |
|
66
|
"make.opts.w32". These are normal "bash" scripts, in which you override whatever |
|
67
|
behavior you want. For example, you might override the "postbuild" function so |
|
68
|
that you create a ZIP file after compilation. Or you can export a new TCC |
|
69
|
variable to override the standard default values. See "Makefile" for values you |
|
70
|
might be interested in overriding. |
|
71
|
EOF |
|
72
|
exit 1 |
|
73
|
} |
|
74
|
|
|
75
|
|
|
76
|
# process command-line options: |
|
77
|
|
|
78
|
while [ "$1" != "" ] |
|
79
|
do |
|
80
|
case $1 in |
|
81
|
cross) |
|
82
|
cross='.w32' |
|
83
|
;; |
|
84
|
|
|
85
|
all) |
|
86
|
doall=1 |
|
87
|
;; |
|
88
|
|
|
89
|
clean) |
|
90
|
clean='clean' |
|
91
|
;; |
|
92
|
help|*) |
|
93
|
syntax |
|
94
|
;; |
|
95
|
esac |
|
96
|
shift |
|
97
|
done |
|
98
|
|
|
99
|
# Do what needs to be done! |
|
100
|
if [ "$doall" == "1" ] |
|
101
|
then |
|
102
|
cross= |
|
103
|
domake |
|
104
|
cross='.w32' |
|
105
|
domake |
|
106
|
else |
|
107
|
domake |
|
108
|
fi |
|
109
|
|