Skip to content

Commit

Permalink
Split out LLVM_REV into separate header, to reduce rebuilding when on…
Browse files Browse the repository at this point in the history
…ly the LDC

revision has changed.
  • Loading branch information
Frits van Bommel committed Mar 13, 2009
1 parent a23861d commit ad46ec8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
1 change: 1 addition & 0 deletions .hgignore
Expand Up @@ -29,6 +29,7 @@ syntax: regexp
^ldc\.make$
^revisions\.pl$
^gen/revisions\.h$
^gen/llvm-version\.h$
^dmd2?/idgen$
^dmd2?/impcnvgen$
^dmd2?/impcnvtab\.c$
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -195,7 +195,7 @@ add_custom_target(
gen_revs_h
COMMAND ${PERL_EXECUTABLE} ${PROJECT_BINARY_DIR}/revisions.pl
DEPENDS ${PROJECT_BINARY_DIR}/revisions.pl
COMMENT "Generating revisions.h"
COMMENT "Generating revisions.h and llvm-version.h"
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/gen
)
add_dependencies(${LDC_EXE} gen_revs_h)
Expand Down
2 changes: 1 addition & 1 deletion dmd2/mars.c
Expand Up @@ -61,7 +61,7 @@ Global::Global()
written = "written by Walter Bright and Tomas Lindquist Olsen";
version = "v2.021";
ldc_version = LDC_REV;
llvm_version = LLVM_REV;
llvm_version = LLVM_REV_STR;
global.structalign = 8;

// This should only be used as a global, so the other fields are
Expand Down
2 changes: 1 addition & 1 deletion gen/linkage.h
@@ -1,7 +1,7 @@
#ifndef LDC_GEN_LINKAGE_H
#define LDC_GEN_LINKAGE_H

#include "gen/revisions.h"
#include "gen/llvm-version.h"

// Make it easier to test new linkage types
// Also used to adapt to some changes in LLVM between 2.5 and 2.6
Expand Down
21 changes: 18 additions & 3 deletions revisions.pl.in
Expand Up @@ -46,9 +46,6 @@ $extra_includes
// LLVM version string, for use in -version output
#define LLVM_REV_STR $llvm_rev_str$llvm_date
// LLVM svn revision number, used to adapt to changes in LLVM
// (Is 0 if LLVM is not an SVN trunk version)
#define LLVM_REV $llvm_rev_nr
// LDC version string, for use in -version output
#define LDC_REV "rev. $ldc_rev"
Expand All @@ -63,3 +60,21 @@ if ($old ne $out) {
print $revh $out;
close $revh;
}

$out = qq!#ifndef LDC_LLVM_VERSION_H
#define LDC_LLVM_VERSION_H
// LLVM svn revision number, used to adapt to changes in LLVM
// (Is 0 if LLVM is not an SVN trunk version)
#define LLVM_REV $llvm_rev_nr
#endif // LDC_LLVM_VERSION_H\n!;

$old = "";
open $revh, "llvm-version.h" and $old = join "", <$revh>;

if ($old ne $out) {
open $revh, ">llvm-version.h" or die "cannot create llvm-version.h: $!";
print $revh $out;
close $revh;
}

0 comments on commit ad46ec8

Please sign in to comment.