summaryrefslogtreecommitdiffstats
path: root/mpw-build.in
blob: 86d9530fa3b564689219d3cb2ffde4fa08a93a28 (plain)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# Top-level script fragment to build everything for MPW.

Set savedir "`Directory`"

#Set Echo 1

Set ThisScript "{0}"

Set objdir ":"

Set verify 0

Set BuildTarget "none"

# Parse arguments.

Loop
	Break If {#} == 0
		If "{BuildTarget}" =~ /none/
			Set BuildTarget "{1}"
		Else
			Echo Only one build target allowed, ignoring "{1}"
		End If
	Shift 1
End Loop

If "{BuildTarget}" =~ /none/
	Set BuildTarget "all"
End If

If {verify} == 1
	Echo "#" Doing "{ThisScript}" "{BuildTarget}" in "`Directory`" ... 
End If

Set ranmake 0

If "`Exists Makefile`" != ""
	Echo "Set Echo 1" >{BuildTarget}.makeout
	Make -f Makefile {BuildTarget} >>{BuildTarget}.makeout
	{BuildTarget}.makeout
	Delete {BuildTarget}.makeout
	Set ranmake 1
End If

If "`Exists Makefile.PPC`" != ""
	Echo "Set Echo 1" >{BuildTarget}.makeout.ppc
	Make -f Makefile.PPC {BuildTarget} >>{BuildTarget}.makeout.ppc
	{BuildTarget}.makeout.ppc
	Delete {BuildTarget}.makeout.ppc
	Set ranmake 1
End If

If {ranmake} == 1
	Exit
End If

# Dispatch on various pseudo-targets.

If "{BuildTarget}" =~ /all/
	Echo Started `Date`
	"{ThisScript}" all-gcc
	"{ThisScript}" all-gdb
	Echo Finished `Date`
Else If "{BuildTarget}" =~ /all-libiberty/
	"{ThisScript}" do-libiberty
Else If "{BuildTarget}" =~ /all-bfd/
	"{ThisScript}" do-bfd
Else If "{BuildTarget}" =~ /all-opcodes/
	"{ThisScript}" do-opcodes
Else If "{BuildTarget}" =~ /all-byacc/
	"{ThisScript}" do-byacc
Else If "{BuildTarget}" =~ /all-flex/
	"{ThisScript}" all-libiberty
	"{ThisScript}" do-flex
Else If "{BuildTarget}" =~ /all-binutils/
	"{ThisScript}" all-libiberty
	"{ThisScript}" all-bfd
	"{ThisScript}" all-opcodes
	"{ThisScript}" do-binutils
Else If "{BuildTarget}" =~ /all-gas/
	"{ThisScript}" all-libiberty
	"{ThisScript}" all-bfd
	"{ThisScript}" all-opcodes
	"{ThisScript}" do-gas
Else If "{BuildTarget}" =~ /all-gcc/
	"{ThisScript}" all-libiberty
	"{ThisScript}" all-gas
	"{ThisScript}" all-binutils
	"{ThisScript}" all-ld
	"{ThisScript}" do-gcc
Else If "{BuildTarget}" =~ /all-gdb/
	"{ThisScript}" all-libiberty
	"{ThisScript}" all-bfd
	"{ThisScript}" all-opcodes
	"{ThisScript}" do-gdb
Else If "{BuildTarget}" =~ /all-grez/
	"{ThisScript}" all-libiberty
	"{ThisScript}" all-bfd
	"{ThisScript}" do-grez
Else If "{BuildTarget}" =~ /all-ld/
	"{ThisScript}" all-libiberty
	"{ThisScript}" all-bfd
	"{ThisScript}" all-opcodes
	"{ThisScript}" do-ld
Else If "{BuildTarget}" =~ /do-byacc/
	SetDirectory :byacc:
	::mpw-build all
Else If "{BuildTarget}" =~ /do-flex/
	SetDirectory :flex:
	::mpw-build _bootstrap
	::mpw-build all
Else If "{BuildTarget}" =~ /do-bfd/
	SetDirectory :bfd:
	::mpw-build all
Else If "{BuildTarget}" =~ /do-libiberty/
	SetDirectory :libiberty:
	::mpw-build all
Else If "{BuildTarget}" =~ /do-opcodes/
	SetDirectory :opcodes:
	::mpw-build all
Else If "{BuildTarget}" =~ /do-binutils/
	SetDirectory :binutils:
	::mpw-build stamps
	::mpw-build all
Else If "{BuildTarget}" =~ /do-gas/
	SetDirectory :gas:
	::mpw-build stamps
	::mpw-build all
Else If "{BuildTarget}" =~ /do-gcc/
	SetDirectory :gcc:
	:mpw-build all
Else If "{BuildTarget}" =~ /do-gdb/
	SetDirectory :gdb:
	::mpw-build all
Else If "{BuildTarget}" =~ /do-grez/
	SetDirectory :grez:
	::mpw-build all
Else If "{BuildTarget}" =~ /do-ld/
	SetDirectory :ld:
	::mpw-build all
Else If "{BuildTarget}" =~ /do-newlib/
	SetDirectory :newlib:
	::mpw-build all
Else If "{BuildTarget}" =~ /install/
	"{ThisScript}" install-only-top
	"{ThisScript}" install-binutils
	"{ThisScript}" install-gas
	"{ThisScript}" install-gcc
	"{ThisScript}" install-ld
	"{ThisScript}" install-gdb
Else If "{BuildTarget}" =~ /install-binutils/
	SetDirectory :binutils:
	::mpw-build install
Else If "{BuildTarget}" =~ /install-gas/
	SetDirectory :gas:
	::mpw-build install
Else If "{BuildTarget}" =~ /install-gcc/
	SetDirectory :gcc:
	:mpw-build install
Else If "{BuildTarget}" =~ /install-gdb/
	SetDirectory :gdb:
	::mpw-build install
Else If "{BuildTarget}" =~ /install-grez/
	SetDirectory :grez:
	::mpw-build install
Else If "{BuildTarget}" =~ /install-ld/
	SetDirectory :ld:
	::mpw-build install
Else If "{BuildTarget}" =~ /install-only/
	"{ThisScript}" install-only-top
	"{ThisScript}" install-only-binutils
	"{ThisScript}" install-only-gas
	"{ThisScript}" install-only-gcc
	"{ThisScript}" install-only-gdb
	"{ThisScript}" install-only-ld
Else If "{BuildTarget}" =~ /install-only-binutils/
	SetDirectory :binutils:
	::mpw-build install-only
Else If "{BuildTarget}" =~ /install-only-gas/
	SetDirectory :gas:
	::mpw-build install-only
Else If "{BuildTarget}" =~ /install-only-gcc/
	SetDirectory :gcc:
	:mpw-build install-only
Else If "{BuildTarget}" =~ /install-only-gdb/
	SetDirectory :gdb:
	::mpw-build install-only
Else If "{BuildTarget}" =~ /install-only-grez/
	SetDirectory :grez:
	::mpw-build install-only
Else If "{BuildTarget}" =~ /install-only-ld/
	SetDirectory :ld:
	::mpw-build install-only
Else If "{BuildTarget}" =~ /install-only-top/
	NewFolderRecursive "{prefix}"
	If "{prefix}" != "`Directory`"
		Duplicate -y 'Read Me for MPW' "{prefix}"'Read Me for MPW'
		Duplicate -y Install "{prefix}"Install
	End If
Else
	Echo {BuildTarget} not understood, ignoring
End If

SetDirectory "{savedir}"
OpenPOWER on IntegriCloud