<div dir="ltr">Chris, excuse me to respond an older commit.<br><br><div class="gmail_quote"><div dir="ltr">On Sat, Apr 25, 2015 at 2:17 AM Chris Bieneman <<a href="mailto:beanz@apple.com">beanz@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: cbieneman<br class="gmail_msg">
Date: Fri Apr 24 12:09:20 2015<br class="gmail_msg">
New Revision: 235732<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=235732&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=235732&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[CMake] Fix for PR 23328: LLVM_OPTIMIZED_TABLEGEN broken<br class="gmail_msg">
<br class="gmail_msg">
In CMake dependencies can be filenames or targets, and targets can't be filenames. The Ninja generator handles filename dependencies because it generates targets for every output file from a command. For example:<br class="gmail_msg">
<br class="gmail_msg">
add_custom_command(OUTPUT foo.txt COMMAND touch foo.txt)<br class="gmail_msg">
<br class="gmail_msg">
With the Ninja generator this generates a target foo.txt, but with the Makefile generator it doesn't. This is probably because Ninja explicitly requires these hard dependency ties, and Make just behaves oddly in general.<br class="gmail_msg">
<br class="gmail_msg">
To fix this we need to make the tablegen actions depend on a target rather than a filename.<br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
    llvm/trunk/cmake/modules/TableGen.cmake<br class="gmail_msg">
<br class="gmail_msg">
Modified: llvm/trunk/cmake/modules/TableGen.cmake<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=235732&r1=235731&r2=235732&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/TableGen.cmake?rev=235732&r1=235731&r2=235732&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- llvm/trunk/cmake/modules/TableGen.cmake (original)<br class="gmail_msg">
+++ llvm/trunk/cmake/modules/TableGen.cmake Fri Apr 24 12:09:20 2015<br class="gmail_msg">
@@ -32,7 +32,7 @@ function(tablegen project ofn)<br class="gmail_msg">
     # The file in LLVM_TARGET_DEFINITIONS may be not in the current<br class="gmail_msg">
     # directory and local_tds may not contain it, so we must<br class="gmail_msg">
     # explicitly list it here:<br class="gmail_msg">
-    DEPENDS ${${project}_TABLEGEN_EXE} ${local_tds} ${global_tds}<br class="gmail_msg">
+    DEPENDS ${${project}_TABLEGEN_TARGET} ${local_tds} ${global_tds}<br class="gmail_msg"></blockquote><div><br></div><div>I think it'd be wrong. Order-only dependency is generated in trunk.</div><div><br></div><div>  build include/llvm/IR/Intrinsics.gen.tmp: CUSTOM_COMMAND <a href="http://foo.td">foo.td</a> ...</div><div>  || utils/TableGen/LLVM-tablegen-host<br></div><div><br></div><div>I think it should be right with<span class="inbox-inbox-Apple-converted-space"> </span>${${project}_TABLEGEN_EXE}. Files (or executable targets) may be described here.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
     ${LLVM_TARGET_DEFINITIONS_ABSOLUTE}<br class="gmail_msg">
     COMMENT "Building ${ofn}..."<br class="gmail_msg">
     )<br class="gmail_msg">
@@ -90,6 +90,7 @@ macro(add_tablegen target project)<br class="gmail_msg">
<br class="gmail_msg">
   # Effective tblgen executable to be used:<br class="gmail_msg">
   set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE)<br class="gmail_msg">
+  set(${project}_TABLEGEN_TARGET ${${project}_TABLEGEN} PARENT_SCOPE)<br class="gmail_msg">
<br class="gmail_msg">
   if(LLVM_USE_HOST_TOOLS)<br class="gmail_msg">
     if( ${${project}_TABLEGEN} STREQUAL "${target}" )<br class="gmail_msg">
@@ -101,8 +102,8 @@ macro(add_tablegen target project)<br class="gmail_msg">
         DEPENDS CONFIGURE_LLVM_NATIVE ${target}<br class="gmail_msg">
         WORKING_DIRECTORY ${LLVM_NATIVE_BUILD}<br class="gmail_msg">
         COMMENT "Building native TableGen...")<br class="gmail_msg">
-      add_custom_target(${project}NativeTableGen DEPENDS ${${project}_TABLEGEN_EXE})<br class="gmail_msg">
-      add_dependencies(${project}NativeTableGen CONFIGURE_LLVM_NATIVE)<br class="gmail_msg">
+      add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE})<br class="gmail_msg">
+      set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE)<br class="gmail_msg">
     endif()<br class="gmail_msg">
   endif()<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
llvm-commits mailing list<br class="gmail_msg">
<a href="mailto:llvm-commits@cs.uiuc.edu" class="gmail_msg" target="_blank">llvm-commits@cs.uiuc.edu</a><br class="gmail_msg">
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br class="gmail_msg">
</blockquote></div></div>