~ubuntu-branches/ubuntu/precise/ncbi-tools6/precise

« back to all changes in this revision

Viewing changes to make/makeall.met

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2005-03-27 12:00:15 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050327120015-embhesp32nj73p9r
Tags: 6.1.20041020-3
* Fix FTBFS under GCC 4.0 caused by inconsistent use of "static" on
  functions.  (Closes: #295110.)
* Add a watch file, now that we can.  (Upstream's layout needs version=3.)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
--
3
 
--
4
 
 
5
 
property pUsingCPlusPlus : false
6
 
property pProjectFileExtension : ".mcp"
7
 
 
8
 
property pAlwaysCreateProjects : false
9
 
property pBuildObsoleteLibraries : false
10
 
 
11
 
property pCreateBlueTargets : true -- 'Blue' was the codename for System 7.  Here, it means pre-Carbon.
12
 
property pCreateCarbonTargets : true
13
 
property pCreateDebugTargets : true
14
 
property pCreateOptimizedTargets : true
15
 
 
16
 
property pShouldBuild : true
17
 
 
18
 
property pDirsToCreate : {�
19
 
        {relPath:"", name:"include"}, �
20
 
        {relPath:"", name:"ctools"}, �
21
 
        {relPath:"", name:"lib"}}
22
 
 
23
 
property pDebugPrefix : ""
24
 
property pReleasePrefix : ""
25
 
 
26
 
property pLinkExecutables : false
27
 
 
28
 
--
29
 
--
30
 
 
31
 
on ProjectData(projName, features, fileData)
32
 
        
33
 
        if (count characters of projName) > 18 then
34
 
                set projName to characters 1 through 18 of projName as string
35
 
        end if
36
 
        
37
 
        tell application "CodeWarrior IDE 4.2.5"
38
 
                
39
 
                if features does not contain "C" and features does not contain "C++" then
40
 
                        --error "Project " & projName & "'s default language (a feature) must be C or C++."
41
 
                        copy "C" to end of features
42
 
                end if
43
 
                set myFeatures to features
44
 
                --copy "BNDL" to end of myFeatures
45
 
                return {name:projName, features:myFeatures, rsrcs:{}, settings:�
46
 
                        {Prefix File:"", ppcProject:{}}, projLibs:{}, sysPaths:{}, fileData:�
47
 
                        fileData}
48
 
                
49
 
        end tell
50
 
end ProjectData
51
 
 
52
 
on SimpleProjectData(projName, features, section, fileList)
53
 
        
54
 
        set myPath to section & ":"
55
 
        return ProjectData(projName, features, {{projPath:myPath, fileList:fileList}})
56
 
        
57
 
end SimpleProjectData
58
 
 
59
 
on AddSimpleProject(projName, features, section, fileList)
60
 
        
61
 
        AddProject(SimpleProjectData(projName, features, section, fileList))
62
 
        
63
 
end AddSimpleProject
64
 
 
65
 
on DataPlusPrefixFile(dataRec, prefix)
66
 
        tell application "CodeWarrior IDE 4.2.5"
67
 
                
68
 
                set the Prefix File of dataRec's settings to prefix
69
 
                return dataRec
70
 
                
71
 
        end tell
72
 
end DataPlusPrefixFile
73
 
 
74
 
on SetProjectData()
75
 
        
76
 
        AddSimpleProject("mitsock", {}, "connect:mitsock", �
77
 
                {"OTSocketInternal", "OTErrno", "OTSockets", "OTidle", "OTNetdbServices", "OTnetdb"})
78
 
        
79
 
        AddProject(ProjectData("ncbi", {}, {�
80
 
                �
81
 
                        {projPath:"corelib:", fileList:{�
82
 
                                "ncbibs", "ncbienv", "ncbierr", "ncbifile", "ncbimath", "ncbimem", "ncbimisc", �
83
 
                                "ncbimsg", "ncbiprop", "ncbisgml", "ncbistr", "ncbitime", "ncbilang", "gifgen", �
84
 
                                "togif", "ncbithr", "tsprintf", "tree", "wwwutils", "matrix", "binary", "regex.c"}}, �
85
 
                �
86
 
                        {projPath:"connect:", fileList:{�
87
 
                                "ncbibuf", "ncbisock", "connection", "urlquery"}}, �
88
 
                �
89
 
                        {projPath:"ctools:", fileList:{�
90
 
                                "asn_connection"}}, �
91
 
                �
92
 
                        {projPath:"asnlib:", fileList:{�
93
 
                                "asnbufo", "asndebin", "asnenbin", "asngen", "asngenob", "asnio", "asnlex", �
94
 
                                "asnlext", "asnout", "asnprint", "asntypes"}}}))
95
 
        
96
 
        AddSimpleProject("ncbiconn", {}, "connect", �
97
 
                {"ncbi_buffer", "ncbi_socket_", "ncbi_core", "ncbi_util", "ncbi_priv", "ncbi_ansi_ext", �
98
 
                        "ncbi_connection", "ncbi_connector", "ncbi_connutil", "ncbi_file_connector", �
99
 
                        "ncbi_http_connector", "ncbi_server_info", "ncbi_service", "ncbi_service_connector", �
100
 
                        "ncbi_service_dispd", "ncbi_service_lbsmd_stub", "ncbi_socket_connector", �
101
 
                        "ncbi_sendmail_"})
102
 
        
103
 
        AddProject(ProjectData("ncbiobj", {}, {�
104
 
                �
105
 
                        {projPath:"object:", fileList:{�
106
 
                                "objacces", "objalign", "objall", "objbibli", "objblock", "objcode", "objfdef", �
107
 
                                "objfeat", "objgen", "objloc", "objmdrs", "objmedli", "objproj", �
108
 
                                "objprt", "objpub", "objpubme", "objres", "objseq", "objsset", "objalignloc", �
109
 
                                "objsub"}}, �
110
 
                �
111
 
                        {projPath:"access:", fileList:{�
112
 
                                "objent2", "ent2api", "pmfapi", "strucapi", "qblastapi", "vecscnapi", "objmim", �
113
 
                                "mimapi"}}, �
114
 
                �
115
 
                        {projPath:"api:", fileList:{�
116
 
                                "asn2ff1", "asn2ff2", "asn2ff3", "asn2ff4", "asn2ff5", "asn2ff6", "asn2gnbk", "codon", �
117
 
                                "edutil", "ffprint", "findrepl", "ftusrstr", "gather", "gbfeat", "gbftglob", "gbparint", �
118
 
                                "jzcoll", "jzmisc", "lsqfetch", "maputil", "mconsist", "objmgr", "prtutil", "satutil", �
119
 
                                "seqmgr", "seqport", "sequtil", "simple", "sqnutil1", "sqnutil2", "sqnutil3", �
120
 
                                "subutil", "tofasta", "tofile", "tomedlin", "utilpars", "utilpub", "salpstat", �
121
 
                                "salpedit", "valid", "alignmgr", "alignmgr2", "aliparse", "aliread", "alignval", "wprint", �
122
 
                                "salpacc", "salprop", "salsap", "salstruc", "salutil", "udvseq", "blocks", �
123
 
                                "pgppop", "samutil", "ddvcolor", "viewmgr", "jsavlt", "needleman", "fdlobj", "txalign"}}, �
124
 
                �
125
 
                        {projPath:"ddv:", fileList:{�
126
 
                                "ddvcreate"}}}))
127
 
        
128
 
        AddSimpleProject("ncbicdr", {}, "cdromlib", �
129
 
                {"casn", "cdconfig", "cdentrez", "cdnewlib", "cdromlib", "objentr"})
130
 
        
131
 
        AddSimpleProject("vibrant", {}, "vibrant", �
132
 
                {"ncbidraw", "vibbutns", "vibextra", "vibfiles", "vibforms", "vibgroup", "viblists", �
133
 
                        "vibmenus", "vibprmpt", "vibsbars", "vibslate", "vibtexts", "vibutils", �
134
 
                        "vibwndws", "document", "drawing", "mapping", "palette", "picture", "table", �
135
 
                        "viewer", "diagnost", "image", "pictur3d", "prim3d1", "prim3d2", "prim3d3", �
136
 
                        "prim3d4", "prim3d5", "viewer3d", "vibmouse", "imagelst", "treeview", "shim3d", �
137
 
                        "odlbox"})
138
 
        
139
 
        AddSimpleProject("ncbidesk", {}, "desktop", �
140
 
                {"asn2graphic", "biosrc", "bspview", "cdrgn", "dlgutil1", "dlgutil2", "dotmatrx", "drawseq", �
141
 
                        "e2trmlst", "e2docsum", "fea2seg", "fstyle", "glbpic", "gbfview", "gphview", "gphdraw", �
142
 
                        "gxydraw", "gtrdraw", "ingengraph", "ingenext", "ingenwin", "import", "layout", "mapgene", �
143
 
                        "medview", "prtgene", "pubdesc", "saldist", "saled", "salfiles", "salpanel", "salparam", �
144
 
                        "salsa", "seqsub", "seqfltr", "seqgraph", "seqgrphx", "seqmtrx", "seqpcc", "seqanal", �
145
 
                        "aacomp", "seqscrl", "smdlg1", "smdlg2", "smdlg3", "smtools", "styleman", "stylemui", �
146
 
                        "vsm", "vsmfile", "vsmutil", "udvgraph", "udvopen", "udvpanel", "salogif", �
147
 
                        "dotvibrant"})
148
 
        
149
 
        AddSimpleProject("ddvlib", {}, "ddv", �
150
 
                {"ddvclick", "ddvgraph", "ddvopen", "ddvpanel"})
151
 
        
152
 
        if pBuildObsoleteLibraries then
153
 
                
154
 
                AddSimpleProject("ncbicacc", {}, "cdromlib", �
155
 
                        {"accentr", "accutils", "accmmdbs", "acccn3ds"})
156
 
                
157
 
                AddProject(DataPlusPrefixFile(ProjectData("vibgif", {}, {�
158
 
                        �
159
 
                                {projPath:"gif:", fileList:{�
160
 
                                        "gdfontg", "gdfontl", "gdfontmb", "gdfonts", "gdfontt", "pictogif"}}, �
161
 
                        �
162
 
                                {projPath:"vibrant:", fileList:{�
163
 
                                        "ncbidraw", "drawing", "mapping", "picture"}}}), "gif.pfx"))
164
 
                
165
 
        end if
166
 
        
167
 
        AddSimpleProject("ncbitool", {}, "tools", �
168
 
                {"csim", "db_slist", "dust", "falign", "g_any", "pobutil", "stsutil", "sec", "sim2", �
169
 
                        "sim3", "sim4", "simutil", "slist", "suggadj", "suggest", "suggslp", "tfuns", �
170
 
                        "toasn3", "toporg", "blast", "blastutl", "blastool", "splutil", "actutils", "gapxdrop", �
171
 
                        "bandalg0", "bandalg1", "bandalg2", "bandalg3", "bandalg4", "bandalg5", �
172
 
                        "bandalgn", "blastkar", "lookup", "posit", "readdb", "ncbisam", "ncbisort", "salign", �
173
 
                        "salptool", "urkutil", "urkpcc", "urkptpf", "urkepi", "urkfltr", "urkdust", �
174
 
                        "urksigu", "seg", "urkbias", "urkcnsrt", "urktree", "pattern1", "pseed3", �
175
 
                        "impatool", "posit2", "newkar", "mbalign", "mblast", "vecscrn", �
176
 
                        "rpsutil", "kappa", "xmlblast", "bxmlobj", "dotseq", "spidey", "motif"})
177
 
        
178
 
        AddProject(DataPlusPrefixFile(ProjectData("ncbimmdb", {}, {�
179
 
                �
180
 
                        {projPath:"biostruc:", fileList:{�
181
 
                                "corematx", "dvncode", "objmmdb1", "objmmdb2", "objmmdb3", "mmdbapi", �
182
 
                                "mmdbapi1", "mmdbapi2", "mmdbapi3", "mmdbapi4", "mmdbentr", "vastsubs", �
183
 
                                "prunebsc"}}, �
184
 
                �
185
 
                        {projPath:"object:", fileList:{�
186
 
                                "objmime"}}, �
187
 
                �
188
 
                        {projPath:"biostruc:cn3d:", fileList:{�
189
 
                                "objcn3d"}}, �
190
 
                �
191
 
                        {projPath:"biostruc:cdd:", fileList:{�
192
 
                                "objcdd", "cddutil", "cddposutil", �
193
 
                                "thrdalgs", "thrdatd", "thrdbwfi", "thrdcpal", �
194
 
                                "thrdcpll", "thrdcprl", "thrdcxei", "thrddgri", "thrdrsmp", �
195
 
                                "thrdsal0", "thrdsalr", "thrdsalu", "thrdsgoi", "thrdslo0", �
196
 
                                "thrdslor", "thrdslou", "thrdspci", "thrdspea", "thrdspel", �
197
 
                                "thrdspni", "thrdttb0", "thrdttbi", "thrdzsc"}}}), "gif.pfx"))
198
 
        
199
 
        AddSimpleProject("ncbicn3d", {}, "cn3d", �
200
 
                {"algorend", "cn3dwin", "cn3dentr", "cn3dmsel", "cn3dopen", "cn3dsave", �
201
 
                        "cn3dxprt", "cn3dmsg", "cn3dmatn", "cn3dmodl", "cn3dshim", "cn3dmesh", �
202
 
                        "cn3dstyl", "seqcons"})
203
 
        
204
 
        AddSimpleProject("ncbiNacc", {}, "cdromlib", �
205
 
                {"accentr", "accutils", "accmmdbs", "acccn3ds"})
206
 
        
207
 
        AddSimpleProject("netentr", {}, "network:entrez:client", �
208
 
                {"netentr", "netlib", "objneten"})
209
 
        
210
 
        AddSimpleProject("netcli", {}, "network:nsclilib", �
211
 
                {"ncbicli", "ncbiurl", "ni_disp", "ni_encrs", "ni_serv", "ni_error", "ni_lib_", �
212
 
                        "ni_macdv", "ni_msg", "ni_www", "ni_debug"})
213
 
        
214
 
        AddSimpleProject("ncbibls3", {}, "network:blast3:client", �
215
 
                {"netblap3", "objblst3"})
216
 
        
217
 
        AddSimpleProject("ncbiid1", {}, "network:id1arch", �
218
 
                {"id1gen", "id1arch", "accid1"})
219
 
        
220
 
        AddSimpleProject("ncbimla", {}, "network:medarch:client", �
221
 
                {"medarch", "medutil", "objmla"})
222
 
        
223
 
        AddProject(DataPlusPrefixFile(ProjectData("ncbitxc2", {}, {�
224
 
                �
225
 
                        {projPath:"network:taxon1:taxon2:", fileList:{�
226
 
                                "parttree", "taxcs", "tc2proc", "txcdproc"}}, �
227
 
                �
228
 
                        {projPath:"network:taxon1:common:", fileList:{�
229
 
                                "objtax1", "taxutil"}}}), "tax2.pfx"))
230
 
        
231
 
        AddSimpleProject("vibnet", {}, "network:vibnet", �
232
 
                {"netcnfg", "trmlst", "docsum"})
233
 
        
234
 
end SetProjectData
235
 
 
236
 
on CopyHeaders()
237
 
        tell application "Finder"
238
 
                
239
 
                set corelibFolder to folder (my ModuleRoot() & "corelib")
240
 
                set connectFolder to folder (my ModuleRoot() & "connect")
241
 
                set ctoolsFolder to folder (my ModuleRoot() & "ctools")
242
 
                
243
 
                my UpdateRenameHeader("ncbilcl.met", corelibFolder, "ncbilcl.h", "")
244
 
                --my UpdateRenameHeader("asn_connection.h", connectFolder, "", ctoolsFolder)
245
 
                
246
 
        end tell
247
 
end CopyHeaders
248
 
 
249
 
--
250
 
--
251
 
 
252
 
global gIsOSX
253
 
global gStartupDisk
254
 
global gHomeDir
255
 
global gDevDir
256
 
global gMWroot
257
 
global gMWCWfolder
258
 
global gMacLibs
259
 
global gStubLibs
260
 
global gPPCLibs
261
 
global gMSLPPCLibs
262
 
 
263
 
global gDistribRoot
264
 
 
265
 
global gProjectsDir
266
 
global gSourceDir
267
 
global gIncludeDir
268
 
global gLibsDir
269
 
global gRsrcsDir
270
 
global gOutputDir
271
 
 
272
 
global gProjectData
273
 
 
274
 
on AddProject(projData)
275
 
        
276
 
        copy projData to end of gProjectData
277
 
        
278
 
end AddProject
279
 
 
280
 
on ResolveAlias(pathname)
281
 
        tell application "Finder"
282
 
                --if the last character of pathname is ":" then error "Don't use a trailing colon with ResolveAlias."
283
 
                if exists folder pathname then return pathname & ":"
284
 
                if exists alias file pathname then return the original item of alias file pathname as string
285
 
                error "The folder (or alias) '" & pathname & "' doesn't exist."
286
 
        end tell
287
 
end ResolveAlias
288
 
 
289
 
on IsOSX()
290
 
        tell application "Finder"
291
 
                
292
 
                set vers to the version as string as number
293
 
                return vers > 10 or vers = 10
294
 
                
295
 
        end tell
296
 
end IsOSX
297
 
 
298
 
on HomeDir()
299
 
        tell application "Finder"
300
 
                
301
 
                if my IsOSX() then
302
 
                        return the home as string
303
 
                else
304
 
                        return gStartupDisk
305
 
                end if
306
 
                
307
 
        end tell
308
 
end HomeDir
309
 
 
310
 
on DevDir()
311
 
        
312
 
        return ResolveAlias(HomeDir() & "Development")
313
 
        
314
 
end DevDir
315
 
 
316
 
on SandboxDir()
317
 
        
318
 
        -- "<Boot>:Development:Trees:NCBI:vault.ncbi:"
319
 
        -- "<Boot>:Users:<User>:Development:Trees:NCBI:vault.ncbi:"
320
 
        
321
 
        set Trees to ResolveAlias(DevDir() & "Trees")
322
 
        set NCBIgroup to ResolveAlias(Trees & "NCBI")
323
 
        set Vault to ResolveAlias(NCBIgroup & "vault.ncbi")
324
 
        return Vault
325
 
        
326
 
end SandboxDir
327
 
 
328
 
on DistribDir()
329
 
        
330
 
        -- "<Boot>:Development:NCBI:"
331
 
        -- This is NOT the "distrib" directory!  This is where toolkit distributions go.
332
 
        return ResolveAlias(DevDir() & "NCBI")
333
 
        
334
 
end DistribDir
335
 
 
336
 
on CToolkitRoot()
337
 
        
338
 
        try
339
 
                set modRoot to ResolveAlias(DistribDir() & "ncbi")
340
 
        on error
341
 
                try
342
 
                        set modRoot to ResolveAlias(SandboxDir() & "distrib")
343
 
                on error
344
 
                        set modRoot to ResolveAlias(gMWroot & "ncbi")
345
 
                end try
346
 
        end try
347
 
        
348
 
        return modRoot
349
 
        
350
 
end CToolkitRoot
351
 
 
352
 
on CPlusPlusToolkitRoot()
353
 
        
354
 
        try
355
 
                set modRoot to ResolveAlias(DistribDir() & "c++")
356
 
        on error
357
 
                try
358
 
                        set modRoot to ResolveAlias(ResolveAlias(SandboxDir() & "internal") & "c++")
359
 
                on error
360
 
                        set modRoot to ResolveAlias(gMWroot & "cxx")
361
 
                end try
362
 
        end try
363
 
        
364
 
        return modRoot
365
 
        
366
 
end CPlusPlusToolkitRoot
367
 
 
368
 
on ModuleRoot()
369
 
        
370
 
        if pUsingCPlusPlus then
371
 
                return CPlusPlusToolkitRoot()
372
 
        else
373
 
                return CToolkitRoot()
374
 
        end if
375
 
        
376
 
end ModuleRoot
377
 
 
378
 
on MWRootDir()
379
 
        
380
 
        set mwRoot to ""
381
 
        set mwLocations to {gStartupDisk, gStartupDisk & "Applications:", gStartupDisk & "Applications (Mac OS 9):"}
382
 
        repeat with mwVersion from 6 to 7
383
 
                set dirName to "Metrowerks CodeWarrior " & mwVersion & ".0"
384
 
                repeat with mwLoc in mwLocations
385
 
                        try
386
 
                                set mwRoot to ResolveAlias(mwLoc & dirName)
387
 
                                return mwRoot
388
 
                        end try
389
 
                end repeat
390
 
        end repeat
391
 
        
392
 
        error "Can't find the Metrowerks CodeWarrior folder."
393
 
        
394
 
end MWRootDir
395
 
 
396
 
on SetGlobals()
397
 
        tell application "Finder"
398
 
                
399
 
                set gProjectData to {}
400
 
                
401
 
                set gStartupDisk to startup disk as string
402
 
                set gIsOSX to my IsOSX()
403
 
                set gHomeDir to my HomeDir()
404
 
                set gMWroot to my MWRootDir()
405
 
                set gMWCWfolder to gMWroot & "Metrowerks CodeWarrior:"
406
 
                set gMacLibs to gMWCWfolder & "MacOS Support:Universal:Libraries:"
407
 
                set gStubLibs to gMacLibs & "StubLibraries:"
408
 
                set gPPCLibs to gMacLibs & "PPCLibraries:"
409
 
                set gMSLPPCLibs to gMWCWfolder & "MSL:MSL_C:MSL_MacOS:Lib:PPC:"
410
 
                
411
 
                set gDistribRoot to my ModuleRoot()
412
 
                
413
 
                set gIncludeDir to gDistribRoot & "include:"
414
 
                if pUsingCPlusPlus then
415
 
                        set gSourceDir to gDistribRoot & "src:"
416
 
                        set gLibsDir to gDistribRoot & "compilers:mac_prj:lib:"
417
 
                        set gOutputDir to gDistribRoot & "compilers:mac_prj:bin:"
418
 
                        set gProjectsDir to gOutputDir
419
 
                else
420
 
                        set gSourceDir to gDistribRoot
421
 
                        set gLibsDir to gDistribRoot & "lib:"
422
 
                        set gOutputDir to gDistribRoot & "build:"
423
 
                        set gCToolsDir to gDistribRoot & "ctools:"
424
 
                        set gRsrcsDir to gDistribRoot & "link:macmet:"
425
 
                end if
426
 
                
427
 
                if pLinkExecutables then
428
 
                        set gProjectsDir to gOutputDir
429
 
                else
430
 
                        set gProjectsDir to gLibsDir
431
 
                end if
432
 
                
433
 
        end tell
434
 
end SetGlobals
435
 
 
436
 
 
437
 
on HeaderExists(header, headerDir)
438
 
        tell application "Finder"
439
 
                
440
 
                if headerDir is "" then set headerDir to folder gIncludeDir
441
 
                return exists file header of headerDir
442
 
                
443
 
        end tell
444
 
end HeaderExists
445
 
 
446
 
on IsOlderThan(fileA, fileB)
447
 
        tell application "Finder"
448
 
                
449
 
                return (the modification date of fileA < the modification date of fileB)
450
 
                
451
 
        end tell
452
 
end IsOlderThan
453
 
 
454
 
on UpdateRenameHeader(canonicalName, canonicalDir, dotHName, dotHDir)
455
 
        tell application "Finder"
456
 
                
457
 
                set needRename to (dotHName is not "")
458
 
                if not needRename then set dotHName to canonicalName
459
 
                if dotHDir is "" then set dotHDir to folder gIncludeDir
460
 
                
461
 
                -- This file is only present if the script was interrupted.
462
 
                if needRename and my HeaderExists(canonicalName, dotHDir) then
463
 
                        delete file canonicalName of dotHDir
464
 
                end if
465
 
                
466
 
                -- The native config file.
467
 
                -- If it's missing, assume this is a prepared distribution and the header is already up-to-date.
468
 
                if not my HeaderExists(canonicalName, canonicalDir) then return
469
 
                set canonicalFile to file canonicalName of canonicalDir
470
 
                
471
 
                set needCopy to true
472
 
                if my HeaderExists(dotHName, dotHDir) then
473
 
                        set dotHFile to file dotHName of dotHDir
474
 
                        if my IsOlderThan(dotHFile, canonicalFile) then
475
 
                                delete dotHFile
476
 
                        else
477
 
                                set needCopy to false
478
 
                        end if
479
 
                end if
480
 
                
481
 
                if needCopy then
482
 
                        duplicate canonicalFile to dotHDir
483
 
                        if needRename then set name of file canonicalName of dotHDir to dotHName
484
 
                end if
485
 
                
486
 
        end tell
487
 
end UpdateRenameHeader
488
 
 
489
 
on UpdateHeader(headerName, headerDir)
490
 
        
491
 
        UpdateRenameHeader(headerName, headerDir, "", "")
492
 
        
493
 
end UpdateHeader
494
 
 
495
 
on SetDebugSettings(shouldDebug)
496
 
        tell application "CodeWarrior IDE 4.2.5"
497
 
                
498
 
                if shouldDebug then
499
 
                        (* ===== Panel PPC Global Optimizer =====  *)
500
 
                        Set Preferences of panel "PPC Global Optimizer" to �
501
 
                                {Optimize For:code_Speed, Level:0}
502
 
                        (* ===== Panel PPC Linker ===== *)
503
 
                        Set Preferences of panel "PPC Linker" to �
504
 
                                {Generate SYM File:true �
505
 
                                        , Suppress Warnings:false}
506
 
                        (* ===== Panel C/C++ Language =====  *)
507
 
                        Set Preferences of panel "C/C++ Compiler" to �
508
 
                                {Inlining:inline_none �
509
 
                                        , AutoInlining:false}
510
 
                        
511
 
                else
512
 
                        (* ==== optimized/release settings ==== *)
513
 
                        (* ===== Panel PPC Global Optimizer =====  *)
514
 
                        Set Preferences of panel "PPC Global Optimizer" to �
515
 
                                {Optimize For:code_Speed, Level:4}
516
 
                        (* ===== Panel PPC Linker ===== *)
517
 
                        Set Preferences of panel "PPC Linker" to �
518
 
                                {Generate SYM File:false �
519
 
                                        , Suppress Warnings:true}
520
 
                        (* ===== Panel C/C++ Language =====  *)
521
 
                        Set Preferences of panel "C/C++ Compiler" to �
522
 
                                {Inlining:inline_smart �
523
 
                                        , AutoInlining:true}
524
 
                end if
525
 
                
526
 
        end tell
527
 
end SetDebugSettings
528
 
 
529
 
on SetPreferences()
530
 
        tell application "CodeWarrior IDE 4.2.5"
531
 
                
532
 
                (* ===== Section "Target" ===== *)
533
 
                
534
 
                -- Panel "Target Settings"
535
 
                Set Preferences of panel "Target Settings" to {Linker:"MacOS PPC Linker"}
536
 
                
537
 
                -- Panel "PPC Target"
538
 
                if pLinkExecutables then
539
 
                        Set Preferences of panel "PPC Project" to �
540
 
                                {Project Type:standard application, SIZE Flags:22720, File Creator:"NCBI", File Type:"APPL", Preferred Size:8000, Minimum Size:5000, Stack Size:64}
541
 
                else
542
 
                        Set Preferences of panel "PPC Project" to {Project Type:library}
543
 
                end if
544
 
                (* ===== Section "Language Settings" ===== *)
545
 
                
546
 
                -- Panel "C/C++ Language"
547
 
                Set Preferences of panel "C/C++ Compiler" to �
548
 
                        {Activate CPlusPlus:false �
549
 
                                , ARM Conformance:false �
550
 
                                , Exception Handling:true �
551
 
                                , RTTI:true �
552
 
                                , Pool Strings:true �
553
 
                                , Dont Reuse Strings:false �
554
 
                                , Require Function Prototypes:true �
555
 
                                , ANSI Strict:false �
556
 
                                , ANSI Keywords Only:false �
557
 
                                , Expand Trigraph Sequences:false �
558
 
                                , MPW Newlines:false �
559
 
                                , MPW Pointer Type Rules:false �
560
 
                                , Enums Always Ints:false}
561
 
                
562
 
                -- Panel "C/C++ Warnings"
563
 
                Set Preferences of panel "C/C++ Warnings" to �
564
 
                        {Treat Warnings As Errors:false �
565
 
                                , Illegal Pragmas:true �
566
 
                                , Empty Declarations:true �
567
 
                                , Possible Errors:true �
568
 
                                , Unused Variables:true �
569
 
                                , Unused Arguments:false �
570
 
                                , Extra Commas:true �
571
 
                                , Extended Error Checking:true �
572
 
                                , Hidden Virtual Functions:true �
573
 
                                , Implicit Arithmetic Conversions:false �
574
 
                                , NonInlined Functions:false �
575
 
                                , Inconsistent Class Struct:true}
576
 
                
577
 
                (* ===== Section "Code Generation" ===== *)
578
 
                
579
 
                -- Panel "PPC Processor"
580
 
                Set Preferences of panel "PPC CodeGen" to �
581
 
                        {Struct Alignment:Align_PPC �
582
 
                                , Make Strings ReadOnly:true �
583
 
                                , Store Data in TOC:true �
584
 
                                , Use FMADD Instructions:false �
585
 
                                , Use Profiler:false �
586
 
                                , Traceback Tables:TB_Inline �
587
 
                                , Schedule:false �
588
 
                                , Peephole Optimizer:true}
589
 
                
590
 
                (* ===== Section "Linker" ===== *)
591
 
                
592
 
                -- Panel "PPC Linker"
593
 
                Set Preferences of panel "PPC Linker" to �
594
 
                        {Generate SYM File:true �
595
 
                                , Full Path In Sym Files:true �
596
 
                                , Generate Link Map:false �
597
 
                                , Link Mode:fast �
598
 
                                , Initialization Name:�
599
 
                                "", Main Name:�
600
 
                                "__start", Termination Name:""} �
601
 
                                
602
 
                -- Panel "PPC PEF"
603
 
                Set Preferences of panel "PPC PEF" to �
604
 
                        {Export Symbols:none �
605
 
                                , Old Definition:0 �
606
 
                                , Old Implementation:0 �
607
 
                                , Current Version:0 �
608
 
                                , Code Sorting:nosort �
609
 
                                , Share Data Section:false �
610
 
                                , Expand Uninitialized Data:false �
611
 
                                , Fragment Name:""}
612
 
                
613
 
                (* ===== Section "Debugger" ===== *)
614
 
                
615
 
                -- Panel "Debugger Settings"
616
 
                Set Preferences of panel "Debugger Target" to �
617
 
                        {Log System Messages:false}
618
 
                
619
 
                my SetPaths1()
620
 
                
621
 
        end tell
622
 
end SetPreferences
623
 
 
624
 
on SetPaths1()
625
 
        tell application "CodeWarrior IDE 4.2.5"
626
 
                
627
 
                (* ===== Panel Access Paths ===== *)
628
 
                -- We need to be able to move the default system compiler folder to the end of the list
629
 
                -- because certain files like "all.h" and "all" are defined by both Metrowerks and NCBI.
630
 
                -- We want to find the NCBI "all.h" first.
631
 
                Set Preferences of panel "Access Paths" to {System Paths:{}} -- This removes the compiler default folder
632
 
                
633
 
                Set Preferences of panel "Access Paths" to {Always Full Search:true, Convert Paths:true}
634
 
                
635
 
        end tell
636
 
end SetPaths1
637
 
 
638
 
on SetPaths2()
639
 
        tell application "CodeWarrior IDE 4.2.5"
640
 
                
641
 
                -- Add recursive include dir AFTER source dirs to avoid major performance hit
642
 
                set pathsToAdd to {}
643
 
                -- gDistribRoot & "link:macmet:", 
644
 
                repeat with i in {gDistribRoot, �
645
 
                        gLibsDir, gIncludeDir}
646
 
                        copy {name:i, recursive:false, origin:absolute} to end of pathsToAdd
647
 
                end repeat
648
 
                if not pUsingCPlusPlus then
649
 
                        copy {name:gDistribRoot & "link:macmet:", recursive:true, origin:absolute} to end of pathsToAdd
650
 
                end if
651
 
                Set Preferences of panel "Access Paths" to {User Paths:pathsToAdd}
652
 
                
653
 
                set pathsToAdd to {{name:gIncludeDir, recursive:true, origin:absolute}}
654
 
                if not pUsingCPlusPlus then
655
 
                        copy {name:gDistribRoot, recursive:true, origin:absolute} to end of pathsToAdd
656
 
                end if
657
 
                
658
 
                -- After we have added all paths, reinsert compiler default at end of list
659
 
                set dirsToAdd to {�
660
 
                        ":MacOS Support:", �
661
 
                        ":MSL:"}
662
 
                -- if gPNGpresent ...
663
 
                
664
 
                repeat with i in dirsToAdd
665
 
                        copy {name:i, recursive:true, origin:shell relative} to end of pathsToAdd
666
 
                end repeat
667
 
                Set Preferences of panel "Access Paths" to {System Paths:pathsToAdd}
668
 
                
669
 
        end tell
670
 
end SetPaths2
671
 
 
672
 
on AddFeatures(features, flags)
673
 
        tell application "CodeWarrior IDE 4.2.5"
674
 
                
675
 
                if features contains "BNDL" then
676
 
                        Set Preferences of panel "Output Flags" to {Has Bundle:true}
677
 
                end if
678
 
                
679
 
                if features contains "sockets" and flags does not contain "Carbon" then
680
 
                        set libsToAdd to {�
681
 
                                gStubLibs & "ThreadsLib", �
682
 
                                gStubLibs & "OpenTransportLib", �
683
 
                                gStubLibs & "OpenTptInternetLib", �
684
 
                                gStubLibs & "InternetConfigLib", �
685
 
                                gPPCLibs & "OpenTptInetPPC.o", �
686
 
                                gPPCLibs & "OpenTransportAppPPC.o"}
687
 
                        
688
 
                        Add Files libsToAdd
689
 
                        
690
 
                end if
691
 
                
692
 
        end tell
693
 
end AddFeatures
694
 
 
695
 
on SetupTarget(proj, flags)
696
 
        tell application "CodeWarrior IDE 4.2.5"
697
 
                
698
 
                -- initialize variables
699
 
                set projRsrcs to {}
700
 
                set projFeatures to {}
701
 
                set sysPaths to {}
702
 
                
703
 
                -- Grab the fields of our project record and store them in local variables.
704
 
                set projName to proj's name
705
 
                set projSettings to proj's settings
706
 
                try
707
 
                        set projFeatures to proj's features
708
 
                end try
709
 
                try
710
 
                        set sysPaths to proj's sysPaths
711
 
                end try
712
 
                try
713
 
                        set projRsrcs to proj's rsrcs
714
 
                end try
715
 
                set projLibs to proj's projLibs
716
 
                set projFileData to proj's fileData
717
 
                
718
 
                -- Figure out what our output file and input libraries will be named.
719
 
                if flags contains "Carbon" then
720
 
                        set targetAPI to "C2"
721
 
                else
722
 
                        set targetAPI to "Mac"
723
 
                end if
724
 
                if flags contains "debug" then
725
 
                        set targetDebug to "dbg"
726
 
                else
727
 
                        set targetDebug to ""
728
 
                end if
729
 
                set targetName to projName & " " & targetAPI
730
 
                set libNameSuffix to "-" & targetAPI
731
 
                if targetDebug is not "" then
732
 
                        set targetName to targetName & " " & targetDebug
733
 
                        set libNameSuffix to libNameSuffix & "-" & targetDebug
734
 
                end if
735
 
                if pLinkExecutables then
736
 
                        set targetFilename to targetName
737
 
                else
738
 
                        set targetFilename to projName & libNameSuffix & ".lib"
739
 
                end if
740
 
                
741
 
                -- Make the new target, and set the current target to be it.
742
 
                make new target at project document 1 with properties {name:targetName}
743
 
                set the current target of project document 1 to the result
744
 
                
745
 
                -- Set default settings.  do this BEFORE setting per-project settings!
746
 
                my SetPreferences()
747
 
                
748
 
                -- Set the name of the output file (the application)
749
 
                Set Preferences of panel "PPC Project" to {File Name:targetFilename}
750
 
                
751
 
                -- If we have any per-project override settings, set them.
752
 
                if (count ppcProject of projSettings) > 0 then
753
 
                        Set Preferences of panel "PPC Project" to ppcProject of projSettings
754
 
                end if
755
 
                --Set Preferences of panel "Access Paths" to {User Paths:{{name:NCBISOURCE & projPath, origin:absolute}}}
756
 
                my SetPaths2()
757
 
                
758
 
                -- Add per-project system paths.
759
 
                set pathsToAdd to {}
760
 
                repeat with i in sysPaths
761
 
                        copy {name:i, recursive:true, origin:absolute} to end of pathsToAdd
762
 
                end repeat
763
 
                if (count pathsToAdd) > 0 then �
764
 
                        Set Preferences of panel "Access Paths" to {System Paths:pathsToAdd}
765
 
                
766
 
                -- Set the appropriate prefix file.
767
 
                set prefixFile to Prefix File of projSettings
768
 
                if prefixFile is "" then
769
 
                        if flags contains "debug" then
770
 
                                set prefixFile to pDebugPrefix
771
 
                        else
772
 
                                set prefixFile to pReleasePrefix
773
 
                        end if
774
 
                end if
775
 
                if flags contains "Carbon" then
776
 
                        if prefixFile is "" then
777
 
                                set prefixFile to "CarbonPrefix.h"
778
 
                        else
779
 
                                set prefixFile to "Carbon-" & prefixFile
780
 
                        end if
781
 
                end if
782
 
                Set Preferences of panel "C/C++ Compiler" to {Prefix File:prefixFile}
783
 
                
784
 
                -- Are we assuming a .c or a .cpp extension?
785
 
                if projFeatures contains "C++" then
786
 
                        set fileExtension to pCPlusPlusExtension
787
 
                else
788
 
                        set fileExtension to ".c"
789
 
                end if
790
 
                
791
 
                -- Add source files.
792
 
                repeat with group in projFileData
793
 
                        set projPath to projPath of group
794
 
                        Set Preferences of panel "Access Paths" to �
795
 
                                {User Paths:{{name:gSourceDir & projPath, origin:absolute}}}
796
 
                        set fileList to group's fileList
797
 
                        set filesToAdd to {}
798
 
                        repeat with i in fileList
799
 
                                if i does not contain "." then set i to i & fileExtension
800
 
                                copy gSourceDir & projPath & i to end of filesToAdd
801
 
                        end repeat
802
 
                        Add Files filesToAdd
803
 
                end repeat
804
 
                
805
 
                if flags contains "debug" then
806
 
                        set the debug of every target file of target (count targets of project document 1) �
807
 
                                of project document 1 to true
808
 
                        my SetDebugSettings(true)
809
 
                else
810
 
                        my SetDebugSettings(false)
811
 
                end if
812
 
                
813
 
                -- Add appropriate system libraries.
814
 
                if pLinkExecutables then
815
 
                        if flags contains "Carbon" then
816
 
                                my AddCarbonLibs()
817
 
                        else
818
 
                                my AddBlueLibs()
819
 
                        end if
820
 
                end if
821
 
                my AddFeatures(projFeatures, flags)
822
 
                
823
 
                set filesToAdd to {}
824
 
                
825
 
                -- Add user libraries.
826
 
                if projFeatures contains "sockets" then
827
 
                        if projLibs does not contain "mitsock" then
828
 
                                copy "mitsock" to beginning of projLibs
829
 
                        end if
830
 
                end if
831
 
                repeat with i in projLibs
832
 
                        copy gLibsDir & i & libNameSuffix & ".lib" to end of filesToAdd
833
 
                end repeat
834
 
                
835
 
                -- Add resources.
836
 
                repeat with i in projRsrcs
837
 
                        copy gRsrcsDir & i to end of filesToAdd
838
 
                end repeat
839
 
                
840
 
                Add Files filesToAdd
841
 
                
842
 
                Reset File Paths
843
 
                
844
 
        end tell
845
 
end SetupTarget
846
 
 
847
 
on CreateFolders()
848
 
        tell application "Finder"
849
 
                
850
 
                repeat with i in pDirsToCreate
851
 
                        set pth to relPath of i
852
 
                        if pth is not "" then set pth to pth & ":"
853
 
                        if not (exists folder (gDistribRoot & pth & i's name)) then
854
 
                                make new folder at folder (gDistribRoot & pth) with properties {name:i's name}
855
 
                        end if
856
 
                end repeat
857
 
                
858
 
        end tell
859
 
end CreateFolders
860
 
 
861
 
on CreateProject(proj)
862
 
        tell application "CodeWarrior IDE 4.2.5"
863
 
                
864
 
                -- This statement doesn't work, because AppleScript is broken.
865
 
                if proj is {} then return
866
 
                
867
 
                try
868
 
                        get proj's name
869
 
                on error
870
 
                        return
871
 
                end try
872
 
                
873
 
                set projFilename to proj's name & pProjectFileExtension
874
 
                set projPathname to gProjectsDir & projFilename
875
 
                if pAlwaysCreateProjects or not (exists file projPathname of application "Finder") then
876
 
                        
877
 
                        try
878
 
                                close (the first project document whose name is projFilename)
879
 
                        end try
880
 
                        
881
 
                        Create Project {projPathname}
882
 
                        
883
 
                        if pCreateBlueTargets and pCreateDebugTargets then
884
 
                                my SetupTarget(proj, "Blue debug")
885
 
                        end if
886
 
                        
887
 
                        if pCreateBlueTargets and pCreateOptimizedTargets then
888
 
                                my SetupTarget(proj, "Blue")
889
 
                        end if
890
 
                        
891
 
                        if pCreateCarbonTargets and pCreateDebugTargets then
892
 
                                my SetupTarget(proj, "Carbon debug")
893
 
                        end if
894
 
                        
895
 
                        if pCreateCarbonTargets and pCreateOptimizedTargets then
896
 
                                my SetupTarget(proj, "Carbon")
897
 
                        end if
898
 
                        
899
 
                        set the current target of project document 1 to target 1 of project document 1
900
 
                        
901
 
                        Close Project
902
 
                        
903
 
                end if
904
 
                
905
 
        end tell
906
 
end CreateProject
907
 
 
908
 
on CreateAllProjects()
909
 
        
910
 
        repeat with proj in gProjectData
911
 
                CreateProject(proj)
912
 
        end repeat
913
 
        
914
 
end CreateAllProjects
915
 
 
916
 
on BuildProject(projName)
917
 
        tell application "CodeWarrior IDE 4.2.5"
918
 
                open (gProjectsDir & projName & pProjectFileExtension)
919
 
                repeat with i from 2 to (count targets of project document 1)
920
 
                        set the current target of project document 1 to target i of project document 1
921
 
                        Make Project
922
 
                        -- If there were compiler warnings, then a compiler window will be in front.
923
 
                        -- For whatever reason, this causes the next "set the current target..." to fail.
924
 
                        -- An easy way to make the window go away without having to know if it's there or not 
925
 
                        -- is to build again, which, because everything is already compiled, finishes instantly
926
 
                        -- and produces no warnings.
927
 
                        --Make Project
928
 
                        -- An even better way is to check for the window and close it.
929
 
                        if the name of window 1 is "Errors & Warnings" then
930
 
                                close first window -- "close window 1" becomes "Close Window 1" (different event)
931
 
                        end if
932
 
                end repeat
933
 
                set the current target of project document 1 to target 1 of project document 1
934
 
                Close Project
935
 
        end tell
936
 
end BuildProject
937
 
 
938
 
on BuildAllProjects()
939
 
        
940
 
        repeat with proj in gProjectData
941
 
                try
942
 
                        set projName to proj's name
943
 
                on error
944
 
                        set projName to ""
945
 
                end try
946
 
                -- This statement doesn't work, because AppleScript is broken.
947
 
                if proj is not {} then
948
 
                        if projName is not "" then
949
 
                                BuildProject(projName)
950
 
                        end if
951
 
                end if
952
 
        end repeat
953
 
        
954
 
end BuildAllProjects
955
 
 
956
 
on SignalCompletion()
957
 
        
958
 
        try
959
 
                say "Make complete."
960
 
        on error
961
 
                beep
962
 
        end try
963
 
        
964
 
end SignalCompletion
965
 
 
966
 
with timeout of 60000 seconds
967
 
        
968
 
        SetGlobals()
969
 
        
970
 
        SetProjectData()
971
 
        
972
 
        CreateFolders()
973
 
        CopyHeaders()
974
 
        
975
 
        tell application "CodeWarrior IDE 4.2.5" to activate
976
 
        
977
 
        CreateAllProjects()
978
 
        
979
 
        if pShouldBuild then
980
 
                BuildAllProjects()
981
 
        end if
982
 
        
983
 
        SignalCompletion()
984
 
        
985
 
end timeout
986