From eae63e255f4fbbc1cc72be7e6a25b17e493d50cc Mon Sep 17 00:00:00 2001 From: DeaDDooMER Date: Tue, 25 Feb 2020 16:02:12 +0300 Subject: [PATCH] cpmake: add more info options --- src/generic/Dsw/Mod/MakeMain.cp | 77 +++++++++++++++++++++++++++------ 1 file changed, 63 insertions(+), 14 deletions(-) diff --git a/src/generic/Dsw/Mod/MakeMain.cp b/src/generic/Dsw/Mod/MakeMain.cp index 9cb6a98..a5ba7c0 100644 --- a/src/generic/Dsw/Mod/MakeMain.cp +++ b/src/generic/Dsw/Mod/MakeMain.cp @@ -60,7 +60,7 @@ MODULE DswMakeMain; Module = POINTER TO RECORD name: DevCPT.Name; - path: Files.Name; + odc: Files.Name; selectors: Selector; (* with head, list of selectors for this module *) depth: INTEGER; (* 0: leaf, MAX: root *) dir: DevCPM.Directory; @@ -82,6 +82,9 @@ MODULE DswMakeMain; auto: BOOLEAN; jobs: INTEGER; exe: String; + printCompileModList: BOOLEAN; + printLinkModList: BOOLEAN; + printCompileFileList: BOOLEAN; PROCEDURE Error (e: INTEGER; IN p0, p1: ARRAY OF CHAR; i2: INTEGER); VAR msg, p2: ARRAY 128 OF CHAR; @@ -303,6 +306,12 @@ MODULE DswMakeMain; 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(" -IC Print module list for compilation and quit"); Log.Ln; + Log.String(" -IL Print module list for linking and quit"); Log.Ln; + Log.String(" -Ic Print file list for compilation and quit"); Log.Ln; +(* + Log.String(" -Il Print file list for linking and quit"); 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; @@ -386,8 +395,11 @@ MODULE DswMakeMain; PROCEDURE ParseInfoOpts; BEGIN - CASE DswOpts.GetOpt("I") OF + CASE DswOpts.GetOpt("CLcI") OF | "I": Kernel.intTrap := TRUE + | "C": printCompileModList := TRUE + | "L": printLinkModList := TRUE + | "c": printCompileFileList := TRUE | ":": Error(10, "-I" + DswOpts.str, "", 0) | "?": Error(11, "-I" + DswOpts.str, "", 0) | 0X: Error(11, "-I", "", 0) @@ -716,7 +728,7 @@ MODULE DswMakeMain; i := 0; rno := mno; WHILE (err = 0) & (i < mno) DO m := modList[i]; - GetSource(m.name$, m.dir, m.path, src); + GetSource(m.name$, m.dir, m.odc, src); IF src # NIL THEN CheckModule(m, src, ok); IF ~ok THEN INC(err) END @@ -787,7 +799,7 @@ MODULE DswMakeMain; PROCEDURE PutPathList (w: DswProcs.Process; IN par: ARRAY OF CHAR; base: DevCPM.Directory); BEGIN IF base # NIL THEN - PutPath(w, base.next); (* in revese order *) + PutPathList(w, par, base.next); (* in revese order *) w.PutParam(par); w.PutParam(base.path); END @@ -797,12 +809,12 @@ MODULE DswMakeMain; VAR w: DswProcs.Process; ok: BOOLEAN; BEGIN ASSERT(m # NIL, 20); - ASSERT(m.path # "", 21); + ASSERT(m.odc # "", 21); ASSERT(m.worker = NIL, 22); w := DswProcs.dir.New(); w.Program(cpcExe); w.PutParam("-legacy"); - PutPath(w, "-legacysymdir", m.dir); + PutPathList(w, "-legacysymdir", m.dir); PutParams(w, cpcArgs); CASE compiler OF | cpfront: @@ -885,10 +897,10 @@ MODULE DswMakeMain; ELSE w.PutParam("-define-"); w.PutParam("DEV2"); END; - w.PutParam(m.path); + w.PutParam(m.odc); w.Execute(ok); IF ok THEN - Log.String("Compile " + m.name + " (" + m.path + ")"); Log.Ln; + Log.String("Compile " + m.name + " (" + m.odc + ")"); Log.Ln; ELSE w := NIL END; @@ -952,7 +964,7 @@ MODULE DswMakeMain; ASSERT(compiler = cpnative, 22); p := DswProcs.dir.New(); p.Program(cplExe); - PutPath(w, "-legacycodedir", dirList); + PutPathList(p, "-legacycodedir", dirList); IF os # anyos THEN p.PutParam("-os"); CASE os OF @@ -1001,19 +1013,56 @@ MODULE DswMakeMain; END END Link; + PROCEDURE PrintInfo; + VAR i: INTEGER; + BEGIN + IF printCompileModList THEN + FOR i := 0 TO mno - 1 DO + Log.String(cmpList[i].name$); Log.Char(" ") + END; + Log.Ln + ELSIF printLinkModList THEN + FOR i := 0 TO mno - 1 DO + IF ~(library IN lnkList[i].flags) THEN + Log.String(lnkList[i].name$); Log.Char(" ") + END + END; + Log.Ln + ELSIF printCompileFileList THEN + FOR i := 0 TO mno - 1 DO + Log.String(cmpList[i].odc); Log.Char(" ") + END; + Log.Ln +(* ELSIF printLinkFileList THEN + FOR i := 0 TO mno - 1 DO + IF ~(library IN lnkList[i].flags) THEN + Log.String(lnkList[i].ocf); Log.Char(" ") + END + END; + Log.Ln*) + END + END PrintInfo; + PROCEDURE Main; - VAR m: Module; s: Selector; p: DswProcs.Process; ok: BOOLEAN; i, res: INTEGER; BEGIN IF Kernel.trapCount = 0 THEN ParseArgs; IF err = 0 THEN - CheckParams; - IF err = 0 THEN + IF printCompileModList OR printLinkModList OR printCompileFileList THEN + auto := TRUE; CheckDeps; IF err = 0 THEN - Compile; + PrintInfo + END + ELSE + CheckParams; + IF err = 0 THEN + CheckDeps; IF err = 0 THEN - Link + Compile; + IF err = 0 THEN + Link + END END END END -- 2.29.2