]> granicus.if.org Git - clang/commitdiff
[scan-build] Make scan-build work whether it's installed or not
authorJonathan Roelofs <jonathan@codesourcery.com>
Fri, 13 Nov 2015 20:34:15 +0000 (20:34 +0000)
committerJonathan Roelofs <jonathan@codesourcery.com>
Fri, 13 Nov 2015 20:34:15 +0000 (20:34 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253074 91177308-0d34-0410-b5e6-96231b3b80d8

15 files changed:
tools/scan-build/CMakeLists.txt
tools/scan-build/Makefile
tools/scan-build/bin/scan-build [moved from tools/scan-build/scan-build with 99% similarity]
tools/scan-build/bin/scan-build.bat [moved from tools/scan-build/scan-build.bat with 100% similarity]
tools/scan-build/bin/set-xcode-analyzer [moved from tools/scan-build/set-xcode-analyzer with 100% similarity]
tools/scan-build/libexec/c++-analyzer [moved from tools/scan-build/c++-analyzer with 100% similarity]
tools/scan-build/libexec/c++-analyzer.bat [moved from tools/scan-build/c++-analyzer.bat with 100% similarity]
tools/scan-build/libexec/ccc-analyzer [moved from tools/scan-build/ccc-analyzer with 100% similarity]
tools/scan-build/libexec/ccc-analyzer.bat [moved from tools/scan-build/ccc-analyzer.bat with 100% similarity]
tools/scan-build/man/scan-build.1 [moved from tools/scan-build/scan-build.1 with 100% similarity]
tools/scan-build/share/scan-build/scanview.css [moved from tools/scan-build/share/scanview.css with 100% similarity]
tools/scan-build/share/scan-build/sorttable.js [moved from tools/scan-build/share/sorttable.js with 100% similarity]
tools/scan-view/CMakeLists.txt
tools/scan-view/Makefile
tools/scan-view/bin/scan-view [moved from tools/scan-view/scan-view with 93% similarity]

index 95ab5f73b5844cc4738e9df2a5b00b75a67910a0..ec7b8ad0ae37d57f93e95b9dbb3a8ea5f549d0a3 100644 (file)
@@ -32,11 +32,11 @@ if(CLANG_INSTALL_SCANBUILD)
                        COMMAND ${CMAKE_COMMAND} -E make_directory
                          ${CMAKE_BINARY_DIR}/bin
                        COMMAND ${CMAKE_COMMAND} -E copy
-                         ${CMAKE_CURRENT_SOURCE_DIR}/${BinFile}
+                         ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}
                          ${CMAKE_BINARY_DIR}/bin/
-                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${BinFile})
+                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
     list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
-    install(PROGRAMS ${BinFile} DESTINATION bin)
+    install(PROGRAMS bin/${BinFile} DESTINATION bin)
   endforeach()
 
   foreach(LibexecFile ${LibexecFiles})
@@ -44,11 +44,11 @@ if(CLANG_INSTALL_SCANBUILD)
                        COMMAND ${CMAKE_COMMAND} -E make_directory
                          ${CMAKE_BINARY_DIR}/libexec
                        COMMAND ${CMAKE_COMMAND} -E copy
-                         ${CMAKE_CURRENT_SOURCE_DIR}/${LibexecFile}
+                         ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile}
                          ${CMAKE_BINARY_DIR}/libexec/
-                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${LibexecFile})
+                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/libexec/${LibexecFile})
     list(APPEND Depends ${CMAKE_BINARY_DIR}/libexec/${LibexecFile})
-    install(PROGRAMS ${LibexecFile} DESTINATION libexec)
+    install(PROGRAMS libexec/${LibexecFile} DESTINATION libexec)
   endforeach()
 
   foreach(ManPage ${ManPages})
@@ -56,11 +56,11 @@ if(CLANG_INSTALL_SCANBUILD)
                        COMMAND ${CMAKE_COMMAND} -E make_directory
                          ${CMAKE_BINARY_DIR}/share/man/man1
                        COMMAND ${CMAKE_COMMAND} -E copy
-                         ${CMAKE_CURRENT_SOURCE_DIR}/${ManPage}
+                         ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage}
                          ${CMAKE_BINARY_DIR}/share/man/man1/
-                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${ManPage})
+                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/man/${ManPage})
     list(APPEND Depends ${CMAKE_BINARY_DIR}/share/man/man1/${ManPage})
-    install(PROGRAMS ${ManPage} DESTINATION share/man/man1)
+    install(PROGRAMS man/${ManPage} DESTINATION share/man/man1)
   endforeach()
 
   foreach(ShareFile ${ShareFiles})
@@ -68,11 +68,11 @@ if(CLANG_INSTALL_SCANBUILD)
                        COMMAND ${CMAKE_COMMAND} -E make_directory
                          ${CMAKE_BINARY_DIR}/share/scan-build
                        COMMAND ${CMAKE_COMMAND} -E copy
-                         ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile}
+                         ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile}
                          ${CMAKE_BINARY_DIR}/share/scan-build/
