diff options
Diffstat (limited to 'default.bld')
-rw-r--r-- | default.bld | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/default.bld b/default.bld index 5c3d9b1..572e992 100644 --- a/default.bld +++ b/default.bld | |||
@@ -1,19 +1,26 @@ | |||
1 | 1 | ||
2 | action "default" | ||
3 | { | ||
4 | build: ["src/version.h", "stage"]; | ||
5 | } | ||
6 | |||
2 | target "src/version.h" | 7 | target "src/version.h" |
3 | { | 8 | { |
4 | requires ".git"; | 9 | input ".git"; |
5 | profile "build" | 10 | profile "build" |
6 | { | 11 | { |
7 | fh = open("src/version.h.tmp"); | 12 | fh = open("src/version.h.tmp", "w"); |
8 | fh.write( | 13 | fh.write( |
9 | "#ifndef VERSION_H\n" | 14 | "#ifndef VERSION_H\n" |
10 | "#define VERSION_H\n" | 15 | "#define VERSION_H\n" |
11 | "\n" | 16 | "\n" |
17 | "#define VERSION \"$(git describe --abbrev=0)\"\n" | ||
12 | "#define FULLVER \"$(git describe)\"\n" | 18 | "#define FULLVER \"$(git describe)\"\n" |
19 | "#define SHAVER \"$(git log -n1 --pretty=format:%H)\"\n" | ||
13 | "\n" | 20 | "\n" |
14 | "#endif"); | 21 | "#endif"); |
15 | fh.close(); | 22 | fh.close(); |
16 | if "$(cmp src/version.h.tmp src/version.h)" == "" then | 23 | if "$(cmp src/version.h.tmp src/version.h 2>&1)" == "" then |
17 | { | 24 | { |
18 | execute("rm src/version.h.tmp"); | 25 | execute("rm src/version.h.tmp"); |
19 | } | 26 | } |
@@ -28,7 +35,7 @@ CC="g++"; | |||
28 | target "stage" | 35 | target "stage" |
29 | { | 36 | { |
30 | rule "exe"; | 37 | rule "exe"; |
31 | input files("src/*.y", "src/*.l", "src/*.cpp"); | 38 | input files("src/*.y", "src/*.l", "src/*.cpp", "src/version.h"); |
32 | 39 | ||
33 | CXXFLAGS="-ggdb"; | 40 | CXXFLAGS="-ggdb"; |
34 | CFLAGS="-ggdb"; | 41 | CFLAGS="-ggdb"; |