-- C libs -- -- -- Properties -- property pUsingCPlusPlus : false property pProjectFileExtension : ".mcp" -- Whether to recreate existing project files. property pAlwaysCreateProjects : false property pBuildObsoleteLibraries : false -- Which targets to create. -- If these are changed you must recreate the project files. There is no direct effect on building. property pCreateBlueTargets : true -- 'Blue' was the codename for System 7. Here, it means pre-Carbon. property pCreateCarbonTargets : true property pCreateDebugTargets : true property pCreateOptimizedTargets : true -- Whether to compile everything. property pShouldBuild : true property pDirsToCreate : {¬ {relPath:"", name:"include"}, ¬ {relPath:"", name:"ctools"}, ¬ {relPath:"", name:"lib"}} property pDebugPrefix : "" property pReleasePrefix : "" property pLinkExecutables : false -- -- Routines specific to this project -- on ProjectData(projName, features, fileData) if (count characters of projName) > 18 then set projName to characters 1 through 18 of projName as string end if tell application "CodeWarrior IDE 4.2.5" if features does not contain "C" and features does not contain "C++" then --error "Project " & projName & "'s default language (a feature) must be C or C++." copy "C" to end of features end if set myFeatures to features --copy "BNDL" to end of myFeatures return {name:projName, features:myFeatures, rsrcs:{}, settings:¬ {Prefix File:"", ppcProject:{}}, projLibs:{}, sysPaths:{}, fileData:¬ fileData} end tell end ProjectData on SimpleProjectData(projName, features, section, fileList) set myPath to section & ":" return ProjectData(projName, features, {{projPath:myPath, fileList:fileList}}) end SimpleProjectData on AddSimpleProject(projName, features, section, fileList) AddProject(SimpleProjectData(projName, features, section, fileList)) end AddSimpleProject on DataPlusPrefixFile(dataRec, prefix) tell application "CodeWarrior IDE 4.2.5" set the Prefix File of dataRec's settings to prefix return dataRec end tell end DataPlusPrefixFile on SetProjectData() AddSimpleProject("mitsock", {}, "connect:mitsock", ¬ {"OTSocketInternal", "OTErrno", "OTSockets", "OTidle", "OTNetdbServices", "OTnetdb"}) AddProject(ProjectData("ncbi", {}, {¬ ¬ {projPath:"corelib:", fileList:{¬ "ncbibs", "ncbienv", "ncbierr", "ncbifile", "ncbimath", "ncbimem", "ncbimisc", ¬ "ncbimsg", "ncbiprop", "ncbisgml", "ncbistr", "ncbitime", "ncbilang", "gifgen", ¬ "togif", "ncbithr", "tsprintf", "tree", "wwwutils", "matrix", "binary", "regex.c"}}, ¬ ¬ {projPath:"connect:", fileList:{¬ "ncbibuf", "ncbisock", "connection", "urlquery"}}, ¬ ¬ {projPath:"ctools:", fileList:{¬ "asn_connection"}}, ¬ ¬ {projPath:"asnlib:", fileList:{¬ "asnbufo", "asndebin", "asnenbin", "asngen", "asngenob", "asnio", "asnlex", ¬ "asnlext", "asnout", "asnprint", "asntypes"}}})) AddSimpleProject("ncbiconn", {}, "connect", ¬ {"ncbi_buffer", "ncbi_socket_", "ncbi_core", "ncbi_util", "ncbi_priv", "ncbi_ansi_ext", ¬ "ncbi_connection", "ncbi_connector", "ncbi_connutil", "ncbi_file_connector", ¬ "ncbi_http_connector", "ncbi_server_info", "ncbi_service", "ncbi_service_connector", ¬ "ncbi_service_dispd", "ncbi_service_lbsmd_stub", "ncbi_socket_connector", ¬ "ncbi_sendmail_"}) AddProject(ProjectData("ncbiobj", {}, {¬ ¬ {projPath:"object:", fileList:{¬ "objacces", "objalign", "objall", "objbibli", "objblock", "objcode", "objfdef", ¬ "objfeat", "objgen", "objloc", "objmdrs", "objmedli", "objproj", ¬ "objprt", "objpub", "objpubme", "objres", "objseq", "objsset", "objalignloc", ¬ "objsub"}}, ¬ ¬ {projPath:"access:", fileList:{¬ "objent2", "ent2api", "pmfapi", "strucapi", "qblastapi", "vecscnapi", "objmim", ¬ "mimapi"}}, ¬ ¬ {projPath:"api:", fileList:{¬ "asn2ff1", "asn2ff2", "asn2ff3", "asn2ff4", "asn2ff5", "asn2ff6", "asn2gnbk", "codon", ¬ "edutil", "ffprint", "findrepl", "ftusrstr", "gather", "gbfeat", "gbftglob", "gbparint", ¬ "jzcoll", "jzmisc", "lsqfetch", "maputil", "mconsist", "objmgr", "prtutil", "satutil", ¬ "seqmgr", "seqport", "sequtil", "simple", "sqnutil1", "sqnutil2", "sqnutil3", ¬ "subutil", "tofasta", "tofile", "tomedlin", "utilpars", "utilpub", "salpstat", ¬ "salpedit", "valid", "alignmgr", "alignmgr2", "aliparse", "aliread", "alignval", "wprint", ¬ "salpacc", "salprop", "salsap", "salstruc", "salutil", "udvseq", "blocks", ¬ "pgppop", "samutil", "ddvcolor", "viewmgr", "jsavlt", "needleman", "fdlobj", "txalign"}}, ¬ ¬ {projPath:"ddv:", fileList:{¬ "ddvcreate"}}})) AddSimpleProject("ncbicdr", {}, "cdromlib", ¬ {"casn", "cdconfig", "cdentrez", "cdnewlib", "cdromlib", "objentr"}) AddSimpleProject("vibrant", {}, "vibrant", ¬ {"ncbidraw", "vibbutns", "vibextra", "vibfiles", "vibforms", "vibgroup", "viblists", ¬ "vibmenus", "vibprmpt", "vibsbars", "vibslate", "vibtexts", "vibutils", ¬ "vibwndws", "document", "drawing", "mapping", "palette", "picture", "table", ¬ "viewer", "diagnost", "image", "pictur3d", "prim3d1", "prim3d2", "prim3d3", ¬ "prim3d4", "prim3d5", "viewer3d", "vibmouse", "imagelst", "treeview", "shim3d", ¬ "odlbox"}) AddSimpleProject("ncbidesk", {}, "desktop", ¬ {"asn2graphic", "biosrc", "bspview", "cdrgn", "dlgutil1", "dlgutil2", "dotmatrx", "drawseq", ¬ "e2trmlst", "e2docsum", "fea2seg", "fstyle", "glbpic", "gbfview", "gphview", "gphdraw", ¬ "gxydraw", "gtrdraw", "ingengraph", "ingenext", "ingenwin", "import", "layout", "mapgene", ¬ "medview", "prtgene", "pubdesc", "saldist", "saled", "salfiles", "salpanel", "salparam", ¬ "salsa", "seqsub", "seqfltr", "seqgraph", "seqgrphx", "seqmtrx", "seqpcc", "seqanal", ¬ "aacomp", "seqscrl", "smdlg1", "smdlg2", "smdlg3", "smtools", "styleman", "stylemui", ¬ "vsm", "vsmfile", "vsmutil", "udvgraph", "udvopen", "udvpanel", "salogif", ¬ "dotvibrant"}) AddSimpleProject("ddvlib", {}, "ddv", ¬ {"ddvclick", "ddvgraph", "ddvopen", "ddvpanel"}) if pBuildObsoleteLibraries then AddSimpleProject("ncbicacc", {}, "cdromlib", ¬ {"accentr", "accutils", "accmmdbs", "acccn3ds"}) AddProject(DataPlusPrefixFile(ProjectData("vibgif", {}, {¬ ¬ {projPath:"gif:", fileList:{¬ "gdfontg", "gdfontl", "gdfontmb", "gdfonts", "gdfontt", "pictogif"}}, ¬ ¬ {projPath:"vibrant:", fileList:{¬ "ncbidraw", "drawing", "mapping", "picture"}}}), "gif.pfx")) end if AddSimpleProject("ncbitool", {}, "tools", ¬ {"csim", "db_slist", "dust", "falign", "g_any", "pobutil", "stsutil", "sec", "sim2", ¬ "sim3", "sim4", "simutil", "slist", "suggadj", "suggest", "suggslp", "tfuns", ¬ "toasn3", "toporg", "blast", "blastutl", "blastool", "splutil", "actutils", "gapxdrop", ¬ "bandalg0", "bandalg1", "bandalg2", "bandalg3", "bandalg4", "bandalg5", ¬ "bandalgn", "blastkar", "lookup", "posit", "readdb", "ncbisam", "ncbisort", "salign", ¬ "salptool", "urkutil", "urkpcc", "urkptpf", "urkepi", "urkfltr", "urkdust", ¬ "urksigu", "seg", "urkbias", "urkcnsrt", "urktree", "pattern1", "pseed3", ¬ "impatool", "posit2", "newkar", "mbalign", "mblast", "vecscrn", ¬ "rpsutil", "kappa", "xmlblast", "bxmlobj", "dotseq", "spidey", "motif"}) AddProject(DataPlusPrefixFile(ProjectData("ncbimmdb", {}, {¬ ¬ {projPath:"biostruc:", fileList:{¬ "corematx", "dvncode", "objmmdb1", "objmmdb2", "objmmdb3", "mmdbapi", ¬ "mmdbapi1", "mmdbapi2", "mmdbapi3", "mmdbapi4", "mmdbentr", "vastsubs", ¬ "prunebsc"}}, ¬ ¬ {projPath:"object:", fileList:{¬ "objmime"}}, ¬ ¬ {projPath:"biostruc:cn3d:", fileList:{¬ "objcn3d"}}, ¬ ¬ {projPath:"biostruc:cdd:", fileList:{¬ "objcdd", "cddutil", "cddposutil", ¬ "thrdalgs", "thrdatd", "thrdbwfi", "thrdcpal", ¬ "thrdcpll", "thrdcprl", "thrdcxei", "thrddgri", "thrdrsmp", ¬ "thrdsal0", "thrdsalr", "thrdsalu", "thrdsgoi", "thrdslo0", ¬ "thrdslor", "thrdslou", "thrdspci", "thrdspea", "thrdspel", ¬ "thrdspni", "thrdttb0", "thrdttbi", "thrdzsc"}}}), "gif.pfx")) AddSimpleProject("ncbicn3d", {}, "cn3d", ¬ {"algorend", "cn3dwin", "cn3dentr", "cn3dmsel", "cn3dopen", "cn3dsave", ¬ "cn3dxprt", "cn3dmsg", "cn3dmatn", "cn3dmodl", "cn3dshim", "cn3dmesh", ¬ "cn3dstyl", "seqcons"}) AddSimpleProject("ncbiNacc", {}, "cdromlib", ¬ {"accentr", "accutils", "accmmdbs", "acccn3ds"}) AddSimpleProject("netentr", {}, "network:entrez:client", ¬ {"netentr", "netlib", "objneten"}) AddSimpleProject("netcli", {}, "network:nsclilib", ¬ {"ncbicli", "ncbiurl", "ni_disp", "ni_encrs", "ni_serv", "ni_error", "ni_lib_", ¬ "ni_macdv", "ni_msg", "ni_www", "ni_debug"}) AddSimpleProject("ncbibls3", {}, "network:blast3:client", ¬ {"netblap3", "objblst3"}) AddSimpleProject("ncbiid1", {}, "network:id1arch", ¬ {"id1gen", "id1arch", "accid1"}) AddSimpleProject("ncbimla", {}, "network:medarch:client", ¬ {"medarch", "medutil", "objmla"}) AddProject(DataPlusPrefixFile(ProjectData("ncbitxc2", {}, {¬ ¬ {projPath:"network:taxon1:taxon2:", fileList:{¬ "parttree", "taxcs", "tc2proc", "txcdproc"}}, ¬ ¬ {projPath:"network:taxon1:common:", fileList:{¬ "objtax1", "taxutil"}}}), "tax2.pfx")) AddSimpleProject("vibnet", {}, "network:vibnet", ¬ {"netcnfg", "trmlst", "docsum"}) end SetProjectData on CopyHeaders() tell application "Finder" set corelibFolder to folder (my ModuleRoot() & "corelib") set connectFolder to folder (my ModuleRoot() & "connect") set ctoolsFolder to folder (my ModuleRoot() & "ctools") my UpdateRenameHeader("ncbilcl.met", corelibFolder, "ncbilcl.h", "") --my UpdateRenameHeader("asn_connection.h", connectFolder, "", ctoolsFolder) end tell end CopyHeaders -- -- Global variables -- global gIsOSX global gStartupDisk global gHomeDir global gDevDir global gMWroot global gMWCWfolder global gMacLibs global gStubLibs global gPPCLibs global gMSLPPCLibs global gDistribRoot global gProjectsDir global gSourceDir global gIncludeDir global gLibsDir global gRsrcsDir global gOutputDir global gProjectData on AddProject(projData) copy projData to end of gProjectData end AddProject on ResolveAlias(pathname) tell application "Finder" --if the last character of pathname is ":" then error "Don't use a trailing colon with ResolveAlias." if exists folder pathname then return pathname & ":" if exists alias file pathname then return the original item of alias file pathname as string error "The folder (or alias) '" & pathname & "' doesn't exist." end tell end ResolveAlias on IsOSX() tell application "Finder" set vers to the version as string as number return vers > 10 or vers = 10 end tell end IsOSX on HomeDir() tell application "Finder" if my IsOSX() then return the home as string else return gStartupDisk end if end tell end HomeDir on DevDir() return ResolveAlias(HomeDir() & "Development") end DevDir on SandboxDir() -- ":Development:Trees:NCBI:vault.ncbi:" -- ":Users::Development:Trees:NCBI:vault.ncbi:" set Trees to ResolveAlias(DevDir() & "Trees") set NCBIgroup to ResolveAlias(Trees & "NCBI") set Vault to ResolveAlias(NCBIgroup & "vault.ncbi") return Vault end SandboxDir on DistribDir() -- ":Development:NCBI:" -- This is NOT the "distrib" directory! This is where toolkit distributions go. return ResolveAlias(DevDir() & "NCBI") end DistribDir on CToolkitRoot() try set modRoot to ResolveAlias(DistribDir() & "ncbi") on error try set modRoot to ResolveAlias(SandboxDir() & "distrib") on error set modRoot to ResolveAlias(gMWroot & "ncbi") end try end try return modRoot end CToolkitRoot on CPlusPlusToolkitRoot() try set modRoot to ResolveAlias(DistribDir() & "c++") on error try set modRoot to ResolveAlias(ResolveAlias(SandboxDir() & "internal") & "c++") on error set modRoot to ResolveAlias(gMWroot & "cxx") end try end try return modRoot end CPlusPlusToolkitRoot on ModuleRoot() if pUsingCPlusPlus then return CPlusPlusToolkitRoot() else return CToolkitRoot() end if end ModuleRoot on MWRootDir() set mwRoot to "" set mwLocations to {gStartupDisk, gStartupDisk & "Applications:", gStartupDisk & "Applications (Mac OS 9):"} repeat with mwVersion from 6 to 7 set dirName to "Metrowerks CodeWarrior " & mwVersion & ".0" repeat with mwLoc in mwLocations try set mwRoot to ResolveAlias(mwLoc & dirName) return mwRoot end try end repeat end repeat error "Can't find the Metrowerks CodeWarrior folder." end MWRootDir on SetGlobals() tell application "Finder" set gProjectData to {} set gStartupDisk to startup disk as string set gIsOSX to my IsOSX() set gHomeDir to my HomeDir() set gMWroot to my MWRootDir() set gMWCWfolder to gMWroot & "Metrowerks CodeWarrior:" set gMacLibs to gMWCWfolder & "MacOS Support:Universal:Libraries:" set gStubLibs to gMacLibs & "StubLibraries:" set gPPCLibs to gMacLibs & "PPCLibraries:" set gMSLPPCLibs to gMWCWfolder & "MSL:MSL_C:MSL_MacOS:Lib:PPC:" set gDistribRoot to my ModuleRoot() set gIncludeDir to gDistribRoot & "include:" if pUsingCPlusPlus then set gSourceDir to gDistribRoot & "src:" set gLibsDir to gDistribRoot & "compilers:mac_prj:lib:" set gOutputDir to gDistribRoot & "compilers:mac_prj:bin:" set gProjectsDir to gOutputDir else set gSourceDir to gDistribRoot set gLibsDir to gDistribRoot & "lib:" set gOutputDir to gDistribRoot & "build:" set gCToolsDir to gDistribRoot & "ctools:" set gRsrcsDir to gDistribRoot & "link:macmet:" end if if pLinkExecutables then set gProjectsDir to gOutputDir else set gProjectsDir to gLibsDir end if end tell end SetGlobals on HeaderExists(header, headerDir) tell application "Finder" if headerDir is "" then set headerDir to folder gIncludeDir return exists file header of headerDir end tell end HeaderExists on IsOlderThan(fileA, fileB) tell application "Finder" return (the modification date of fileA < the modification date of fileB) end tell end IsOlderThan on UpdateRenameHeader(canonicalName, canonicalDir, dotHName, dotHDir) tell application "Finder" set needRename to (dotHName is not "") if not needRename then set dotHName to canonicalName if dotHDir is "" then set dotHDir to folder gIncludeDir -- This file is only present if the script was interrupted. if needRename and my HeaderExists(canonicalName, dotHDir) then delete file canonicalName of dotHDir end if -- The native config file. -- If it's missing, assume this is a prepared distribution and the header is already up-to-date. if not my HeaderExists(canonicalName, canonicalDir) then return set canonicalFile to file canonicalName of canonicalDir set needCopy to true if my HeaderExists(dotHName, dotHDir) then set dotHFile to file dotHName of dotHDir if my IsOlderThan(dotHFile, canonicalFile) then delete dotHFile else set needCopy to false end if end if if needCopy then duplicate canonicalFile to dotHDir if needRename then set name of file canonicalName of dotHDir to dotHName end if end tell end UpdateRenameHeader on UpdateHeader(headerName, headerDir) UpdateRenameHeader(headerName, headerDir, "", "") end UpdateHeader on SetDebugSettings(shouldDebug) tell application "CodeWarrior IDE 4.2.5" if shouldDebug then (* ===== Panel PPC Global Optimizer ===== *) Set Preferences of panel "PPC Global Optimizer" to ¬ {Optimize For:code_Speed, Level:0} (* ===== Panel PPC Linker ===== *) Set Preferences of panel "PPC Linker" to ¬ {Generate SYM File:true ¬ , Suppress Warnings:false} (* ===== Panel C/C++ Language ===== *) Set Preferences of panel "C/C++ Compiler" to ¬ {Inlining:inline_none ¬ , AutoInlining:false} else (* ==== optimized/release settings ==== *) (* ===== Panel PPC Global Optimizer ===== *) Set Preferences of panel "PPC Global Optimizer" to ¬ {Optimize For:code_Speed, Level:4} (* ===== Panel PPC Linker ===== *) Set Preferences of panel "PPC Linker" to ¬ {Generate SYM File:false ¬ , Suppress Warnings:true} (* ===== Panel C/C++ Language ===== *) Set Preferences of panel "C/C++ Compiler" to ¬ {Inlining:inline_smart ¬ , AutoInlining:true} end if end tell end SetDebugSettings on SetPreferences() tell application "CodeWarrior IDE 4.2.5" (* ===== Section "Target" ===== *) -- Panel "Target Settings" Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"} -- Panel "PPC Target" if pLinkExecutables then Set Preferences of panel "PPC Project" to ¬ {Project Type:standard application, SIZE Flags:22720, File Creator:"NCBI", File Type:"APPL", Preferred Size:8000, Minimum Size:5000, Stack Size:64} else Set Preferences of panel "PPC Project" to {Project Type:library} end if (* ===== Section "Language Settings" ===== *) -- Panel "C/C++ Language" Set Preferences of panel "C/C++ Compiler" to ¬ {Activate CPlusPlus:false ¬ , ARM Conformance:false ¬ , Exception Handling:true ¬ , RTTI:true ¬ , Pool Strings:true ¬ , Dont Reuse Strings:false ¬ , Require Function Prototypes:true ¬ , ANSI Strict:false ¬ , ANSI Keywords Only:false ¬ , Expand Trigraph Sequences:false ¬ , MPW Newlines:false ¬ , MPW Pointer Type Rules:false ¬ , Enums Always Ints:false} -- Panel "C/C++ Warnings" Set Preferences of panel "C/C++ Warnings" to ¬ {Treat Warnings As Errors:false ¬ , Illegal Pragmas:true ¬ , Empty Declarations:true ¬ , Possible Errors:true ¬ , Unused Variables:true ¬ , Unused Arguments:false ¬ , Extra Commas:true ¬ , Extended Error Checking:true ¬ , Hidden Virtual Functions:true ¬ , Implicit Arithmetic Conversions:false ¬ , NonInlined Functions:false ¬ , Inconsistent Class Struct:true} (* ===== Section "Code Generation" ===== *) -- Panel "PPC Processor" Set Preferences of panel "PPC CodeGen" to ¬ {Struct Alignment:Align_PPC ¬ , Make Strings ReadOnly:true ¬ , Store Data in TOC:true ¬ , Use FMADD Instructions:false ¬ , Use Profiler:false ¬ , Traceback Tables:TB_Inline ¬ , Schedule:false ¬ , Peephole Optimizer:true} (* ===== Section "Linker" ===== *) -- Panel "PPC Linker" Set Preferences of panel "PPC Linker" to ¬ {Generate SYM File:true ¬ , Full Path In Sym Files:true ¬ , Generate Link Map:false ¬ , Link Mode:fast ¬ , Initialization Name:¬ "", Main Name:¬ "__start", Termination Name:""} ¬ -- Panel "PPC PEF" Set Preferences of panel "PPC PEF" to ¬ {Export Symbols:none ¬ , Old Definition:0 ¬ , Old Implementation:0 ¬ , Current Version:0 ¬ , Code Sorting:nosort ¬ , Share Data Section:false ¬ , Expand Uninitialized Data:false ¬ , Fragment Name:""} (* ===== Section "Debugger" ===== *) -- Panel "Debugger Settings" Set Preferences of panel "Debugger Target" to ¬ {Log System Messages:false} my SetPaths1() end tell end SetPreferences on SetPaths1() tell application "CodeWarrior IDE 4.2.5" (* ===== Panel Access Paths ===== *) -- We need to be able to move the default system compiler folder to the end of the list -- because certain files like "all.h" and "all" are defined by both Metrowerks and NCBI. -- We want to find the NCBI "all.h" first. Set Preferences of panel "Access Paths" to {System Paths:{}} -- This removes the compiler default folder Set Preferences of panel "Access Paths" to {Always Full Search:true, Convert Paths:true} end tell end SetPaths1 on SetPaths2() tell application "CodeWarrior IDE 4.2.5" -- Add recursive include dir AFTER source dirs to avoid major performance hit set pathsToAdd to {} -- gDistribRoot & "link:macmet:", repeat with i in {gDistribRoot, ¬ gLibsDir, gIncludeDir} copy {name:i, recursive:false, origin:absolute} to end of pathsToAdd end repeat if not pUsingCPlusPlus then copy {name:gDistribRoot & "link:macmet:", recursive:true, origin:absolute} to end of pathsToAdd end if Set Preferences of panel "Access Paths" to {User Paths:pathsToAdd} set pathsToAdd to {{name:gIncludeDir, recursive:true, origin:absolute}} if not pUsingCPlusPlus then copy {name:gDistribRoot, recursive:true, origin:absolute} to end of pathsToAdd end if -- After we have added all paths, reinsert compiler default at end of list set dirsToAdd to {¬ ":MacOS Support:", ¬ ":MSL:"} -- if gPNGpresent ... repeat with i in dirsToAdd copy {name:i, recursive:true, origin:shell relative} to end of pathsToAdd end repeat Set Preferences of panel "Access Paths" to {System Paths:pathsToAdd} end tell end SetPaths2 on AddFeatures(features, flags) tell application "CodeWarrior IDE 4.2.5" if features contains "BNDL" then Set Preferences of panel "Output Flags" to {Has Bundle:true} end if if features contains "sockets" and flags does not contain "Carbon" then set libsToAdd to {¬ gStubLibs & "ThreadsLib", ¬ gStubLibs & "OpenTransportLib", ¬ gStubLibs & "OpenTptInternetLib", ¬ gStubLibs & "InternetConfigLib", ¬ gPPCLibs & "OpenTptInetPPC.o", ¬ gPPCLibs & "OpenTransportAppPPC.o"} Add Files libsToAdd end if end tell end AddFeatures on SetupTarget(proj, flags) tell application "CodeWarrior IDE 4.2.5" -- initialize variables set projRsrcs to {} set projFeatures to {} set sysPaths to {} -- Grab the fields of our project record and store them in local variables. set projName to proj's name set projSettings to proj's settings try set projFeatures to proj's features end try try set sysPaths to proj's sysPaths end try try set projRsrcs to proj's rsrcs end try set projLibs to proj's projLibs set projFileData to proj's fileData -- Figure out what our output file and input libraries will be named. if flags contains "Carbon" then set targetAPI to "C2" else set targetAPI to "Mac" end if if flags contains "debug" then set targetDebug to "dbg" else set targetDebug to "" end if set targetName to projName & " " & targetAPI set libNameSuffix to "-" & targetAPI if targetDebug is not "" then set targetName to targetName & " " & targetDebug set libNameSuffix to libNameSuffix & "-" & targetDebug end if if pLinkExecutables then set targetFilename to targetName else set targetFilename to projName & libNameSuffix & ".lib" end if -- Make the new target, and set the current target to be it. make new target at project document 1 with properties {name:targetName} set the current target of project document 1 to the result -- Set default settings. do this BEFORE setting per-project settings! my SetPreferences() -- Set the name of the output file (the application) Set Preferences of panel "PPC Project" to {File Name:targetFilename} -- If we have any per-project override settings, set them. if (count ppcProject of projSettings) > 0 then Set Preferences of panel "PPC Project" to ppcProject of projSettings end if --Set Preferences of panel "Access Paths" to {User Paths:{{name:NCBISOURCE & projPath, origin:absolute}}} my SetPaths2() -- Add per-project system paths. set pathsToAdd to {} repeat with i in sysPaths copy {name:i, recursive:true, origin:absolute} to end of pathsToAdd end repeat if (count pathsToAdd) > 0 then ¬ Set Preferences of panel "Access Paths" to {System Paths:pathsToAdd} -- Set the appropriate prefix file. set prefixFile to Prefix File of projSettings if prefixFile is "" then if flags contains "debug" then set prefixFile to pDebugPrefix else set prefixFile to pReleasePrefix end if end if if flags contains "Carbon" then if prefixFile is "" then set prefixFile to "CarbonPrefix.h" else set prefixFile to "Carbon-" & prefixFile end if end if Set Preferences of panel "C/C++ Compiler" to {Prefix File:prefixFile} -- Are we assuming a .c or a .cpp extension? if projFeatures contains "C++" then set fileExtension to pCPlusPlusExtension else set fileExtension to ".c" end if -- Add source files. repeat with group in projFileData set projPath to projPath of group Set Preferences of panel "Access Paths" to ¬ {User Paths:{{name:gSourceDir & projPath, origin:absolute}}} set fileList to group's fileList set filesToAdd to {} repeat with i in fileList if i does not contain "." then set i to i & fileExtension copy gSourceDir & projPath & i to end of filesToAdd end repeat Add Files filesToAdd end repeat if flags contains "debug" then set the debug of every target file of target (count targets of project document 1) ¬ of project document 1 to true my SetDebugSettings(true) else my SetDebugSettings(false) end if -- Add appropriate system libraries. if pLinkExecutables then if flags contains "Carbon" then my AddCarbonLibs() else my AddBlueLibs() end if end if my AddFeatures(projFeatures, flags) set filesToAdd to {} -- Add user libraries. if projFeatures contains "sockets" then if projLibs does not contain "mitsock" then copy "mitsock" to beginning of projLibs end if end if repeat with i in projLibs copy gLibsDir & i & libNameSuffix & ".lib" to end of filesToAdd end repeat -- Add resources. repeat with i in projRsrcs copy gRsrcsDir & i to end of filesToAdd end repeat Add Files filesToAdd Reset File Paths end tell end SetupTarget on CreateFolders() tell application "Finder" repeat with i in pDirsToCreate set pth to relPath of i if pth is not "" then set pth to pth & ":" if not (exists folder (gDistribRoot & pth & i's name)) then make new folder at folder (gDistribRoot & pth) with properties {name:i's name} end if end repeat end tell end CreateFolders on CreateProject(proj) tell application "CodeWarrior IDE 4.2.5" -- This statement doesn't work, because AppleScript is broken. if proj is {} then return try get proj's name on error return end try set projFilename to proj's name & pProjectFileExtension set projPathname to gProjectsDir & projFilename if pAlwaysCreateProjects or not (exists file projPathname of application "Finder") then try close (the first project document whose name is projFilename) end try Create Project {projPathname} if pCreateBlueTargets and pCreateDebugTargets then my SetupTarget(proj, "Blue debug") end if if pCreateBlueTargets and pCreateOptimizedTargets then my SetupTarget(proj, "Blue") end if if pCreateCarbonTargets and pCreateDebugTargets then my SetupTarget(proj, "Carbon debug") end if if pCreateCarbonTargets and pCreateOptimizedTargets then my SetupTarget(proj, "Carbon") end if set the current target of project document 1 to target 1 of project document 1 Close Project end if end tell end CreateProject on CreateAllProjects() repeat with proj in gProjectData CreateProject(proj) end repeat end CreateAllProjects on BuildProject(projName) tell application "CodeWarrior IDE 4.2.5" open (gProjectsDir & projName & pProjectFileExtension) repeat with i from 2 to (count targets of project document 1) set the current target of project document 1 to target i of project document 1 Make Project -- If there were compiler warnings, then a compiler window will be in front. -- For whatever reason, this causes the next "set the current target..." to fail. -- An easy way to make the window go away without having to know if it's there or not -- is to build again, which, because everything is already compiled, finishes instantly -- and produces no warnings. --Make Project -- An even better way is to check for the window and close it. if the name of window 1 is "Errors & Warnings" then close first window -- "close window 1" becomes "Close Window 1" (different event) end if end repeat set the current target of project document 1 to target 1 of project document 1 Close Project end tell end BuildProject on BuildAllProjects() repeat with proj in gProjectData try set projName to proj's name on error set projName to "" end try -- This statement doesn't work, because AppleScript is broken. if proj is not {} then if projName is not "" then BuildProject(projName) end if end if end repeat end BuildAllProjects on SignalCompletion() try say "Make complete." on error beep end try end SignalCompletion with timeout of 60000 seconds SetGlobals() SetProjectData() CreateFolders() CopyHeaders() tell application "CodeWarrior IDE 4.2.5" to activate CreateAllProjects() if pShouldBuild then BuildAllProjects() end if SignalCompletion() end timeout