[libclc] r200415 - Fixed rules names so they are unique when aliases are present.

Tom Stellard thomas.stellard at amd.com
Wed Jan 29 12:03:27 PST 2014


Author: tstellar
Date: Wed Jan 29 14:03:27 2014
New Revision: 200415

URL: http://llvm.org/viewvc/llvm-project?rev=200415&view=rev
Log:
Fixed rules names so they are unique when aliases are present.

This is necessary for building with Ninja because it does not allow
duplicate rule names.

Patch by: Dan Liew

Modified:
    libclc/trunk/configure.py

Modified: libclc/trunk/configure.py
URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/configure.py?rev=200415&r1=200414&r2=200415&view=diff
==============================================================================
--- libclc/trunk/configure.py (original)
+++ libclc/trunk/configure.py Wed Jan 29 14:03:27 2014
@@ -164,7 +164,7 @@ for target in targets:
                      "-emit-llvm" % (target, clang_cl_includes)
     if device['gpu'] != '':
       clang_bc_flags += ' -mcpu=' + device['gpu']
-    clang_bc_rule = "CLANG_CL_BC_" + target
+    clang_bc_rule = "CLANG_CL_BC_" + target + "_" + device['gpu']
     c_compiler_rule(b, clang_bc_rule, "LLVM-CC", llvm_clang, clang_bc_flags)
 
     objects = []
@@ -210,11 +210,13 @@ for target in targets:
     install_files_bc.append((builtins_bc, builtins_bc))
     install_deps.append(builtins_bc)
     for alias in device['aliases']:
-      b.rule("CREATE_ALIAS", "ln -fs %s $out" % os.path.basename(builtins_bc)
+      # Ninja cannot have multiple rules with same name so append suffix
+      ruleName = "CREATE_ALIAS_{0}_for_{1}".format(alias, device['gpu'])
+      b.rule(ruleName, "ln -fs %s $out" % os.path.basename(builtins_bc)
              ,"CREATE-ALIAS $out")
 
       alias_file = os.path.join('built_libs', alias + '-' + target + '.bc')
-      b.build(alias_file, "CREATE_ALIAS", builtins_bc)
+      b.build(alias_file, ruleName, builtins_bc)
       install_files_bc.append((alias_file, alias_file))
       install_deps.append(alias_file)
     b.default(builtins_bc)





More information about the cfe-commits mailing list