-                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/${ShareFile})
+                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/share/scan-build/${ShareFile})
     list(APPEND Depends ${CMAKE_BINARY_DIR}/share/scan-build/${ShareFile})
-    install(FILES share/${ShareFile} DESTINATION share/scan-build)
+    install(FILES share/scan-build/${ShareFile} DESTINATION share/scan-build)
   endforeach()
 
   add_custom_target(scan-build ALL DEPENDS ${Depends})
index a9e072aa3c633b741c6e744ddb271197df3c93d8..4ee949346f8ff77bf319d8d48817a1c3b16dd6d8 100644 (file)
@@ -33,18 +33,18 @@ endif
 
 all:: $(InstallTargets)
 
-$(ToolDir)/%: % Makefile $(ToolDir)/.dir
+$(ToolDir)/%: bin/% Makefile $(ToolDir)/.dir
        $(Echo) "Copying $(notdir $<) to the 'bin' directory..."
        $(Verb)cp $< $@
        $(Verb)chmod +x $@
 
-$(LibexecDir)/%: % Makefile $(LibexecDir)/.dir
+$(LibexecDir)/%: libexec/% Makefile $(LibexecDir)/.dir
        $(Echo) "Copying $(notdir $<) to the 'libexec' directory..."
        $(Verb)cp $< $@
        $(Verb)chmod +x $@
 
-$(ShareDir)/man/man1/%: % Makefile $(ShareDir)/man/man1/.dir
-       $(Echo) "Copying $(notdir $<) to the 'share' directory..."
+$(ShareDir)/man/man1/%: man/% Makefile $(ShareDir)/man/man1/.dir
+       $(Echo) "Copying $(notdir $<) to the 'man' directory..."
        $(Verb)cp $< $@
 
 $(ShareDir)/scan-build/%: share/% Makefile $(ShareDir)/scan-build/.dir
similarity index 99%
rename from tools/scan-build/scan-build
rename to tools/scan-build/bin/scan-build
index f37b412498e1b727913384ceda0df6feb1c074d3..6a14484970a2740d0c2c1dd0bd90e555f5a3b178 100755 (executable)
@@ -1818,6 +1818,7 @@ if (defined $Options{OutputFormat}) {
       Diag "Viewing analysis results in '$Options{OutputDir}' using scan-view.\n";
       my $ScanView = Cwd::realpath("$RealBin/scan-view");
       if (! -x $ScanView) { $ScanView = "scan-view"; }
+      if (! -x $ScanView) { $ScanView = Cwd::realpath("$RealBin/../../scan-view/bin/scan-view"); }
       exec $ScanView, "$Options{OutputDir}";
     }
 
index 969d519d8a26e9acfcca5f58c524057cb29d659d..b305ca562a72b9797df5cfcbed0abdb9b4a359ca 100644 (file)
@@ -17,11 +17,11 @@ if(CLANG_INSTALL_SCANVIEW)
                        COMMAND ${CMAKE_COMMAND} -E make_directory
                          ${CMAKE_BINARY_DIR}/bin
                        COMMAND ${CMAKE_COMMAND} -E copy
-                         ${CMAKE_CURRENT_SOURCE_DIR}/${BinFile}
+                         ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile}
                          ${CMAKE_BINARY_DIR}/bin/
-                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${BinFile})
+                       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bin/${BinFile})
     list(APPEND Depends ${CMAKE_BINARY_DIR}/bin/${BinFile})
-    install(PROGRAMS ${BinFile} DESTINATION bin)
+    install(PROGRAMS bin/${BinFile} DESTINATION bin)
   endforeach()
 
   foreach(ShareFile ${ShareFiles})
index e980b38217896e763279b4245bb4e4e4d3673f2a..37e4404d6f833dd21133416d815dc5a20c70c216 100644 (file)
@@ -26,7 +26,7 @@ endif
 
 all:: $(InstallTargets)
 
-$(ToolDir)/%: % Makefile $(ToolDir)/.dir
+$(ToolDir)/%: bin/% Makefile $(ToolDir)/.dir
        $(Echo) "Copying $(notdir $<) to the 'bin' directory..."
        $(Verb)cp $< $@
        $(Verb)chmod +x $@
similarity index 93%
rename from tools/scan-view/scan-view
rename to tools/scan-view/bin/scan-view
index 797db637ae32ab8a4f2452b45150cfd62afa4938..94b60e630177042c96e97ec03c468b5d102e23d1 100755 (executable)
@@ -56,7 +56,13 @@ def start_browser(port, options):
     webbrowser.open(url)
 
 def run(port, options, root):
-    sys.path.append(os.path.dirname(__file__) + "/../share/scan-view")
+    # Prefer to look relative to the installed binary
+    share = os.path.dirname(__file__) + "/../share/scan-view"
+    if not os.path.isdir(share):
+      # Otherwise look relative to the source
+      share = os.path.dirname(__file__) + "/../../scan-view/share"
+    sys.path.append(share)
+
     import ScanView
     try:
         print 'Starting scan-view at: http://%s:%d'%(options.host,