DEADSOFTWARE

cpmake: find compiler/linker executable using DswProcs.Directory.GetPath
[cpc.git] / src / generic / Dsw / Mod / MakeMain.cp
index 04388d2a574ddde1ce50e7968e6b0b5c32867c0c..bd06566f501cd9a00c76bd1fa0af2f0704680a2a 100644 (file)
@@ -107,6 +107,8 @@ MODULE DswMakeMain;
     | 22: msg := "linker terminated with code ^2"
     | 23: msg := "unable to execute linker"
     | 24: msg := "trap occured"
+    | 25: msg := "compiler not installed"
+    | 26: msg := "linker not installed"
     ELSE
       Strings.IntToString(err, msg)
     END;
@@ -295,6 +297,7 @@ MODULE DswMakeMain;
     Log.String("  -Xi path     Use executable file for internal linker (native only)"); Log.Ln;
     Log.String("  -Cg params   Pass parameters to Component Pasacal compiler directly"); Log.Ln;
     Log.String("  -Ci params   Pass parameters to internal linker directly"); Log.Ln;
+    Log.String("  -II          Trap on user interrupt"); Log.Ln;
     Log.String("  -a           Enable automatic dependency resolution"); Log.Ln;
     Log.String("  -o name      Generate executable file"); Log.Ln;
     Log.String("  -j num       Specifies the number of jobs to run simultaneously"); Log.Ln;
@@ -376,12 +379,22 @@ MODULE DswMakeMain;
     END
   END ParseExternalOpts;
 
+  PROCEDURE ParseInfoOpts;
+  BEGIN
+    CASE DswOpts.GetOpt("I") OF
+    | "I": Kernel.intTrap := TRUE
+    | ":": Error(10, "-I" + DswOpts.str, "", 0)
+    | "?": Error(11, "-I" + DswOpts.str, "", 0)
+    | 0X: Error(11, "-I", "", 0)
+    END
+  END ParseInfoOpts;
+
   PROCEDURE ParseArgs;
   BEGIN
     exe := NIL; auto := FALSE; jobs := 1; def.next := NIL; mno := 0; rno := 0;
     processor := anymach; os := anyos; compiler := anycp;
     LOOP
-      CASE DswOpts.GetOpt("ao:j:D:U:TCXhV") OF
+      CASE DswOpts.GetOpt("ao:j:D:U:TCXIhV") OF
       | "a": auto := TRUE
       | "o": exe := DswOpts.str
       | "j": jobs := MIN(MAX(StrToInt(DswOpts.str, 1), 1), maxJobs)
@@ -392,6 +405,7 @@ MODULE DswMakeMain;
       | "T": ParseTargetOpts
       | "C": ParseCommandOpts
       | "X": ParseExternalOpts
+      | "I": ParseInfoOpts
       | ":": Error(10, "-" + DswOpts.str, "", 0)
       | "?": Error(11, "-" + DswOpts.str, "", 0)
       | "$": AddModule(DswOpts.str, def)
@@ -426,13 +440,19 @@ MODULE DswMakeMain;
     IF (exe # NIL) & (exe^ = "") THEN
       Error(19, "", "", 0)
     END;
-    IF cpcExe = NIL THEN
-      IF compiler = cpnative THEN cpcExe := NewStr("cpc486")
-      ELSIF compiler = cpfront THEN cpcExe := NewStr("cpfront")
+    IF (cpcExe = NIL) & (compiler # anycp) THEN
+      IF compiler = cpnative THEN cpcExe := DswProcs.dir.GetPath("cpc486")
+      ELSIF compiler = cpfront THEN cpcExe := DswProcs.dir.GetPath("cpfront")
+      END;
+      IF cpcExe = NIL THEN
+        Error(25, "", "", 0)
       END
     END;
-    IF cplExe = NIL THEN
-      IF linker = dev2 THEN cplExe := NewStr("cpl486") END
+    IF (cplExe = NIL) & (linker # anyint) THEN
+      cplExe := DswProcs.dir.GetPath("cpl486");
+      IF cplExe = NIL THEN
+        Error(26, "", "", 0)
+      END
     END
   END CheckParams;
 
@@ -764,13 +784,6 @@ MODULE DswMakeMain;
       w.PutParam("-define-"); w.PutParam("M68K");
     END;
     CASE os OF
-    | anyos:
-      w.PutParam("-define-"); w.PutParam("POSIX");
-      w.PutParam("-define-"); w.PutParam("LINUX");
-      w.PutParam("-define-"); w.PutParam("FREEBSD");
-      w.PutParam("-define-"); w.PutParam("OPENBSD");
-      w.PutParam("-define-"); w.PutParam("WIN32");
-      w.PutParam("-define-"); w.PutParam("DARWIN");
     | linux:
       w.PutParam("-define+"); w.PutParam("POSIX");
       w.PutParam("-define+"); w.PutParam("LINUX");
@@ -818,6 +831,13 @@ MODULE DswMakeMain;
       w.PutParam("-define-"); w.PutParam("WIN32");
       w.PutParam("-define-"); w.PutParam("CYGWIN");
       w.PutParam("-define+"); w.PutParam("DARWIN");
+    ELSE
+      w.PutParam("-define-"); w.PutParam("POSIX");
+      w.PutParam("-define-"); w.PutParam("LINUX");
+      w.PutParam("-define-"); w.PutParam("FREEBSD");
+      w.PutParam("-define-"); w.PutParam("OPENBSD");
+      w.PutParam("-define-"); w.PutParam("WIN32");
+      w.PutParam("-define-"); w.PutParam("DARWIN");
     END;
     CASE linker OF
     | dev2:
@@ -966,5 +986,7 @@ MODULE DswMakeMain;
 
 BEGIN
   NEW(def);
+  ASSERT(def # NIL, 100);
+  Kernel.intTrap := FALSE;
   Kernel.Start(Main)
 END DswMakeMain.