]> git.lizzy.rs Git - rust.git/commitdiff
mklldeps.py: Write to file instead of print
authorklutzy <klutzytheklutzy@gmail.com>
Tue, 17 Dec 2013 05:35:22 +0000 (14:35 +0900)
committerklutzy <klutzytheklutzy@gmail.com>
Wed, 18 Dec 2013 00:49:55 +0000 (09:49 +0900)
It seems that msys automatically converts `\n` to `\r\n` on pipe
redirection, which causes `make tidy` failure.

mk/llvm.mk
src/etc/mklldeps.py

index cf4e98c6dba562272ca3f8f961bd44868dc8e30d..c85a46876138aa1e51d3ce0004f8251c7b209a62 100644 (file)
@@ -51,8 +51,7 @@ $(S)src/librustc/lib/llvmdeps.rs: \
                    $(LLVM_CONFIGS) \
                    $(S)src/etc/mklldeps.py
        $(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
-           "$(LLVM_COMPONENTS)" $(LLVM_CONFIGS) \
-           > $@
+           "$@" "$(LLVM_COMPONENTS)" $(LLVM_CONFIGS)
 
 $(foreach host,$(CFG_HOST), \
  $(eval $(call DEF_LLVM_RULES,$(host))))
index cea86b7a4f9d8637ee0f3d6ba79e84afe87c0797..5b1abdf68a3d66f4d604a13694577f1aedb19293 100644 (file)
@@ -4,9 +4,11 @@ import os
 import sys
 import subprocess
 
-components = sys.argv[1].split(' ')
+f = open(sys.argv[1], 'wb')
 
-print """// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+components = sys.argv[2].split(' ')
+
+f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
 // file at the top-level directory of this distribution and at
 // http://rust-lang.org/COPYRIGHT.
 //
@@ -18,10 +20,10 @@ print """// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
 
 // WARNING: THIS IS A GENERATED FILE, DO NOT MODIFY
 //          take a look at src/etc/mklldeps.py if you're interested
-"""
+""")
 
-for llconfig in sys.argv[2:]:
-    print
+for llconfig in sys.argv[3:]:
+    f.write("\n")
 
     proc = subprocess.Popen([llconfig, '--host-target'], stdout = subprocess.PIPE)
     out, err = proc.communicate()
@@ -42,7 +44,7 @@ for llconfig in sys.argv[2:]:
         "target_os = \"" + os + "\"",
     ]
 
-    print "#[cfg(" + ', '.join(cfg) + ")]"
+    f.write("#[cfg(" + ', '.join(cfg) + ")]\n")
 
     args = [llconfig, '--libs']
     args.extend(components)
@@ -51,7 +53,7 @@ for llconfig in sys.argv[2:]:
 
     for lib in out.strip().split(' '):
         lib = lib[2:] # chop of the leading '-l'
-        print "#[link(name = \"" + lib + "\", kind = \"static\")]"
+        f.write("#[link(name = \"" + lib + "\", kind = \"static\")]\n")
     if os == 'win32':
-        print "#[link(name = \"imagehlp\")]"
-    print "extern {}"
+        f.write("#[link(name = \"imagehlp\")]\n")
+    f.write("extern {}\n")