]> granicus.if.org Git - clang/commitdiff
Add revision information.
authorMike Stump <mrs@apple.com>
Wed, 18 Mar 2009 18:45:55 +0000 (18:45 +0000)
committerMike Stump <mrs@apple.com>
Wed, 18 Mar 2009 18:45:55 +0000 (18:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67220 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Driver.cpp
lib/Driver/Makefile

index 03138bf0eeb858fc1c3779b0a9b267e5af4a040b..49a4dca54cebc6e78ab0cf4807cf001a5184af48 100644 (file)
@@ -220,10 +220,15 @@ void Driver::PrintVersion() const {
   if (zap)
     *zap = 0;
   const char *vers = buf+6;
-
+  // FIXME: Add cmake support and remove #ifdef
+#ifdef SVN_REVISION
+  const char *revision = SVN_REVISION;
+#else
+  const char *revision = "";
+#endif
   // FIXME: The following handlers should use a callback mechanism, we
   // don't know what the client would like to do.
-  llvm::errs() << "ccc version 1.0 (" << vers << ")" << "\n";
+  llvm::errs() << "ccc version 1.0 (" << vers << " " << revision << ")" << "\n";
   // FIXME: Add cmake support and remove #ifdef
 #ifdef TARGET_TRIPLE
   llvm::errs() << "Target: " << TARGET_TRIPLE << "\n";
index 4aeba9f5f8dc02f5d789691abf861c55dc141459..c6a31b0d3c806231510d411e29fd70a2a7898b0e 100644 (file)
@@ -12,7 +12,15 @@ LIBRARYNAME := clangDriver
 BUILD_ARCHIVE = 1
 CXXFLAGS = -fno-rtti
 
-CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include -DTARGET_TRIPLE='"$(TARGET_TRIPLE)"'
+SVN_REVISION = $(shell cd $(PROJ_SRC_DIR)/../.. && svnversion)
+
+CPPFLAGS += -I$(PROJ_SRC_DIR)/../../include -I$(PROJ_OBJ_DIR)/../../include -DTARGET_TRIPLE='"$(TARGET_TRIPLE)"' -DSVN_REVISION='"$(SVN_REVISION)"'
 
 include $(LEVEL)/Makefile.common
 
+.ver:
+       @if [ '$(SVN_REVISION)' != '$(shell cat .ver-svn 2>/dev/null)' ]; then  \
+               echo '$(SVN_REVISION)' > .ver-svn;                      \
+       fi
+.ver-svn: .ver
+$(ObjDir)/Driver.o: .ver-svn