Fossil SCM

added make wrapper script

ron 2010-02-28 07:01 trunk
Commit 0ddd305acb7f4b0bec04c71f01ded95208598cb2
1 file changed +104
+104
--- a/make.sh
+++ b/make.sh
@@ -0,0 +1,104 @@
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
+
35
+ if [ "$clean" != "cle
36
+}
37
+
38
+syntax()
39
+{
40
+cat <<EOF
41
+OPTIONS:
42
+
43
+ make.sh [help] [cross] [all] [clean]
44
+
45
+The options are position-insensitive and additive:
46
+
47
+ 'help' displays this text
48
+ 'cross' does a cross-compile for Windows
49
+ 'all' does a regular build as well as a cross-compile
50
+ 'clean' cleans rather than builds
51
+
52
+For example:
53
+
54
+ make.sh cross clean
55
+
56
+Will clean the Windows cross-compiled build. Giving no options will make the
57
+script do a 'regular' build.
58
+
59
+FILES:
60
+
61
+In order to override the defaults, you may create a file "make.opts" and/or
62
+"make.opts.w32". These are normal "bash" scripts, in which you override whatever
63
+behavior you want. For example, you might override the "postbuild" function so
64
+that you create a ZIP file after compilation. Or you can export a new TCC
65
+variable to override the standard default values. See "Makefile" for values you
66
+might be interested in overriding.
67
+EOF
68
+exit 1
69
+}
70
+
71
+
72
+# process command-line options:
73
+
74
+while [ "$1" != "" ]
75
+do
76
+ case $1 in
77
+ cross)
78
+ cross='.w32'
79
+ ;;
80
+
81
+ all)
82
+ doall=1
83
+ ;;
84
+
85
+ clean)
86
+ clean='clean'
87
+ ;;
88
+ help|*)
89
+ syntax
90
+ ;;
91
+ esac
92
+ shift
93
+done
94
+
95
+# Do what needs to be done!
96
+if [ "$doall" == "1" ]
97
+then
98
+ cross=
99
+ domake
100
+ cross='.w32'
101
+ domake
102
+else
103
+ domake
104
+fi
--- a/make.sh
+++ b/make.sh
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
--- a/make.sh
+++ b/make.sh
@@ -0,0 +1,104 @@
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
35 if [ "$clean" != "cle
36 }
37
38 syntax()
39 {
40 cat <<EOF
41 OPTIONS:
42
43 make.sh [help] [cross] [all] [clean]
44
45 The options are position-insensitive and additive:
46
47 'help' displays this text
48 'cross' does a cross-compile for Windows
49 'all' does a regular build as well as a cross-compile
50 'clean' cleans rather than builds
51
52 For example:
53
54 make.sh cross clean
55
56 Will clean the Windows cross-compiled build. Giving no options will make the
57 script do a 'regular' build.
58
59 FILES:
60
61 In order to override the defaults, you may create a file "make.opts" and/or
62 "make.opts.w32". These are normal "bash" scripts, in which you override whatever
63 behavior you want. For example, you might override the "postbuild" function so
64 that you create a ZIP file after compilation. Or you can export a new TCC
65 variable to override the standard default values. See "Makefile" for values you
66 might be interested in overriding.
67 EOF
68 exit 1
69 }
70
71
72 # process command-line options:
73
74 while [ "$1" != "" ]
75 do
76 case $1 in
77 cross)
78 cross='.w32'
79 ;;
80
81 all)
82 doall=1
83 ;;
84
85 clean)
86 clean='clean'
87 ;;
88 help|*)
89 syntax
90 ;;
91 esac
92 shift
93 done
94
95 # Do what needs to be done!
96 if [ "$doall" == "1" ]
97 then
98 cross=
99 domake
100 cross='.w32'
101 domake
102 else
103 domake
104 fi

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button