home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Modula / Utilities / Makefiles / Make.MOD < prev    next >
Encoding:
Text File  |  1988-01-24  |  2.3 KB  |  74 lines  |  [TEXT/????]

  1. MODULE Make;
  2.  
  3.   (*
  4.    * MAKEMAKE.  Create a MAKEFILE for a MODULA-2 program.
  5.    *
  6.    * Written by Steve Tynor, 30 September 1986.
  7.    *            UUCP  : tynor@gitpyr
  8.    *            USNAIL: 2550 Akers Mill Rd. T-2, Atlanta GA. 30339
  9.    *
  10.    * Permission is granted to distribute, copy and change this program as long
  11.    * as this notice remains...
  12.    ---
  13.    *
  14.    * Make.
  15.    * Modified and extended for MacMETH by :
  16.    * J?rgen N?rgaard, 23 october 1987.
  17.    *            UUCP  : jnp@daimi.dk
  18.    *            MAIL  : Dybb?lvej 29, v?r. 2+3, 8240 Risskov, DENMARK
  19.    *
  20.    * Essentially only the parser remains from the original.
  21.    * Extensions are a dependency-tree and a make-like facility.
  22.    *
  23.    *)
  24.  
  25.   (* Usage :
  26.    * Enter the name of the module,
  27.    *    "name" (assumed to have extension .MOD) to make.
  28.    * Output (if successful) name.CMD file for the compiler-utility 'cmd-1'
  29.    *)
  30.  
  31. IMPORT System, InOut, StringLib0, FileSystem, MakeForest, MakeParser;
  32.  
  33. VAR
  34.   modulename : MakeForest.NameString;
  35.   filename   : System.Path;
  36.   thisEntity : MakeForest.EntityPtr;
  37.   makeFile   : FileSystem.File;
  38.   success    : BOOLEAN;
  39.   i          : INTEGER;
  40.   
  41. BEGIN
  42.   InOut.WriteString ("Make which MODULE ? ");
  43.   InOut.ReadString(modulename);
  44.   WHILE (InOut.termCH # 3C) DO (* Not terminated *)
  45.     InOut.WriteLn;
  46.     MakeForest.RemoveTree(MakeForest.root);
  47.     IF MakeForest.AddModule(modulename, MakeForest.root, thisEntity) THEN
  48.       MakeParser.ParseModule (modulename, MakeParser.main,
  49.                               thisEntity, filename, success);
  50.       IF success THEN
  51.         i := StringLib0.Length(filename) - 1;
  52.         filename[i - 3] := '.'; filename[i - 2] := 'C';
  53.         filename[i - 1] := 'M'; filename[i]     := 'D';
  54.         FileSystem.Lookup(makeFile, filename, TRUE);
  55.         IF NOT (makeFile.res = FileSystem.done) THEN
  56.           InOut.WriteString('Could not open .CMD-file');
  57.         ELSE
  58.           MakeForest.Make(MakeForest.root, makeFile);
  59.           FileSystem.Close(makeFile);
  60.           InOut.WriteString('+ ');
  61.           InOut.WriteString(filename);
  62.         END;
  63.       ELSE
  64.         InOut.WriteString('Missing file');
  65.       END;
  66.     ELSE
  67.       InOut.WriteString('Serious error! (in "MakeForest")');
  68.     END;
  69.     InOut.WriteLn;
  70.     InOut.WriteString ("Make which MODULE ? ");
  71.     InOut.ReadString(modulename); 
  72.   END;
  73. END Make.
  74.