kusano 7d535a
--
kusano 7d535a
-- makeproj.mac
kusano 7d535a
--
kusano 7d535a
-- This AppleScript builds Code Warrior PRO Release 2 project files for the
kusano 7d535a
-- libjpeg library as well as the test programs 'cjpeg', 'djpeg', 'jpegtran'.
kusano 7d535a
-- (We'd distribute real project files, except they're not text
kusano 7d535a
-- and would create maintenance headaches.)
kusano 7d535a
--
kusano 7d535a
-- The script then compiles and links the library and the test programs.
kusano 7d535a
-- NOTE: if you haven't already created a 'jconfig.h' file, the script
kusano 7d535a
-- automatically copies 'jconfig.mac' to 'jconfig.h'.
kusano 7d535a
--
kusano 7d535a
-- To use this script, you must have AppleScript 1.1 or later installed
kusano 7d535a
-- and a suitable AppleScript editor like Script Editor or Script Debugger
kusano 7d535a
-- (http://www.latenightsw.com). Open this file with your AppleScript
kusano 7d535a
-- editor and execute the "run" command to build the projects.
kusano 7d535a
--
kusano 7d535a
-- Thanks to Dan Sears and Don Agro for this script.
kusano 7d535a
-- Questions about this script can be addressed to dogpark@interlog.com
kusano 7d535a
--
kusano 7d535a
kusano 7d535a
on run
kusano 7d535a
kusano 7d535a
	choose folder with prompt ">>> Select IJG source folder <<<"
kusano 7d535a
	set ijg_folder to result
kusano 7d535a
kusano 7d535a
	choose folder with prompt ">>> Select MetroWerks folder <<<"
kusano 7d535a
	set cw_folder to result
kusano 7d535a
kusano 7d535a
	-- if jconfig.h doesn't already exist, copy jconfig.mac
kusano 7d535a
kusano 7d535a
	tell application "Finder"
kusano 7d535a
		if not (exists file "jconfig.h" of ijg_folder) then
kusano 7d535a
			duplicate {file "jconfig.mac" of folder ijg_folder}
kusano 7d535a
			select file "jconfig.mac copy" of folder ijg_folder
kusano 7d535a
			set name of selection to "jconfig.h"
kusano 7d535a
		end if
kusano 7d535a
	end tell
kusano 7d535a
kusano 7d535a
	tell application "CodeWarrior IDE 2.1"
kusano 7d535a
	  with timeout of 10000 seconds
kusano 7d535a
kusano 7d535a
		-- create libjpeg project
kusano 7d535a
kusano 7d535a
		activate
kusano 7d535a
		Create Project (ijg_folder as string) & "libjpeg.proj"
kusano 7d535a
		Set Preferences of panel "Target Settings" to {Target Name:"libjpeg"}
kusano 7d535a
		Set Preferences of panel "PPC Project" to {File Name:"libjpeg"}
kusano 7d535a
		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
kusano 7d535a
		Set Preferences of panel "PPC Project" to {Project Type:library}
kusano 7d535a
		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
kusano 7d535a
		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
kusano 7d535a
		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
kusano 7d535a
		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
kusano 7d535a
kusano 7d535a
		Add Files (ijg_folder as string) & "jaricom.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcapimin.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcapistd.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcarith.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jctrans.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcparam.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdatadst.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcinit.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcmaster.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcmarker.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcmainct.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcprepct.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jccoefct.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jccolor.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcsample.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jchuff.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcdctmgr.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jfdctfst.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jfdctflt.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jfdctint.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdapimin.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdapistd.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdarith.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdtrans.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdatasrc.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdmaster.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdinput.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdmarker.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdhuff.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdmainct.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdcoefct.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdpostct.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jddctmgr.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jidctfst.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jidctflt.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jidctint.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdsample.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdcolor.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jquant1.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jquant2.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jdmerge.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jcomapi.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jutils.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jerror.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jmemmgr.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "jmemmac.c" To Segment 1
kusano 7d535a
kusano 7d535a
		-- compile and link the library
kusano 7d535a
kusano 7d535a
		Make Project
kusano 7d535a
		Close Project
kusano 7d535a
kusano 7d535a
		-- create cjpeg project
kusano 7d535a
kusano 7d535a
		activate
kusano 7d535a
		Create Project (ijg_folder as string) & "cjpeg.proj"
kusano 7d535a
		Set Preferences of panel "Target Settings" to {Target Name:"cjpeg"}
kusano 7d535a
		Set Preferences of panel "PPC Project" to {File Name:"cjpeg"}
kusano 7d535a
		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
kusano 7d535a
		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
kusano 7d535a
		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
kusano 7d535a
		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
kusano 7d535a
		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
kusano 7d535a
kusano 7d535a
		Add Files (ijg_folder as string) & "cjpeg.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "rdppm.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "rdgif.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "rdtarga.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "rdrle.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "rdbmp.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "rdswitch.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
kusano 7d535a
kusano 7d535a
		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
kusano 7d535a
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
kusano 7d535a
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
kusano 7d535a
kusano 7d535a
		-- compile and link cjpeg
kusano 7d535a
kusano 7d535a
		Make Project
kusano 7d535a
		Close Project
kusano 7d535a
kusano 7d535a
		-- create djpeg project
kusano 7d535a
kusano 7d535a
		activate
kusano 7d535a
		Create Project (ijg_folder as string) & "djpeg.proj"
kusano 7d535a
		Set Preferences of panel "Target Settings" to {Target Name:"djpeg"}
kusano 7d535a
		Set Preferences of panel "PPC Project" to {File Name:"djpeg"}
kusano 7d535a
		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
kusano 7d535a
		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
kusano 7d535a
		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
kusano 7d535a
		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
kusano 7d535a
		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
kusano 7d535a
kusano 7d535a
		Add Files (ijg_folder as string) & "djpeg.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "wrppm.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "wrgif.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "wrtarga.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "wrrle.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "wrbmp.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "rdcolmap.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
kusano 7d535a
kusano 7d535a
		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
kusano 7d535a
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
kusano 7d535a
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
kusano 7d535a
kusano 7d535a
		-- compile and link djpeg
kusano 7d535a
kusano 7d535a
		Make Project
kusano 7d535a
		Close Project
kusano 7d535a
kusano 7d535a
		-- create jpegtran project
kusano 7d535a
kusano 7d535a
		activate
kusano 7d535a
		Create Project (ijg_folder as string) & "jpegtran.proj"
kusano 7d535a
		Set Preferences of panel "Target Settings" to {Target Name:"jpegtran"}
kusano 7d535a
		Set Preferences of panel "PPC Project" to {File Name:"jpegtran"}
kusano 7d535a
		Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
kusano 7d535a
		Set Preferences of panel "C/C++ Compiler" to {ANSI Strict:true}
kusano 7d535a
		Set Preferences of panel "C/C++ Compiler" to {Enums Always Ints:true}
kusano 7d535a
		Set Preferences of panel "PPC Codegen" to {Struct Alignment:PowerPC}
kusano 7d535a
		Set Preferences of panel "PPC Linker" to {Generate SYM File:false}
kusano 7d535a
kusano 7d535a
		Add Files (ijg_folder as string) & "jpegtran.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "rdswitch.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "cdjpeg.c" To Segment 1
kusano 7d535a
		Add Files (ijg_folder as string) & "transupp.c" To Segment 1
kusano 7d535a
kusano 7d535a
		Add Files (ijg_folder as string) & "libjpeg" To Segment 2
kusano 7d535a
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL C.PPC.Lib" To Segment 3
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:Metrowerks Standard Library:MSL C:Bin:MSL SIOUX.PPC.Lib" To Segment 3
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.Lib" To Segment 3
kusano 7d535a
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:InterfaceLib" To Segment 4
kusano 7d535a
		Add Files (cw_folder as string) & "Metrowerks CodeWarrior:MacOS Support:Libraries:MacOS Common:MathLib" To Segment 4
kusano 7d535a
kusano 7d535a
		-- compile and link jpegtran
kusano 7d535a
kusano 7d535a
		Make Project
kusano 7d535a
		Close Project
kusano 7d535a
kusano 7d535a
		quit
kusano 7d535a
kusano 7d535a
	  end timeout
kusano 7d535a
	end tell
kusano 7d535a
end run