From: DeaDDooMER Date: Mon, 24 Feb 2020 14:35:53 +0000 (+0300) Subject: cpmake: pass target related preprocessor selectors to compiler X-Git-Url: http://deadsoftware.ru/gitweb?a=commitdiff_plain;h=2807f896080a87b8eedd5b47ac93fff5fa70e097;p=cpc.git cpmake: pass target related preprocessor selectors to compiler --- diff --git a/src/generic/Dsw/Mod/MakeMain.cp b/src/generic/Dsw/Mod/MakeMain.cp index 57822e5..9df3961 100644 --- a/src/generic/Dsw/Mod/MakeMain.cp +++ b/src/generic/Dsw/Mod/MakeMain.cp @@ -32,7 +32,7 @@ MODULE DswMakeMain; anymach = 0; cmach = 1; mach386 = 10; mach68k = 20; (* operation system types *) - anyos = 0; linux = 1; freebsd = 2; openbsd = 3; win32 = 4; + anyos = 0; linux = 1; freebsd = 2; openbsd = 3; win32 = 4; cygwin = 5; darwin = 6; (* compiler types *) anycp = 0; cpnative = 1; cpfront = 2; @@ -292,6 +292,11 @@ MODULE DswMakeMain; 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 Log.String("unknwon os "); Log.String(s); Log.Ln; INC(err) END | "g": @@ -676,6 +681,87 @@ MODULE DswMakeMain; w.Program(cpcExe); w.PutParam("-legacy"); PutParams(w, cpcArgs); + CASE compiler OF + | cpfront: + w.PutParam("-define+"); w.PutParam("CPFRONT"); + w.PutParam("-define-"); w.PutParam("NATIVE"); + | cpnative: + w.PutParam("-define-"); w.PutParam("CPFRONT"); + w.PutParam("-define+"); w.PutParam("NATIVE"); + END; + CASE processor OF + | mach386: + w.PutParam("-define+"); w.PutParam("I486"); + w.PutParam("-define-"); w.PutParam("M68K"); + | mach68k: + w.PutParam("-define+"); w.PutParam("I486"); + w.PutParam("-define-"); w.PutParam("M68K"); + ELSE + w.PutParam("-define-"); w.PutParam("I486"); + 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"); + w.PutParam("-define-"); w.PutParam("FREEBSD"); + w.PutParam("-define-"); w.PutParam("OPENBSD"); + w.PutParam("-define-"); w.PutParam("WIN32"); + w.PutParam("-define-"); w.PutParam("DARWIN"); + | freebsd: + 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("CYGWIN"); + w.PutParam("-define-"); w.PutParam("DARWIN"); + | openbsd: + 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("CYGWIN"); + w.PutParam("-define-"); w.PutParam("DARWIN"); + | win32: + 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("CYGWIN"); + w.PutParam("-define-"); w.PutParam("DARWIN"); + | cygwin: + 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("CYGWIN"); + w.PutParam("-define-"); w.PutParam("DARWIN"); + | darwin: + 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("CYGWIN"); + w.PutParam("-define+"); w.PutParam("DARWIN"); + END; + CASE linker OF + | dev2: + w.PutParam("-define+"); w.PutParam("DEV2"); + ELSE + w.PutParam("-define-"); w.PutParam("DEV2"); + END; w.PutParam(m.path); w.Execute(ok); IF ok THEN @@ -741,7 +827,6 @@ MODULE DswMakeMain; ASSERT((exe # NIL) & (exe^ # ""), 20); ASSERT(processor = mach386, 21); ASSERT(compiler = cpnative, 22); - ASSERT(os IN {linux, freebsd, openbsd, win32}, 23); p := DswProcs.dir.New(); p.Program(cplExe); IF os # anyos THEN @@ -750,7 +835,8 @@ MODULE DswMakeMain; | linux: p.PutParam("linux") | freebsd: p.PutParam("freebsd") | openbsd: p.PutParam("openbsd") - | win32: p.PutParam("win32") + | win32, cygwin: p.PutParam("win32") + | darwin: p.PutParam("darwin") END END; p.PutParam("-kernel");