Skip to content

Commit

Permalink
scripts: Consider Cygwin, Mingw to be C backend only. (#698)
Browse files Browse the repository at this point in the history
Though strictly speaking I386_CYGWIN and I386_MINGW
have worked with the m3cc backend, and this change
does not change that.

Do not copy .o/.obj/.mo/.io into C backend bootstraps.

Change some starts with to contains (riscv, solaris).
  • Loading branch information
jaykrell authored Jun 23, 2021
1 parent dd9bdac commit 0350f81
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions scripts/python/pylib.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,9 @@ def TargetOnlyHasCBackend(a):
a = a.lower()
if a == "i386_nt":
return false
return (a.endswith("_nt") or a.startswith("arm64") or a.startswith("riscv") or
a.endswith("solaris") or a.startswith("sol"))
return (a.endswith("_nt") or a.startswith("arm") or a.find("riscv") != -1
or a.find("solaris") != -1 or a.startswith("sol")
or a.find("mingw") != -1 or a.find("cygwin") != -1)

_PossibleCm3Flags = ["boot", "keep", "override", "commands", "verbose", "why", "debug", "trace"]
_SkipGccFlags = ["nogcc", "skipgcc", "omitgcc"]
Expand Down Expand Up @@ -657,9 +658,6 @@ def GetVersion(Key):
#
_CBackend = "c" in LowercaseArgv or "+c" in LowercaseArgv or TargetOnlyHasCBackend(Target)

if TargetOnlyHasCBackend(Target):
_CBackend = true

if _CBackend:
CM3_FLAGS = CM3_FLAGS + " -DM3_BACKEND_MODE=C"

Expand Down Expand Up @@ -1174,6 +1172,8 @@ def Boot():

CBackend = _CBackend

print("CBackend = " + str(CBackend))

CCompilerFlags = " "
CCompilerOut = ""

Expand Down Expand Up @@ -1452,6 +1452,8 @@ def Boot():
for a in os.listdir(os.path.join(Root, dir, BuildDir)):
main_leaf = a
ext = GetPathExtension(a)
ext_o = (ext == "o")
ext_obj = (ext == "obj")
ext_c = (ext == "c")
ext_cpp = (ext == "cpp")
ext_h = (ext == "h")
Expand All @@ -1460,6 +1462,10 @@ def Boot():
ext_is = (ext == "is")
ext_io = (ext == "io")
ext_mo = (ext == "mo")

if CBackend and (ext_mo or ext_io or ext_is or ext_ms or ext_obj or ext_o):
continue

if not (ext_c or ext_cpp or ext_h or ext_s or ext_ms or ext_is or ext_io or ext_mo):
continue
leaf = GetLastPathElement(a)
Expand Down

0 comments on commit 0350f81

Please sign in to comment.