summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d04c636)
raw | patch | inline | side by side (parent: d04c636)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 25 Feb 2020 19:14:59 +0000 (22:14 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Tue, 25 Feb 2020 19:14:59 +0000 (22:14 +0300) |
src/generic/Dsw/Mod/MakeMain.cp | patch | blob | history |
index e024a3c913d0944e511175121e9b210f793d901a..f416a34ec325eb67fa826df5a4e8bb55602bc52d 100644 (file)
IMPORT Kernel, Files, Log, Strings, DswOpts, DswProcs, DswDocuments, DevCPM, DevCPT, DevCPR, DevCPS;
CONST
- version = "0.3.0";
+ version = "0.3";
modDir = "Mod";
sysDir = "System";
cpcArgs, cplArgs: StringList;
dirList: DevCPM.Directory;
auto: BOOLEAN;
+ trap: BOOLEAN;
jobs: INTEGER;
exe: String;
printCompileModList: BOOLEAN;
CASE e OF
| 0: msg := "option -D expect + or - after identifier"
| 1: msg := "option -D expect identifier"
- | 2: msg := "option -U expect identifier"
- | 3: msg := "module name must be identifier"
- | 4: msg := "expected integer" (* p0 = in str *)
+ | 2: msg := "option -U expect identifier" (* rm *)
+ | 3: msg := "invalid module name"
+ | 4: msg := "invalid integer value"
| 5: msg := "unterminated string"
| 6: msg := "unknown processor ^0"
| 7: msg := "unknown os ^0"
| 9: msg := "unknown linker ^0"
| 10: msg := "missing argument for option ^0"
| 11: msg := "unknown option ^0"
- | 12: msg := "compiler not selected"
- | 13: msg := "processor not selected"
- | 14: msg := "processor not supported by native compiler"
+ | 12: msg := "compiler not selected (use option -g<compiler>)"
+ | 13: msg := "processor not selected (use option -m<processor>)"
+ | 14: msg := "selected processor not supported by native compiler"
| 15: msg := "internal linker not required for cpfront"
- | 16: msg := "cpfront can't out executable file"
- | 17: msg := "linker not selected"
- | 18: msg := "os not selected"
- | 19: msg := "output file name can't be empty"
+ | 16: msg := "cpfront can't produce executable file"
+ | 17: msg := "linker not selected (use option -i<linker>)"
+ | 18: msg := "os not selected (use option -s<system>)"
+ | 19: msg := "specified empty file name"
| 20: msg := "recursive import of ^0 in ^1"
| 21: msg := "unable to open module ^1"
| 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"
+ | 25: msg := "compiler not installed (use option -Xg<path> to select executable)"
+ | 26: msg := "linker not installed (use option -Xi<path> to select executable)"
ELSE
Strings.IntToString(err, msg)
END;
Strings.IntToString(i2, p2);
Log.String(Kernel.argv[0]$); Log.String(": ");
Log.ParamMsg(msg, p0, p1, p2); Log.Ln;
- INC(err)
+ INC(err);
+ IF trap THEN
+ HALT(100)
+ END
END Error;
(* --------- options --------- *)
BEGIN
Log.String("Usage: cpmake [options] module..."); Log.Ln;
Log.String("Options:"); Log.Ln;
- Log.String(" -Tm cpu Generate code for specified processor"); Log.Ln;
- Log.String(" none Unknown processor (cpfront only)"); Log.Ln;
- Log.String(" 486 Intel 486"); Log.Ln;
- Log.String(" -Ts os Generate code for specified operation system"); Log.Ln;
- Log.String(" none Unknown operation system"); Log.Ln;
- Log.String(" linux Linux"); Log.Ln;
- Log.String(" -Tg compiler Specify Component Pascal compiler"); Log.Ln;
- Log.String(" native BlackBox based native code compiler"); Log.Ln;
- Log.String(" cpfront BlackBox based C code translator"); Log.Ln;
- Log.String(" -Ti linker Specify internal linker (native only)"); Log.Ln;
- Log.String(" dev2 Dev2 based ELF/PE linker"); Log.Ln;
-(*
- Log.String(" -Fp path Add path with project"); Log.Ln;
-*)
- Log.String(" -Xp path Use executable file for Component Pascal compiler"); Log.Ln;
- 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(" -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;
+ Log.String(" -a Enable automatic dependency resolution"); 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(' -D ident["+"|"-"] Add preprocessor selector'); Log.Ln;
- Log.String(" -h Print help and quit"); Log.Ln;
- Log.String(" -V Print version and quit"); Log.Ln;
+ Log.String(" -g compiler Specify Component Pascal compiler"); Log.Ln;
+ Log.String(" cpfront BlackBox based C code translator"); Log.Ln;
+ Log.String(" native BlackBox based native code compiler"); Log.Ln;
+ Log.String(" -h Print help and quit"); Log.Ln;
+ Log.String(" -i linker Specify internal linker (native only)"); Log.Ln;
+ Log.String(" dev2 Dev2 based ELF/PE linker"); Log.Ln;
+ Log.String(" -II Trap on user interrupt (debug)"); Log.Ln;
+ Log.String(" -IT Trap on first error (debug)"); 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(" -j num Specifies the number of jobs to run simultaneously"); Log.Ln;
+ Log.String(" -m cpu Generate code for specified processor"); Log.Ln;
+ Log.String(" none Unknown processor (cpfront only)"); Log.Ln;
+ Log.String(" 486 Intel 486+"); Log.Ln;
+ Log.String(" -o name Generate executable file (native only)"); Log.Ln;
+ Log.String(" -s os Generate code for specified operation system"); Log.Ln;
+ Log.String(" none Unknown operation system"); Log.Ln;
+ Log.String(" freebsd FreeBSD"); Log.Ln;
+ Log.String(" linux Linux"); Log.Ln;
+ Log.String(" openbsd OpenBSD"); Log.Ln;
+ Log.String(" win32 Windows"); Log.Ln;
+ Log.String(" -V Print version and quit"); Log.Ln;
+ Log.String(" -Xp path Use executable file for Component Pascal compiler"); Log.Ln;
+ Log.String(" -Xi path Use executable file for internal linker (native only)"); Log.Ln;
Kernel.Quit(1)
END Help;
Kernel.Quit(0)
END Version;
- PROCEDURE ParseTargetOpts;
- VAR s: DswOpts.String;
- BEGIN
- CASE DswOpts.GetOpt("m:s:g:i:") OF
- | "m":
- s := DswOpts.str;
- Strings.ToLower(s, s);
- IF s$ = "none" THEN processor := anymach
- ELSIF s$ = "486" THEN processor := mach386
- ELSIF s$ = "68k" THEN processor := mach68k
- ELSE Error(6, s, "", 0)
- END
- | "s":
- s := DswOpts.str;
- Strings.ToLower(s, s);
- IF s$ = "none" THEN os := anyos
- ELSIF s$ = "linux" THEN os := linux
- ELSIF s$ = "freebsd" THEN os := freebsd
- ELSIF s$ = "openbsd" THEN os := openbsd
- ELSIF s$ = "win32" THEN os := win32
- ELSIF s$ = "cygwin" THEN os := cygwin
- ELSIF s$ = "darwin" THEN os := darwin
- ELSE Error(7, s, "", 0)
- END
- | "g":
- s := DswOpts.str;
- Strings.ToLower(s, s);
- IF s$ = "native" THEN compiler := cpnative
- ELSIF s$ = "cpfront" THEN compiler := cpfront
- ELSE Error(8, s, "", 0)
- END
- | "i":
- s := DswOpts.str;
- Strings.ToLower(s, s);
- IF s$ = "dev2" THEN linker := dev2
- ELSE Error(9, s, "", 0)
- END
- | ":": Error(10, "-T" + DswOpts.str, "", 0)
- | "?": Error(11, "-T" + DswOpts.str, "", 0)
- | 0X: Error(11, "-T", "", 0)
- END
- END ParseTargetOpts;
-
PROCEDURE ParseCommandOpts;
BEGIN
CASE DswOpts.GetOpt("g:i:") OF
PROCEDURE ParseInfoOpts;
BEGIN
- CASE DswOpts.GetOpt("CLcI") OF
+ CASE DswOpts.GetOpt("CLcIT") OF
+ | "T": trap := TRUE
| "I": Kernel.intTrap := TRUE
| "C": printCompileModList := TRUE
| "L": printLinkModList := TRUE
END ParseFileOpts;
PROCEDURE ParseArgs;
+ VAR s: String;
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:TCXIFhV") OF
+ CASE DswOpts.GetOpt("ao:j:D:m:s:g:i:TCXIFhV") OF
| "a": auto := TRUE
| "o": exe := DswOpts.str
| "j": jobs := MIN(MAX(StrToInt(DswOpts.str, 1), 1), maxJobs)
+ | "m":
+ s := DswOpts.str;
+ Strings.ToLower(s, s);
+ IF s$ = "none" THEN processor := anymach
+ ELSIF s$ = "486" THEN processor := mach386
+ ELSIF s$ = "68k" THEN processor := mach68k
+ ELSE Error(6, s, "", 0)
+ END
+ | "s":
+ s := DswOpts.str;
+ Strings.ToLower(s, s);
+ IF s$ = "none" THEN os := anyos
+ ELSIF s$ = "linux" THEN os := linux
+ ELSIF s$ = "freebsd" THEN os := freebsd
+ ELSIF s$ = "openbsd" THEN os := openbsd
+ ELSIF s$ = "win32" THEN os := win32
+ ELSIF s$ = "cygwin" THEN os := cygwin
+ ELSIF s$ = "darwin" THEN os := darwin
+ ELSE Error(7, s, "", 0)
+ END
+ | "g":
+ s := DswOpts.str;
+ Strings.ToLower(s, s);
+ IF s$ = "native" THEN compiler := cpnative
+ ELSIF s$ = "cpfront" THEN compiler := cpfront
+ ELSE Error(8, s, "", 0)
+ END
+ | "i":
+ s := DswOpts.str;
+ Strings.ToLower(s, s);
+ IF s$ = "dev2" THEN linker := dev2
+ ELSE Error(9, s, "", 0)
+ END
| "h": Help
| "V": Version
| "D": Define(DswOpts.str, TRUE)
- | "T": ParseTargetOpts
| "C": ParseCommandOpts
| "X": ParseExternalOpts
| "I": ParseInfoOpts
BEGIN
DevCPM.Init(source);
DevCPM.symList := m.dir;
-(*
- DevCPM.codePath := m.outcode;
- DevCPM.symPath := m.outsym;
-*)
+ (*DevCPM.codePath := m.outcode;*)
+ (*DevCPM.symPath := m.outsym;*)
DevCPM.name := m.name$;
-(*
- IF m.found THEN INCL(DevCPM.options, DevCPM.comAware) END;
- IF errorTrap IN m.opts THEN INCL(DevCPM.options, DevCPM.trap) END;
- IF oberon IN m.opts THEN INCL(DevCPM.options, DevCPM.oberon) END;
-*)
+ INCL(DevCPM.options, DevCPM.comAware);
+ IF trap THEN
+ INCL(DevCPM.options, DevCPM.trap)
+ END;
+ (*IF oberon IN m.opts THEN INCL(DevCPM.options, DevCPM.oberon) END;*)
DevCPR.Init;
s := def.next;
WHILE s # NIL DO
ASSERT(m.worker = NIL, 22);
w := DswProcs.dir.New();
w.Program(cpcExe);
+ IF trap THEN
+ w.PutParam("-trap")
+ END;
w.PutParam("-legacy");
PutPathList(w, "-legacysymdir", m.dir);
s := def.next;
ASSERT(compiler = cpnative, 22);
p := DswProcs.dir.New();
p.Program(cplExe);
+ IF trap THEN
+ p.PutParam("-trap")
+ END;
PutPathList(p, "-legacycodedir", dirList);
IF os # anyos THEN
p.PutParam("-os");
Log.String(cmpList[i].odc); Log.Char(" ")
END;
Log.Ln
-(* ELSIF printLinkFileList THEN
+ (*
+ 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*)
+ Log.Ln
+ *)
END
END PrintInfo;
END;
IF err = 0 THEN Kernel.Quit(0)
ELSE Kernel.Quit(1)
- END;
+ END
END Main;
BEGIN