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
|
-- update C libs --
--
-- Properties
--
property pProjectFileExtension : ".mcp"
--
-- Global variables
--
global gStartupDisk
global gHomeDir
global gMWroot
global gDistribRoot
global gProjectsDir
global gLibsDir
global gProjectData
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 text
if second character of vers is equal to "." then
set vers to "0" & vers
end if
return vers > 10 or vers = 10
end tell
end IsOSX
on HomeDir()
tell application "Finder"
if my IsOSX() then
-- return the home as string
set hm to home as string
set wd to words of hm
set rs to rest of wd
set text item delimiters of AppleScript to ":"
set nw to (rs as string) & ":"
set text item delimiters of AppleScript to ""
return nw
else
return gStartupDisk
end if
end tell
end HomeDir
on CToolkitRoot()
try
set modRoot to ResolveAlias(gMWroot & "ncbi")
on error
try
set modRoot to ResolveAlias(gStartupDisk & gHomeDir & "ncbi")
end try
end try
return modRoot
end CToolkitRoot
on ModuleRoot()
return CToolkitRoot()
end ModuleRoot
on MWRootDir()
set mwRoot to ""
set mwLocations to {gStartupDisk, gStartupDisk & "Applications:", gStartupDisk & "Applications (Mac OS 9):",
gStartupDisk & gHomeDir, gStartupDisk & gHomeDir & "Applications:", gStartupDisk & gHomeDir & "Applications (Mac OS 9):"}
repeat with mwVersion from 8 to 9
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 gHomeDir to my HomeDir()
set gMWroot to my MWRootDir()
set gDistribRoot to my ModuleRoot()
set gLibsDir to gDistribRoot & "lib:"
set gProjectsDir to gLibsDir
end tell
end SetGlobals
on BuildLibraries(proj)
tell application "CodeWarrior IDE"
open (gProjectsDir & proj & 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 BuildLibraries
on BuildAllLibraries()
set myLibs to {"mitsock", "ncbi", "ncbiconn", "ncbiobj", "ncbicdr", "vibrant",
"ncbidesk", "ddvlib", "ncbitool", "ncbimmdb", "ncbiNacc",
"netentr", "netcli", "ncbibls3", "ncbiid1", "ncbimla", "ncbitxc2", "vibnet"}
repeat with proj in myLibs
BuildLibraries(proj)
end repeat
end BuildAllLibraries
(* ==== This section builds the libraries ==== *)
with timeout of 60000 seconds
SetGlobals()
tell application "CodeWarrior IDE" to activate
BuildAllLibraries()
beep
end timeout
|