2 # Copyright (C) 1994, 1995 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 ### This script (and mpw-config.in fragments) must NOT use any 8-bit chars!
22 # This is an MPW Shell script that sets everything up for compilation,
23 # mainly creating directories, and editing copies of files.
25 Set savedir "`Directory`"
31 Set srcroot "--------"
37 Set prefix "{MPW}":GNUTools:
41 Set host_alias "m68k-apple-mpw"
43 Set target_alias {host_alias}
59 Else If "{1}" =~ /--enable/
62 Else If "{1}" =~ /--exec-prefix/
65 Else If "{1}" =~ /--host/
68 Else If "{1}" =~ /--prefix/
71 Else If "{1}" =~ /--srcdir/
74 Else If "{1}" =~ /--srcroot/
77 Else If "{1}" =~ /--target/
78 Set target_alias "{2}"
83 Else If "{1}" =~ /--with-gnu-ld/
86 Echo "{1}" is not a valid argument
94 # Default exec_prefix from prefix.
96 If "{exec_prefix}" == ""
97 Set exec_prefix "{prefix}"
100 # Point to the correct set of tools to use with the chosen compiler.
102 If "{host_cc}" =~ /mpwc/
103 Set host_alias "m68k-apple-mpw"
104 Set cc_name '{CC_MPW_C}'
105 Set segment_flag '-s {Default}'
106 Set ar_name '{AR_LIB}'
107 Set ranlib_name '{RANLIB_NULL}'
108 Set cc_ld_name '{CC_LD_LINK}'
109 Set prog_ext_name '{PROG_EXT_68K}'
110 Set extralibs_name '{EXTRALIBS_C}'
111 Set makepef_name '{MAKEPEF_NULL}'
112 Set rez_name '{REZ_68K}'
113 Else If "{host_cc}" =~ /sc68k/
114 Set host_alias "m68k-apple-mpw"
115 Set cc_name '{CC_SC}'
116 Set segment_flag '-s {Default}'
117 Set ar_name '{AR_LIB}'
118 Set ranlib_name '{RANLIB_NULL}'
119 Set cc_ld_name '{CC_LD_LINK}'
120 Set prog_ext_name '{PROG_EXT_68K}'
121 Set extralibs_name '{EXTRALIBS_C}'
122 Set makepef_name '{MAKEPEF_NULL}'
123 Set rez_name '{REZ_68K}'
124 Else If "{host_cc}" =~ /mwc68k/
125 Set host_alias "m68k-apple-mpw"
126 Set cc_name '{CC_MWC68K}'
127 Set segment_flag '-s {Default}'
128 Set ar_name '{AR_MWLINK68K}'
129 Set ranlib_name '{RANLIB_NULL}'
130 Set cc_ld_name '{CC_LD_MWLINK68K}'
131 Set prog_ext_name '{PROG_EXT_68K}'
132 Set extralibs_name '{EXTRALIBS_C}'
133 Set makepef_name '{MAKEPEF_NULL}'
134 Set rez_name '{REZ_PPC}'
135 Else If "{host_cc}" =~ /gcc68k/
136 Set host_alias "m68k-apple-mpw"
137 Set cc_name '{CC_68K_GCC}'
138 Set segment_flag '-s {Default}'
139 Set ar_name '{AR_68K_AR}'
140 Set ranlib_name '{RANLIB_RANLIB}'
141 Set cc_ld_name '{CC_68K_GCC}'
142 Set prog_ext_name '{PROG_EXT_68K}'
143 Set extralibs_name '{EXTRALIBS_C}'
144 Set makepef_name '{MAKEPEF_NULL}'
145 Set rez_name '{REZ_68K}'
146 Else If "{host_cc}" =~ /ppcc/
147 Set host_alias "powerpc-apple-mpw"
148 Set cc_name '{CC_PPCC}'
150 Set ar_name '{AR_PPCLINK}'
151 Set ranlib_name '{RANLIB_NULL}'
152 Set cc_ld_name '{CC_LD_PPCLINK}'
153 Set prog_ext_name '{PROG_EXT_XCOFF}'
154 Set extralibs_name '{EXTRALIBS_PPC}'
155 Set makepef_name '{MAKEPEF_PPC}'
156 Set rez_name '{REZ_PPC}'
157 Else If "{host_cc}" =~ /mrc/
158 Set host_alias "powerpc-apple-mpw"
159 Set cc_name '{CC_MRC}'
161 Set ar_name '{AR_PPCLINK}'
162 Set ranlib_name '{RANLIB_NULL}'
163 Set cc_ld_name '{CC_LD_PPCLINK}'
164 Set prog_ext_name '{PROG_EXT_XCOFF}'
165 Set extralibs_name '{EXTRALIBS_PPC}'
166 Set makepef_name '{MAKEPEF_PPC}'
167 Set rez_name '{REZ_PPC}'
168 Else If "{host_cc}" =~ /scppc/
169 Set host_alias "powerpc-apple-mpw"
170 Set cc_name '{CC_SC}'
172 Set ar_name '{AR_PPCLINK}'
173 Set ranlib_name '{RANLIB_NULL}'
174 Set cc_ld_name '{CC_LD_PPCLINK}'
175 Set prog_ext_name '{PROG_EXT_XCOFF}'
176 Set extralibs_name '{EXTRALIBS_PPC}'
177 Set makepef_name '{MAKEPEF_PPC}'
178 Set rez_name '{REZ_PPC}'
179 Else If "{host_cc}" =~ /mwcppc/
180 Set host_alias "powerpc-apple-mpw"
181 Set cc_name '{CC_MWCPPC}'
183 Set ar_name '{AR_MWLINKPPC}'
184 Set ranlib_name '{RANLIB_NULL}'
185 Set cc_ld_name '{CC_LD_MWLINKPPC}'
186 # Misleading, but we don't need a PEF step.
187 Set prog_ext_name '{PROG_EXT_68K}'
188 Set extralibs_name '{EXTRALIBS_MWCPPC}'
189 Set makepef_name '{MAKEPEF_NULL}'
190 Set rez_name '{REZ_PPC}'
191 Else If "{host_cc}" =~ /gccppc/
192 Set host_alias "powerpc-apple-mpw"
193 Set cc_name '{CC_PPC_GCC}'
195 Set ar_name '{AR_PPCLINK}'
196 Set ranlib_name '{RANLIB_RANLIB}'
197 If {with_gnu_ld} == 1
198 Set cc_ld_name '{CC_LD_GLD}'
200 Set cc_ld_name '{CC_LD_PPCLINK}'
202 Set prog_ext_name '{PROG_EXT_XCOFF}'
203 Set extralibs_name '{EXTRALIBS_PPC}'
204 Set makepef_name '{MAKEPEF_PPC}'
205 Set rez_name '{REZ_PPC}'
207 Echo "{host_cc}" is not a known MPW compiler type
210 # (should interpret aliases if not in canonical form)
212 Set host_canonical "{host_alias}"
214 Set target_canonical "{target_alias}"
218 If "{srcroot}" =~ /--------/
219 Set srcroot "{srcdir}"
221 If "`Exists "{srcdir}"`" == ""
222 Echo Source directory {srcdir} does not exist!
225 If "`Exists "{srcroot}"`" == ""
226 Echo Top-level source directory {srcroot} does not exist!
230 Set target_cpu "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\1/'`"
231 Set target_vendor "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\2/'`"
232 Set target_os "`echo {target_canonical} | sed 's/^\(.*\)-\(.*\)-\(.*\)$/\3/'`"
234 # Create a file that is guaranteed to be older than any other here.
236 If "`Exists "{objdir}"_oldest`" == ""
240 # Record this before creating any files, makefiles sometimes mention
241 # dependencies on config.status.
243 Echo "# This directory was configured as follows:" >config.new
244 Echo "{ThisScript} --host {host_alias} --target {target_alias} --srcdir {srcdir} --srcroot {srcroot} --prefix {prefix} --cc {host_cc}" >>config.new
245 MoveIfChange config.new config.status
247 If "`Exists "{srcdir}"mpw-config.in`" != ""
248 tr-7to8 "{srcdir}"mpw-config.in >"{objdir}"mpw-config.in
249 Execute "{objdir}"mpw-config.in
252 # Start Makefile construction by defining all the variables chosen by
255 Echo "# This Makefile produced by mpw-configure. Changes may get lost!" > "{objdir}"Makefile.tem
256 Echo "srcroot = " {srcroot} >> "{objdir}"Makefile.tem
257 Echo "topsrcdir = " {srcroot} >> "{objdir}"Makefile.tem
258 Echo "srcdir = " {srcdir} >> "{objdir}"Makefile.tem
259 Echo "mpw_prefix = " {prefix} >> "{objdir}"Makefile.tem
260 Echo "mpw_exec_prefix = " {exec_prefix} >> "{objdir}"Makefile.tem
261 Echo "host_alias = " {host_alias} >> "{objdir}"Makefile.tem
262 Echo "target_alias = " {target_alias} >> "{objdir}"Makefile.tem
263 Echo "target_cpu = " {target_cpu} >> "{objdir}"Makefile.tem
264 Echo "target_vendor = " {target_vendor} >> "{objdir}"Makefile.tem
265 Echo "target_os = " {target_os} >> "{objdir}"Makefile.tem
266 Echo "target_canonical = " {target_canonical} >> "{objdir}"Makefile.tem
267 Echo "host_makefile_frag = " >> "{objdir}"Makefile.tem
268 Echo "target_makefile_frag = " >> "{objdir}"Makefile.tem
269 Echo "CC = " {cc_name} >> "{objdir}"Makefile.tem
270 Echo "AR = " {ar_name} >> "{objdir}"Makefile.tem
271 Echo "RANLIB = " {ranlib_name} >> "{objdir}"Makefile.tem
272 Echo "CC_LD = " {cc_ld_name} >> "{objdir}"Makefile.tem
273 Echo "PROG_EXT = " {prog_ext_name} >> "{objdir}"Makefile.tem
274 Echo "EXTRALIBS = " {extralibs_name} >> "{objdir}"Makefile.tem
275 Echo "MAKEPEF = " {makepef_name} >> "{objdir}"Makefile.tem
276 Echo "REZ = " {rez_name} >> "{objdir}"Makefile.tem
278 # Append the master set of definitions for the various compilers.
280 If "`Exists "{srcdir}"config:mpw-mh-mpw`" != ""
281 tr-7to8 "{srcdir}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
282 Else If "`Exists "{srcroot}"config:mpw-mh-mpw`" != ""
283 tr-7to8 "{srcroot}"config:mpw-mh-mpw >>"{objdir}"Makefile.tem
285 Echo "can't find a host config file!"
289 # Append anything produced by the directory's mpw-config.in.
291 If "`Exists "{objdir}"mk.tmp`" != ""
292 Catenate "{objdir}"mk.tmp >>"{objdir}"Makefile.tem
293 # An mpw-config.in might change so as not to create this
294 # anymore, so get rid of it now to be safe.
295 Delete -i -y "{objdir}"mk.tmp
298 # If there are sed scripts to edit the Unix Makefile.in, use them; otherwise
299 # use an mpw-make.in if present.
301 If "`Exists "{srcdir}"mpw-make.sed`" != ""
302 If "`Exists "{objdir}"hacked_Makefile.in`" != ""
303 Set MakefileIn "{objdir}"hacked_Makefile.in
305 Set MakefileIn "{srcdir}"Makefile.in
307 If "`Exists "{srcroot}"utils:mpw:g-mpw-make.sed`" != ""
308 sed -f "{srcroot}"utils:mpw:g-mpw-make.sed "{MakefileIn}" >"{objdir}"Makefile.tem1
310 Catenate "{MakefileIn}" >"{objdir}"Makefile.tem1
312 sed -f "{srcdir}"mpw-make.sed "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2
313 sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' -e 's/^exec_prefix = .*$/exec_prefix = {mpw_exec_prefix}/g' "{objdir}"Makefile.tem2 >"{objdir}"Makefile.tem3
314 sed -e "s/@SEGMENT_FLAG@/{segment_flag}/" "{objdir}"Makefile.tem3 >"{objdir}"mpw-make.in
315 tr-7to8 "{objdir}"mpw-make.in >>"{objdir}"Makefile.tem
316 MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
317 Delete -i -y "{objdir}"Makefile.tem[12]
319 Echo Created Makefile in "`Directory`"
321 Else If "`Exists "{srcdir}"mpw-make.in`" != ""
322 sed -e 's/^prefix = .*$/prefix = {mpw_prefix}/g' "{srcdir}"mpw-make.in >"{objdir}"Makefile.tem1
323 sed -e "s/@SEGMENT_FLAG@/{segment_flag}/" "{objdir}"Makefile.tem1 >"{objdir}"Makefile.tem2
324 tr-7to8 "{objdir}"Makefile.tem2 >>"{objdir}"Makefile.tem
325 MoveIfChange "{objdir}"Makefile.tem "{objdir}"Makefile
326 Delete -i -y "{objdir}"Makefile.tem[12]
328 Echo Created Makefile in "`Directory`"
332 # Produce a build script if the source is defined.
334 If "`Exists "{srcdir}"mpw-build.in`" != ""
335 Echo "Set srcroot " {srcroot} > "{objdir}"mpw-build.tem
336 Echo "Set srcdir " {srcdir} >> "{objdir}"mpw-build.tem
337 Echo "Set target_canonical " {target_canonical} >> "{objdir}"mpw-build.tem
338 Echo "Set prefix " {prefix} >> "{objdir}"mpw-build.tem
339 tr-7to8 "{srcdir}"mpw-build.in >>"{objdir}"mpw-build.tem
340 MoveIfChange "{objdir}"mpw-build.tem "{objdir}"mpw-build
342 Echo Created mpw-build in "`Directory`"
346 For subdir In {configdirs}
347 Set savedir "`Directory`"
348 If "`Exists "{srcdir}{subdir}:"`" == ""
349 Echo Strange, no {subdir} in {srcdir}
353 Echo Configuring {subdir}...
355 If "`Exists "{objdir}{subdir}:"`" == ""
356 NewFolder "{objdir}{subdir}"
358 SetDirectory "{objdir}{subdir}:"
359 "{ThisScript}" --target "{target_canonical}" --srcdir "{srcdir}{subdir}:" --srcroot "{srcroot}" --prefix "{prefix}" --cc "{host_cc}" {verifystr}
360 SetDirectory "{savedir}"
363 SetDirectory "{savedir}"