tahoe/contrib/mathematica/MakeMake.ma1 (*^ 2 ::[ Information = 3 4 "This is a Mathematica Notebook file. It contains ASCII text, and can be 5 transferred by email, ftp, or other text-file transfer utility. It should 6 be read or edited using a copy of Mathematica or MathReader. If you 7 received this as email, use your mail application or copy/paste to save 8 everything from the line containing (*^ down to the line containing ^*) 9 into a plain text file. On some systems you may have to give the file a 10 name ending with ".ma" to allow Mathematica to recognize it as a Notebook. 11 The line below identifies what version of Mathematica created this file, 12 but it can be opened using any other version as well."; 13 14 FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; 15 16 MacintoshStandardFontEncoding; 17 18 fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; 19 fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; 20 fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; 21 fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; 22 fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; 23 fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; 24 fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; 25 fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; 26 fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L0, 10, "Courier"; 27 fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L0, 10, "Courier"; 28 fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R32768, L0, 10, "Courier"; 29 fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R32768, B32768, L0, 10, "Courier"; 30 fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B32768, L0, 10, "Courier"; 31 fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w225, h227, 12, "Courier"; 32 fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; 33 fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; 34 fontset = leftheader, inactive, L2, 12, "Times"; 35 fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; 36 fontset = leftfooter, inactive, L2, 12, "Times"; 37 fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; 38 fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; 39 fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; 40 fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; 41 fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; 42 fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; 43 fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; 44 fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; 45 automaticGrouping; currentKernel; 46 ] 47 :[font = subsubsection; inactive; preserveAspect] 48 $Id: MakeMake.ma,v 1.1 2001/09/17 18:20:38 paklein Exp $ 49 :[font = subsection; inactive; Cclosed; preserveAspect; startGroup] 50 functions: 51 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] 52 notes: 53 :[font = text; inactive; preserveAspect] 54 (1) $(PWD): 55 On wallaby2, this macro gives the current directly running the makefile commands while on the DEC, this macro returns the top level working directory. 56 ;[s] 57 3:0,0;4,1;10,0;163,-1; 58 2:2,12,9,Times,0,10,0,0,0;1,12,9,Courier,1,10,0,0,0; 59 :[font = text; inactive; preserveAspect] 60 (2) MACROS as targets 61 GNU make does not like targets that are defined by MACROS passed in as "MACRO = $(MACRO)". 62 ;[s] 63 3:0,0;4,1;21,0;113,-1; 64 2:2,12,9,Times,0,10,0,0,0;1,12,9,Courier,1,10,0,0,0; 65 :[font = text; inactive; preserveAspect] 66 (3) don't "touch": 67 "touch" produces a funny time stamp (DEC, ALASKA, SIBERIA) that is many minutes different from the "current" time. Confused file dependencies. 68 ;[s] 69 3:0,0;3,1;18,0;162,-1; 70 2:2,12,9,Times,0,10,0,0,0;1,12,9,Courier,1,10,0,0,0; 71 :[font = text; inactive; preserveAspect; endGroup] 72 (4) subdirectories as targets 73 A number of platforms did not show reliable behavior when processing subdirectories as targets. Use for loops instead. 74 ;[s] 75 5:0,0;4,1;29,0;130,1;133,0;149,-1; 76 2:3,12,9,Times,0,10,0,0,0;2,12,9,Courier,1,10,0,0,0; 77 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] 78 basics: 79 :[font = input; preserveAspect; startGroup] 80 Root[string_String] := Module[ 81 82 {pos}, 83 84 pos = Flatten[StringPosition[string, "."]]; 85 If[Length[pos] == 0, 86 string, 87 StringDrop[string, Last[pos] - StringLength[string] - 1] 88 ] 89 ]; 90 :[font = message; inactive; preserveAspect; endGroup] 91 General::spell1: 92 Possible spelling error: new symbol name "Root" is similar to existing symbol 93 "Roots". 94 :[font = input; preserveAspect; endGroup] 95 Extension[string_String] := StringDrop[string, StringLength[Root[string]]] 96 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] 97 insert make files into directory structure: 98 :[font = text; inactive; preserveAspect] 99 "homedir" gets the top level driver makefile, while all subdirectories get compile makefiles with recursive calls to nested directories. object files are assumed to be generated from every ".cpp" file. 100 :[font = input; preserveAspect] 101 MakeMake[sourcetop_String] := MakeMake[Directory[], sourcetop]; 102 :[font = input; preserveAspect] 103 MakeMake[homedir_String, sourcetop_String] := Module[ 104 105 {directories, src, fp}, 106 107 src = Sort[MakeMakeDir[sourcetop]] 108 109 (* 110 fp = OpenWrite["object_list"]; 111 WriteObjectList[fp, src]; 112 Close[fp] 113 *) 114 ]; 115 :[font = input; preserveAspect] 116 SourceExtensions = {".c", ".cpp", ".C", ".f", ".F"}; 117 :[font = input; preserveAspect] 118 HeaderExtensions = {".h", ".inc"}; 119 :[font = input; preserveAspect] 120 HasExtension[name_String, extensions_List] := 121 Length[Position[extensions, Extension[name]]] > 0 122 :[font = input; preserveAspect] 123 MakeMakeDir[dir_String] := Module[ 124 125 {olddir, hdr, src, subdirs, files, fp, subdirstr, spacenames}, 126 127 olddir = Directory[]; 128 SetDirectory[dir]; Print[dir]; 129 files = FileNames[]; 130 subdirs = Select[files, FileType[#1] == Directory & ]; 131 132 src = Select[Complement[files, subdirs], HasExtension[#, SourceExtensions]&]; 133 hdr = Select[Complement[files, subdirs], HasExtension[#, HeaderExtensions]&]; 134 135 subdirs = Select[subdirs, (# != "CVS" && 136 # != "unused" && 137 # != "UNUSED")& ]; 138 139 fp = OpenWrite["makefile"]; 140 WriteString[fp, "# $Id: MakeMake.ma,v 1.1 2001/09/17 18:20:38 paklein Exp $\n"]; 141 WriteString[fp, "# object directory makefile - compilation instructions\n"]; 142 WriteString[fp, "\ninclude $(MACRO_DIR)/suffix\n"]; 143 WriteString[fp, "include $(MACRO_DIR)/$(ARCH).macros\n"]; 144 145 WriteObjectList[fp, src]; 146 WriteSourceList[fp, src]; 147 WriteHeaderList[fp, hdr]; 148 149 (* warn about spaces in directory names *) 150 spacenames = Select[subdirs, (Length[Flatten[StringPosition[#," "]]] > 0)& ]; 151 If[Length[spacenames] > 0, 152 Print[""]; 153 Print["WARNING: directory names with spaces"]; 154 Map[Print["\t", #]&,spacenames]; 155 Print[""] 156 ]; 157 158 subdirstr = (StringReplace[#1, " " -> "\\ "] & ) /@ subdirs; 159 WriteSubDirList[fp, subdirstr]; 160 161 WriteString[fp, "\n# instructions for subdirectories\n"]; 162 WriteString[fp, "include $(MACRO_DIR)/subdir.targets\n"]; 163 164 WriteString[fp, "\n# dependencies\n"]; 165 WriteString[fp, "DEPEND = /dev/null\n"]; 166 WriteString[fp, "include $(DEPEND)\n"]; 167 Close[fp]; 168 169 src = Flatten[{src, MakeMakeDir /@ subdirs}]; 170 SetDirectory[olddir]; 171 src 172 ]; 173 :[font = input; preserveAspect] 174 TakeRoot[str_String] := StringTake[str, Last[StringPosition[str,"."]][[1]] - 1] 175 :[font = input; preserveAspect] 176 WriteObjectList[fp_OutputStream, src_List] := Module[ 177 178 {dotofiles, i}, 179 180 dotofiles = Map[StringJoin[TakeRoot[#], ".o"]&, src]; 181 182 WriteString[fp, "\n# objects\n"]; 183 If[Length[dotofiles] > 0, 184 185 WriteString[fp, "OBJ = \\\n"]; 186 Do[ 187 WriteString[fp, 188 StringJoin["\t", dotofiles[[i]], 189 If[i < Length[dotofiles], " \\\n", "\n"] 190 ] 191 ], {i, Length[dotofiles]}]; 192 WriteString[fp, "OBJ_LINK = $(OBJ)\n"]; 193 WriteString[fp, "DEP = $(OBJ:.o=.d)\n"]; 194 195 (* empty lists *) 196 WriteString[fp, "#OBJ = dummy\n"]; 197 WriteString[fp, "#OBJ_LINK =\n"]; 198 WriteString[fp, "#DEP = /dev/null\n"] 199 200 ,(* no object files *) 201 WriteString[fp, "#OBJ = \n"]; 202 WriteString[fp, "#OBJ_LINK = $(OBJ)\n"]; 203 WriteString[fp, "#DEP = $(OBJ:.o=.d)\n"]; 204 WriteString[fp, "OBJ = dummy\n"]; 205 WriteString[fp, "OBJ_LINK =\n"]; 206 WriteString[fp, "DEP = /dev/null\n"] 207 ] 208 ]; 209 :[font = input; preserveAspect] 210 WriteSourceList[fp_OutputStream, src_List] := Module[ 211 212 {i}, 213 214 WriteString[fp, "\n# sources\n"]; 215 If[Length[src] > 0, 216 WriteString[fp, "SRC = \\\n"]; 217 Do[ 218 WriteString[fp, 219 StringJoin["\t", src[[i]], 220 If[i < Length[src], " \\\n", "\n"] 221 ] 222 ], {i, Length[src]}] 223 224 ,(* no source files *) 225 226 WriteString[fp, "#SRC = \n"] 227 ] 228 ]; 229 :[font = input; preserveAspect] 230 WriteHeaderList[fp_OutputStream, hdr_List] := Module[ 231 232 {i}, 233 234 WriteString[fp, "\n# headers\n"]; 235 If[Length[hdr] > 0, 236 WriteString[fp, "HDR = \\\n"]; 237 Do[ 238 WriteString[fp, 239 StringJoin["\t", hdr[[i]], 240 If[i < Length[hdr], " \\\n", "\n"] 241 ] 242 ], {i, Length[hdr]}]; 243 244 WriteString[fp, "HDR_LINK = $(HDR:.h=.h_link)\n"] 245 246 ,(* no header files *) 247 248 WriteString[fp, "#HDR = \n"]; 249 WriteString[fp, "#HDR_LINK = $(HDR:.h=.h_link)\n"] 250 ] 251 ]; 252 :[font = input; preserveAspect] 253 WriteSubDirList[fp_OutputStream, subdir_List] := Module[ 254 255 {i}, 256 257 WriteString[fp, "\n# subdirectories\n"]; 258 If[Length[subdir] > 0, 259 WriteString[fp, "SUB_DIR = \\\n"]; 260 Do[ 261 WriteString[fp, 262 StringJoin["\t", subdir[[i]], 263 If[i < Length[subdir], " \\\n", "\n"] 264 ] 265 ], {i, Length[subdir]}]; 266 WriteString[fp, "subdir_driver: subdir_loop\n"]; 267 WriteString[fp, "# SUB_DIR is empty\n"]; 268 WriteString[fp, "#subdir_driver: \n"] 269 270 ,(* no subdir files *) 271 272 WriteString[fp, "SUB_DIR = \n"]; 273 WriteString[fp, "#subdir_driver: subdir_loop\n"]; 274 WriteString[fp, "# SUB_DIR is empty\n"]; 275 WriteString[fp, "subdir_driver: \n"] 276 ] 277 ]; 278 :[font = input; preserveAspect] 279 WriteMacros[fp_OutputStream] := Module[ 280 281 {}, 282 283 WriteString[fp, "\nMACROS = \\\n"]; 284 WriteString[fp, "\t\"MAKE = $(MAKE)\" \\\n"]; 285 WriteString[fp, "\t\"MAKE_OPTS = $(MAKE_OPTS)\" \\\n"]; 286 WriteString[fp, "\t\"INC_DIR = $(INC_DIR)\" \\\n"]; 287 WriteString[fp, "\t\"OBJ_DIR = $(OBJ_DIR)\" \\\n"]; 288 WriteString[fp, "\t\"LIB_DIR = $(LIB_DIR)\" \\\n"]; 289 WriteString[fp, "\t\"TR = $(TR)\" \\\n"]; 290 WriteString[fp, "\t\"COMP_CC = $(COMP_CC)\" \\\n"]; 291 WriteString[fp, "\t\"COMP_C = $(COMP_C)\" \\\n"]; 292 WriteString[fp, "\t\"COMP_F = $(COMP_F)\" \\\n"]; 293 WriteString[fp, "\t\"CFLAGS_C = $(CFLAGS_C)\" \\\n"]; 294 WriteString[fp, "\t\"CFLAGS_CC = $(CFLAGS_CC)\" \\\n"]; 295 WriteString[fp, "\t\"CFLAGS_F = $(CFLAGS_F)\" \\\n"]; 296 WriteString[fp, "\t\"LIBRARY = $(LIBRARY)\" \\\n"]; 297 WriteString[fp, "\t\"AR = $(AR)\" \\\n"]; 298 WriteString[fp, "\t\"ARFLAGS = $(ARFLAGS)\" \\\n"]; 299 WriteString[fp, "\t\"RM = $(RM)\" \\\n"]; 300 WriteString[fp, "\t\"RM_FILES = $(RM_FILES)\" \\\n"]; 301 WriteString[fp, "\t\"LN = $(LN)\" \\\n"]; 302 WriteString[fp, "\t\"MAKE_DEPEND = $(MAKE_DEPEND)\" \\\n"]; 303 WriteString[fp, "\t\"DEPEND_PATH = $(DEPEND_PATH)\" \\\n"]; 304 WriteString[fp, "\t\"DEPEND = $(DEPEND)\" \\\n"]; 305 WriteString[fp, "\t\"ECHO = $(ECHO)\" \\\n"]; 306 WriteString[fp, "\t\"CAT = $(CAT)\"\n"]; 307 308 WriteString[fp, "\n# debugging\n"]; 309 WriteString[fp, "echo_all:\n"]; 310 WriteString[fp, "\t@ $(ECHO) \"MAKE = $(MAKE)\"\n"]; 311 WriteString[fp, "\t@ $(ECHO) \"MAKE_OPTS = $(MAKE_OPTS)\"\n"]; 312 WriteString[fp, "\t@ $(ECHO) \"INC_DIR = $(INC_DIR)\"\n"]; 313 WriteString[fp, "\t@ $(ECHO) \"OBJ_DIR = $(OBJ_DIR)\"\n"]; 314 WriteString[fp, "\t@ $(ECHO) \"LIB_DIR = $(LIB_DIR)\"\n"]; 315 WriteString[fp, "\t@ $(ECHO) \"TR = $(TR)\"\n"]; 316 WriteString[fp, "\t@ $(ECHO) \"COMP_C = $(COMP_C)\"\n"]; 317 WriteString[fp, "\t@ $(ECHO) \"COMP_CC = $(COMP_CC)\"\n"]; 318 WriteString[fp, "\t@ $(ECHO) \"COMP_F = $(COMP_F)\"\n"]; 319 WriteString[fp, "\t@ $(ECHO) \"CFLAGS_C = $(CFLAGS_C)\"\n"]; 320 WriteString[fp, "\t@ $(ECHO) \"CFLAGS_CC = $(CFLAGS_CC)\"\n"]; 321 WriteString[fp, "\t@ $(ECHO) \"CFLAGS_F = $(CFLAGS_F)\"\n"]; 322 WriteString[fp, "\t@ $(ECHO) \"LIBRARY = $(LIBRARY)\"\n"]; 323 WriteString[fp, "\t@ $(ECHO) \"AR = $(AR)\"\n"]; 324 WriteString[fp, "\t@ $(ECHO) \"ARFLAGS = $(ARFLAGS)\"\n"]; 325 WriteString[fp, "\t@ $(ECHO) \"RM = $(RM)\"\n"]; 326 WriteString[fp, "\t@ $(ECHO) \"RM_FILES = $(RM_FILES)\"\n"]; 327 WriteString[fp, "\t@ $(ECHO) \"LN = $(LN)\"\n"]; 328 WriteString[fp, "\t@ $(ECHO) \"MAKE_DEPEND = $(MAKE_DEPEND)\"\n"]; 329 WriteString[fp, "\t@ $(ECHO) \"DEPEND_PATH = $(DEPEND_PATH)\"\n"]; 330 WriteString[fp, "\t@ $(ECHO) \"DEPEND = $(DEPEND)\"\n"]; 331 WriteString[fp, "\t@ $(ECHO) \"ECHO = $(ECHO)\"\n"]; 332 WriteString[fp, "\t@ $(ECHO) \"CAT = $(CAT)\"\n"] 333 ]; 334 :[font = input; preserveAspect] 335 WriteClean[fp_OutputStream, dirs_List] := Module[ 336 337 {i}, 338 339 WriteString[fp, "\nclean:\n"]; 340 WriteString[fp, "\t-@ $(RM) $(RM_FILES)\n"]; 341 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = clean\"\n"] 342 343 (* 344 If[Length[dirs] > 0, 345 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = clean\"\n"], 346 WriteString[fp, "#\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = clean\"\n"] 347 ] 348 *) 349 350 (* 351 WriteString[fp, "\nclean_all:\n"]; 352 WriteString[fp, "\t-@ $(CLEAN_RM) $(CLEAN_FILES)\n"]; 353 If[Length[dirs] > 0, 354 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = clean_all\" \\\n"]; 355 WriteString[fp, "\t\"CLEAN_RM = $(CLEAN_RM)\" \\\n"]; 356 WriteString[fp, "\t\"CLEAN_FILES = $(CLEAN_FILES)\"\n"] 357 ] 358 *) 359 ]; 360 :[font = input; preserveAspect] 361 WriteDepend[fp_OutputStream, src_List, dirs_List] := Module[ 362 363 {i}, 364 365 WriteString[fp, "\ndepend_init: all.depend\n"]; 366 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = depend_init\"\n"]; 367 368 (* 369 If[Length[dirs] > 0, 370 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = depend_init\"\n"], 371 WriteString[fp, "#\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = depend_init\"\n"] 372 ]; 373 *) 374 375 (* local depend file *) 376 WriteString[fp, "\nall.depend: $(DEP)\n"]; 377 WriteString[fp, "\t@ $(ECHO) \" $(CAT): $(DEP) > all.depend\"; $(CAT) $(DEP) > all.depend\n"] 378 ]; 379 :[font = input; preserveAspect] 380 WriteHeaders[fp_OutputStream, hdr_List, dirs_List] := Module[ 381 382 {i}, 383 384 WriteString[fp, "\nheaders: $(HDR_LINK)\n"]; 385 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = headers\"\n"] 386 387 (* 388 If[Length[dirs] > 0, 389 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = headers\"\n"], 390 WriteString[fp, "#\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = headers\"\n"] 391 ] 392 *) 393 ]; 394 :[font = input; preserveAspect] 395 WriteObjects[fp_OutputStream, src_List, dirs_List] := Module[ 396 397 {}, 398 399 WriteString[fp, "\nobjects: all.depend\n"]; 400 WriteString[fp, "\t@ $(MAKE) $(MACROS) update_objects\n"]; 401 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = objects\"\n"]; 402 WriteString[fp, "\nupdate_objects: $(OBJ)\n"] 403 404 (* 405 WriteString[fp, "\nobjects:", If[Length[src] > 0," all.depend $(OBJ)\n","\n"]]; 406 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = objects\"\n"] 407 *) 408 409 (* 410 If[Length[dirs] > 0, 411 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = objects\"\n"], 412 WriteString[fp, "#\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = objects\"\n"] 413 ] 414 *) 415 ]; 416 :[font = text; inactive; preserveAspect] 417 This leads to an order N^2 time to update the library since each call requires a search: 418 :[font = input; inactive; preserveAspect] 419 WriteArchive[fp_OutputStream, src_List, dirs_List] := Module[ 420 421 {}, 422 423 WriteString[fp, "\nlibrary:\n"]; 424 WriteString[fp, "\t@ $(AR) $(ARFLAGS) $(LIBRARY) $(OBJ_LINK)\n"]; 425 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = library\"\n"] 426 427 (* 428 WriteString[fp, "library_local:\n"]; 429 If[Length[src] > 0, 430 WriteString[fp, "\t@ $(AR) $(ARFLAGS) $(LIBRARY) $(OBJ)\n"], 431 WriteString[fp, "#\t@ $(AR) $(ARFLAGS) $(LIBRARY) $(OBJ)\n"] 432 ]; 433 WriteString[fp, "library_subdir:\n"]; 434 If[Length[dirs] > 0, 435 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = library\"\n"], 436 WriteString[fp, "#\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = library\"\n"] 437 ] 438 *) 439 ]; 440 :[font = input; preserveAspect] 441 WriteArchive[fp_OutputStream, src_List, dirs_List] := Module[ 442 443 {}, 444 445 WriteString[fp, "\nlibrary:\n"]; 446 WriteString[fp, "\t@ $(ECHO) \"\\\\\" >> $(LIBRARY)\n"]; 447 WriteString[fp, "\t@ $(ECHO) \"\\t$(OBJ_LINK)\\c\" >> $(LIBRARY)\n"]; 448 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = library\"\n"] 449 450 (* 451 WriteString[fp, "library_local:\n"]; 452 If[Length[src] > 0, 453 WriteString[fp, "\t@ $(AR) $(ARFLAGS) $(LIBRARY) $(OBJ)\n"], 454 WriteString[fp, "#\t@ $(AR) $(ARFLAGS) $(LIBRARY) $(OBJ)\n"] 455 ]; 456 WriteString[fp, "library_subdir:\n"]; 457 If[Length[dirs] > 0, 458 WriteString[fp, "\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = library\"\n"], 459 WriteString[fp, "#\t@ $(MAKE) $(MACROS) subdir_driver \"COMMAND = library\"\n"] 460 ] 461 *) 462 ]; 463 :[font = input; preserveAspect] 464 WriteGroupDrivers[fp_OutputStream, hdr_List, subdir_List] := Module[ 465 466 {}, 467 468 WriteString[fp, "\n$(SUB_DIR): dummy\n"]; 469 WriteString[fp, "\t@ $(ECHO) \" cd $@\"; \\\n"]; 470 WriteString[fp, "\tcd $@; $(MAKE) $(COMMAND) $(MACROS) \"CURR_DIR = $(CURR_DIR)/$@\"\n"] 471 472 WriteString[fp, "\ndummy:\n"] 473 ]; 474 :[font = input; inactive; preserveAspect] 475 WriteGroupDrivers[fp_OutputStream, hdr_List, subdir_List] := Module[ 476 477 {}, 478 479 If[Length[subdir] > 0, 480 WriteString[fp, "\n$(SUB_DIR): force\n"]; 481 WriteString[fp, "\t@ $(ECHO) \" cd $@\"; \\\n"]; 482 WriteString[fp, "\tcd $@; $(MAKE) $(COMMAND) $(MACROS) \"CURR_DIR = $(CURR_DIR)/$@\"\n"] 483 ]; 484 WriteString[fp, "\nforce:\n"] 485 ]; 486 :[font = input; preserveAspect; endGroup] 487 WriteSuffixRules[fp_OutputStream] := Module[ 488 489 {}, 490 491 WriteString[fp, "\n# suffix rules\n"]; 492 493 WriteString[fp, "\n.c.o:\n"]; 494 WriteString[fp, "\t@ $(ECHO) \" $(COMP_C): \"$<; \\\n"]; 495 WriteString[fp, "\t$(COMP_C) $(CFLAGS_C) $<\n"]; 496 WriteString[fp, "\t@$(LN) $(CURR_DIR)/$@ $(OBJ_DIR)/$@\n"]; 497 WriteString[fp, "\t@$(ECHO) \"#touch\" > $(LIB_DIR)/lib.junk\n"]; 498 499 WriteString[fp, "\n.cpp.o:\n"]; 500 WriteString[fp, "\t@ $(ECHO) \" $(COMP_CC): \"$<; \\\n"]; 501 WriteString[fp, "\t$(COMP_CC) $(CFLAGS_CC) $<\n"]; 502 WriteString[fp, "\t@$(LN) $(CURR_DIR)/$@ $(OBJ_DIR)/$@\n"]; 503 WriteString[fp, "\t@$(ECHO) \"#touch\" > $(LIB_DIR)/lib.junk\n"]; 504 505 WriteString[fp, "\n.C.o:\n"]; 506 WriteString[fp, "\t@ $(ECHO) \" $(COMP_CC): \"$<; \\\n"]; 507 WriteString[fp, "\t$(COMP_CC) $(CFLAGS_CC) $<\n"]; 508 WriteString[fp, "\t@$(LN) $(CURR_DIR)/$@ $(OBJ_DIR)/$@\n"]; 509 WriteString[fp, "\t@$(ECHO) \"#touch\" > $(LIB_DIR)/lib.junk\n"]; 510 511 WriteString[fp, "\n.f.o:\n"]; 512 WriteString[fp, "\t@ $(ECHO) \" $(COMP_F): \"$<; \\\n"]; 513 WriteString[fp, "\t$(COMP_F) $(CFLAGS_F) $<\n"]; 514 WriteString[fp, "\t@$(LN) $(CURR_DIR)/$@ $(OBJ_DIR)/$@\n"]; 515 WriteString[fp, "\t@$(ECHO) \"#touch\" > $(LIB_DIR)/lib.junk\n"]; 516 517 WriteString[fp, "\n.F.o:\n"]; 518 WriteString[fp, "\t@ $(ECHO) \" $(COMP_F): \"$<; \\\n"]; 519 WriteString[fp, "\t$(COMP_F) $(CFLAGS_F) $<\n"]; 520 WriteString[fp, "\t@$(LN) $(CURR_DIR)/$@ $(OBJ_DIR)/$@\n"]; 521 WriteString[fp, "\t@$(ECHO) \"#touch\" > $(LIB_DIR)/lib.junk\n"]; 522 523 WriteString[fp, "\n.h.h_link:\n"]; 524 WriteString[fp, "\t@ $(ECHO) \" $(LN): \"$<; \\\n"]; 525 WriteString[fp, "\t$(LN) $(CURR_DIR)/$< $(INC_DIR)/$<\n"]; 526 527 WriteString[fp, "\n.c.d:\n"]; 528 WriteString[fp, "\t@ $(ECHO) \" $(MAKE_DEPEND): \"$<; \\\n"]; 529 WriteString[fp, "\t$(ECHO) \"\" > $@; \\\n"]; 530 WriteString[fp, "\t$(MAKE_DEPEND) $(DEPEND_PATH) -f$@ $<\n"]; 531 532 WriteString[fp, "\n.cpp.d:\n"]; 533 WriteString[fp, "\t@ $(ECHO) \" $(MAKE_DEPEND): \"$<; \\\n"]; 534 WriteString[fp, "\t$(ECHO) \"# DO NOT DELETE\" > $@; \\\n"]; 535 WriteString[fp, "\t$(MAKE_DEPEND) $(DEPEND_PATH) -f$@ $<\n"]; 536 537 WriteString[fp, "\n.C.d:\n"]; 538 WriteString[fp, "\t@ $(ECHO) \" $(MAKE_DEPEND): \"$<; \\\n"]; 539 WriteString[fp, "\t$(ECHO) \"# DO NOT DELETE\" > $@; \\\n"]; 540 WriteString[fp, "\t$(MAKE_DEPEND) $(DEPEND_PATH) -f$@ $<\n"]; 541 542 WriteString[fp, "\n.f.d:\n"]; 543 WriteString[fp, "\t@ $(ECHO) \" $(MAKE_DEPEND): \"$<; \\\n"]; 544 WriteString[fp, "\t$(ECHO) \"# DO NOT DELETE\" > $@; \\\n"]; 545 WriteString[fp, "\t$(MAKE_DEPEND) $(DEPEND_PATH) -f$@ $<\n"]; 546 547 WriteString[fp, "\n.F.d:\n"]; 548 WriteString[fp, "\t@ $(ECHO) \" $(MAKE_DEPEND): \"$<; \\\n"]; 549 WriteString[fp, "\t$(ECHO) \"# DO NOT DELETE\" > $@; \\\n"]; 550 WriteString[fp, "\t$(MAKE_DEPEND) $(DEPEND_PATH) -f$@ $<\n"] 551 ]; 552 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] 553 remove make files: 554 :[font = input; preserveAspect] 555 UnMakeMake[] := UnMakeMake[Directory[]] 556 :[font = input; preserveAspect] 557 UnMakeMake[homedir_String] := Module[ 558 559 {files, dirs, makefile, currdir, fullpath}, 560 561 currdir = Directory[]; 562 fullpath = File /. FileInformation[homedir]; 563 SetDirectory[fullpath]; 564 Print[fullpath]; 565 files = FileNames[]; 566 dirs = Select[files, (FileType[#1] == Directory && # != "CVS") & ]; 567 (DeleteIfPresent[files, #1] & ) /@ {"Icon\n", "makefile", "makefile~", "makefile.bak"}; 568 If[Length[Flatten[Position[dirs, "ii_files"]]] > 0, 569 Print[SetDirectory["ii_files"]]; 570 DeleteFile["*.ii"]; 571 SetDirectory[fullpath]; 572 DeleteDirectory["ii_files"] 573 ]; 574 575 UnMakeMake /@ dirs; 576 SetDirectory[currdir] 577 ]; 578 :[font = input; preserveAspect; endGroup; endGroup] 579 DeleteIfPresent[files_List, killfile_String] := 580 If[Length[Flatten[Position[files, killfile]]] > 0, DeleteFile[killfile]]; 581 :[font = subsection; inactive; preserveAspect; startGroup] 582 projects: 583 :[font = subsubsection; inactive; preserveAspect; startGroup] 584 module: 585 :[font = input; preserveAspect; startGroup] 586 SetDirectory["uster:users (mac os 9):tahoe:home"] 587 :[font = output; output; inactive; preserveAspect; endGroup] 588 "Uster:USERS (Mac OS 9):tahoe:home" 589 ;[o] 590 Uster:USERS (Mac OS 9):tahoe:home 591 :[font = input; preserveAspect; startGroup] 592 TableForm[dirs = FileNames[], TableSpacing -> {0,3}] 593 :[font = output; output; inactive; preserveAspect; endGroup] 594 TableForm[{"aztec", "benchmark", "blue", "CBLAS", ".DS_Store", "f2c", "gonzo", "gui\ 595 596 de.user", "html", "macros", "metis", "spooles", "spoolesMPI", "spoolesMT", "tah\ 597 598 oe.HEAD", "toolbox"}, TableSpacing -> {0, 3}] 599 ;[o] 600 aztec 601 benchmark 602 blue 603 CBLAS 604 .DS_Store 605 f2c 606 gonzo 607 guide.user 608 html 609 macros 610 metis 611 spooles 612 spoolesMPI 613 spoolesMT 614 tahoe.HEAD 615 toolbox 616 :[font = input; preserveAspect] 617 dirs = Complement[dirs, {"macros"}] 618 :[font = text; inactive; preserveAspect] 619 one: 620 :[font = input; preserveAspect; startGroup] 621 Map[(SetDirectory[#]; 622 UnMakeMake["src"]; 623 MakeMake["src"]; 624 SetDirectory["::"])&, {"gonzo"}]; 625 :[font = print; inactive; preserveAspect; endGroup] 626 Uster:USERS (Mac OS 9):tahoe:home:gonzo:src 627 src 628 :[font = text; inactive; preserveAspect] 629 process all of the modules: 630 :[font = input; preserveAspect; endGroup] 631 Map[(SetDirectory[#]; 632 UnMakeMake["src"]; 633 MakeMake["src"]; 634 SetDirectory["::"])&, dirs]; 635 :[font = subsubsection; inactive; Cclosed; preserveAspect; startGroup] 636 blue: 637 :[font = input; preserveAspect; startGroup] 638 SetDirectory["uster:users (mac os 9):tahoe:home"] 639 :[font = output; output; inactive; preserveAspect; endGroup] 640 "Uster:USERS (Mac OS 9):tahoe:home" 641 ;[o] 642 Uster:USERS (Mac OS 9):tahoe:home 643 :[font = input; preserveAspect; startGroup] 644 TableForm[dirs = FileNames[], TableSpacing -> {0,3}] 645 :[font = output; output; inactive; preserveAspect; endGroup] 646 TableForm[{"aztec", "benchmark", "blue", "CBLAS", ".DS_Store", "f2c", "guide.user"\ 647 648 , "html", "macros", "spooles", "spoolesMPI", "tahoe", "tahoe.stable", "toolbox"} 649 650 , TableSpacing -> {0, 3}] 651 ;[o] 652 aztec 653 benchmark 654 blue 655 CBLAS 656 .DS_Store 657 f2c 658 guide.user 659 html 660 macros 661 spooles 662 spoolesMPI 663 tahoe 664 tahoe.stable 665 toolbox 666 :[font = input; preserveAspect; startGroup] 667 dirs = Complement[dirs, {"macros"}] 668 :[font = output; output; inactive; preserveAspect; endGroup] 669 {"aztec", "benchmark", "blue", "CBLAS", ".DS_Store", "f2c", "guide.user", "html"\ 670 671 , "spooles", "spoolesMPI", "tahoe", "tahoe.stable", "toolbox"} 672 ;[o] 673 {aztec, benchmark, blue, CBLAS, .DS_Store, f2c, guide.user, html, spooles, 674 675 spoolesMPI, tahoe, tahoe.stable, toolbox} 676 :[font = text; inactive; preserveAspect] 677 one: 678 :[font = input; preserveAspect; startGroup] 679 Map[(SetDirectory[#]; 680 UnMakeMake["src"]; 681 MakeMake["src"]; 682 SetDirectory["::"])&, {"blue"}]; 683 :[font = print; inactive; preserveAspect; endGroup] 684 Uster:USERS (Mac OS 9):tahoe:home:blue:src 685 Uster:USERS (Mac OS 9):tahoe:home:blue:src:dynamics 686 Uster:USERS (Mac OS 9):tahoe:home:blue:src:energy 687 Uster:USERS (Mac OS 9):tahoe:home:blue:src:lattice 688 Uster:USERS (Mac OS 9):tahoe:home:blue:src:main 689 src 690 dynamics 691 energy 692 lattice 693 main 694 :[font = text; inactive; preserveAspect] 695 process all of the modules: 696 :[font = input; preserveAspect; endGroup; endGroup] 697 Map[(SetDirectory[#]; 698 UnMakeMake["src"]; 699 MakeMake["src"]; 700 SetDirectory["::"])&, dirs]; 701 ^*) This page was automatically generated by the LXR engine. Visit the LXR main site for more information. |