1--
2-- makeproj.mac
3--
4-- This AppleScript builds Code Warrior PRO Release 2 project files for the
5-- libjpeg library as well as the test programs 'cjpeg', 'djpeg', 'jpegtran'.
6-- (We'd distribute real project files, except they're not text
7-- and would create maintenance headaches.)
8--
9-- The script then compiles and links the library and the test programs.
10-- NOTE: if you haven't already created a 'jconfig.h' file, the script
11-- automatically copies 'jconfig.mac' to 'jconfig.h'.
12--
13-- To use this script, you must have AppleScript 1.1 or later installed
14-- and a suitable AppleScript editor like Script Editor or Script Debugger
15-- (http://www.latenightsw.com). Open this file with your AppleScript
16-- editor and execute the "run" command to build the projects.
17--
18-- Thanks to Dan Sears and Don Agro for this script.
19-- Questions about this script can be addressed to dogpark@interlog.com
20--
21
22on run
23
24	choose folder with prompt ">>> Select IJG source folder <<<"
25	set ijg_folder to result
26
27	choose folder with prompt ">>> Select MetroWerks folder <<<"
28	set cw_folder to result
29
30	-- if jconfig.h doesn't already exist, copy jconfig.mac
31
32	tell application "Finder"
33		if not (exists file "jconfig.h" of ijg_folder) then
34			duplicate {file "jconfig.mac" of folder ijg_folder}
35			select file "jconfig.mac copy" of folder ijg_folder
36			set name of selection to "jconfig.h"
37		end if
38	end tell
39
40	tell application "CodeWarrior IDE 2.1"
41	  with timeout of 10000 seconds
42
43		-- create libjpeg project
44
45		activate
46		Create Project (ijg_folder as string) & "libjpeg.proj"
47		Set Preferences of panel "Target Settings" to {Target Name:"libjpeg"}
48		Set Preferences of panel "PPC Project" to {File Name:"libjpeg"}
49		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
50		Set Preferences of panel "PPC Project" to {Project Type:library}
51		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
52		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
53		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
54		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
55
56		Add Files (ijg_folder as string) & "jcapimin.c" To Segment 1
57		Add Files (ijg_folder as string) & "jcapistd.c" To Segment 1
58		Add Files (ijg_folder as string) & "jctrans.c" To Segment 1
59		Add Files (ijg_folder as string) & "jcparam.c" To Segment 1
60		Add Files (ijg_folder as string) & "jdatadst.c" To Segment 1
61		Add Files (ijg_folder as string) & "jcinit.c" To Segment 1
62		Add Files (ijg_folder as string) & "jcmaster.c" To Segment 1
63		Add Files (ijg_folder as string) & "jcmarker.c" To Segment 1
64		Add Files (ijg_folder as string) & "jcmainct.c" To Segment 1
65		Add Files (ijg_folder as string) & "jcprepct.c" To Segment 1
66		Add Files (ijg_folder as string) & "jccoefct.c" To Segment 1
67		Add Files (ijg_folder as string) & "jccolor.c" To Segment 1
68		Add Files (ijg_folder as string) & "jcsample.c" To Segment 1
69		Add Files (ijg_folder as string) & "jchuff.c" To Segment 1
70		Add Files (ijg_folder as string) & "jcphuff.c" To Segment 1
71		Add Files (ijg_folder as string) & "jcdctmgr.c" To Segment 1
72		Add Files (ijg_folder as string) & "jfdctfst.c" To Segment 1
73		Add Files (ijg_folder as string) & "jfdctflt.c" To Segment 1
74		Add Files (ijg_folder as string) & "jfdctint.c" To Segment 1
75		Add Files (ijg_folder as string) & "jdapimin.c" To Segment 1
76		Add Files (ijg_folder as string) & "jdapistd.c" To Segment 1
77		Add Files (ijg_folder as string) & "jdtrans.c" To Segment 1
78		Add Files (ijg_folder as string) & "jdatasrc.c" To Segment 1
79		Add Files (ijg_folder as string) & "jdmaster.c" To Segment 1
80		Add Files (ijg_folder as string) & "jdinput.c" To Segment 1
81		Add Files (ijg_folder as string) & "jdmarker.c" To Segment 1
82		Add Files (ijg_folder as string) & "jdhuff.c" To Segment 1
83		Add Files (ijg_folder as string) & "jdphuff.c" To Segment 1
84		Add Files (ijg_folder as string) & "jdmainct.c" To Segment 1
85		Add Files (ijg_folder as string) & "jdcoefct.c" To Segment 1
86		Add Files (ijg_folder as string) & "jdpostct.c" To Segment 1
87		Add Files (ijg_folder as string) & "jddctmgr.c" To Segment 1
88		Add Files (ijg_folder as string) & "jidctfst.c" To Segment 1
89		Add Files (ijg_folder as string) & "jidctflt.c" To Segment 1
90		Add Files (ijg_folder as string) & "jidctint.c" To Segment 1
91		Add Files (ijg_folder as string) & "jidctred.c" To Segment 1
92		Add Files (ijg_folder as string) & "jdsample.c" To Segment 1
93		Add Files (ijg_folder as string) & "jdcolor.c" To Segment 1
94		Add Files (ijg_folder as string) & "jquant1.c" To Segment 1
95		Add Files (ijg_folder as string) & "jquant2.c" To Segment 1
96		Add Files (ijg_folder as string) & "jdmerge.c" To Segment 1
97		Add Files (ijg_folder as string) & "jcomapi.c" To Segment 1
98		Add Files (ijg_folder as string) & "jutils.c" To Segment 1
99		Add Files (ijg_folder as string) & "jerror.c" To Segment 1
100		Add Files (ijg_folder as string) & "jmemmgr.c" To Segment 1
101		Add Files (ijg_folder as string) & "jmemmac.c" To Segment 1
102
103		-- compile and link the library
104
105		Make Project
106		Close Project
107
108		-- create cjpeg project
109
110		activate
111		Create Project (ijg_folder as string) & "cjpeg.proj"
112		Set Preferences of panel "Target Settings" to {Target Name:"cjpeg"}
113		Set Preferences of panel "PPC Project" to {File Name:"cjpeg"}
114		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
115		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
116		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
117		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
118		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
119
120		Add Files (ijg_folder as string) & "cjpeg.c" To Segment 1
121		Add Files (ijg_folder as string) & "rdppm.c" To Segment 1
122		Add Files (ijg_folder as string) & "rdgif.c" To Segment 1
123		Add Files (ijg_folder as string) & "rdtarga.c" To Segment 1
124		Add Files (ijg_folder as string) & "rdrle.c" To Segment 1
125		Add Files (ijg_folder as string) & "rdbmp.c" To Segment 1
126		Add Files (ijg_folder as string) & "rdswitch.c" To Segment 1
127		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
128
129		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
130
131		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
132		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
133		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
134
135		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
136		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
137
138		-- compile and link cjpeg
139
140		Make Project
141		Close Project
142
143		-- create djpeg project
144
145		activate
146		Create Project (ijg_folder as string) & "djpeg.proj"
147		Set Preferences of panel "Target Settings" to {Target Name:"djpeg"}
148		Set Preferences of panel "PPC Project" to {File Name:"djpeg"}
149		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
150		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
151		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
152		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
153		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
154
155		Add Files (ijg_folder as string) & "djpeg.c" To Segment 1
156		Add Files (ijg_folder as string) & "wrppm.c" To Segment 1
157		Add Files (ijg_folder as string) & "wrgif.c" To Segment 1
158		Add Files (ijg_folder as string) & "wrtarga.c" To Segment 1
159		Add Files (ijg_folder as string) & "wrrle.c" To Segment 1
160		Add Files (ijg_folder as string) & "wrbmp.c" To Segment 1
161		Add Files (ijg_folder as string) & "rdcolmap.c" To Segment 1
162		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
163
164		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
165
166		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
167		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
168		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
169
170		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
171		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
172
173		-- compile and link djpeg
174
175		Make Project
176		Close Project
177
178		-- create jpegtran project
179
180		activate
181		Create Project (ijg_folder as string) & "jpegtran.proj"
182		Set Preferences of panel "Target Settings" to {Target Name:"jpegtran"}
183		Set Preferences of panel "PPC Project" to {File Name:"jpegtran"}
184		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
185		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
186		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
187		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
188		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
189
190		Add Files (ijg_folder as string) & "jpegtran.c" To Segment 1
191		Add Files (ijg_folder as string) & "rdswitch.c" To Segment 1
192		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
193		Add Files (ijg_folder as string) & "transupp.c" To Segment 1
194
195		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
196
197		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
198		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
199		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
200
201		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
202		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
203
204		-- compile and link jpegtran
205
206		Make Project
207		Close Project
208
209		quit
210
211	  end timeout
212	end tell
213end run
214