Commit | Line | Data |
---|---|---|
88564da0 | 1 | ## |
0b83088a MJ |
2 | ## This target generates an include file that contains the git version |
3 | ## string of the current branch, it must be continuously updated when | |
4 | ## we build in the git repo and shipped in dist tarballs to reflect the | |
5 | ## status of the tree when it was generated. If the tree is clean and | |
6 | ## the current commit is tag a starting with "v", consider this a | |
7 | ## release version and set an empty git version. | |
88564da0 | 8 | ## |
0b83088a MJ |
9 | ## Here is what the inline script does: |
10 | ## | |
11 | ## First, delete any stale "version.i.tmp" file. | |
12 | ## | |
13 | ## If "bootstrap" and ".git" exists in the top source directory and the git | |
14 | ## executable is available, get the current git version string in the form: | |
15 | ## | |
16 | ## "latest_tag"(-"number_of_commits_on_top")(-g"latest_commit_hash")(-dirty) | |
17 | ## | |
18 | ## And store it in "version.i.tmp", if the current commit is tagged, the tag | |
19 | ## starts with "v" and the tree is clean, consider this a release version and | |
20 | ## overwrite the git version with an empty string in "version.i.tmp". | |
21 | ## | |
22 | ## If we don't have a "version.i.tmp" nor a "version.i", generate an empty | |
6fa7f7c2 JR |
23 | ## string as a failover. If a "version.i" is present, for example when building |
24 | ## from a distribution tarball, get the git_version using grep. | |
0b83088a | 25 | ## |
6fa7f7c2 JR |
26 | ## Fetch the EXTRA_VERSION_NAME define from "version/extra_version_name" and output it |
27 | ## to "version.i.tmp". | |
28 | ## | |
29 | ## Fetch the EXTRA_VERSION_DESCRIPTION define from "version/extra_version_description", | |
30 | ## sanitize and format it with a sed script to replace all non-alpha-numeric values | |
31 | ## with "-" and join all lines by replacing "\n" with litteral string c-style "\n\t" and | |
32 | ## output it to "version.i.tmp". | |
33 | ## | |
34 | ## If we don't have a "version.i" or we have both files (version.i, version.i.tmp) | |
35 | ## and they are different, copy "version.i.tmp" over "version.i". | |
36 | ## This way the dependent targets are only rebuilt when the git version | |
37 | ## string or either one of extra version string change. | |
0b83088a MJ |
38 | ## |
39 | version_verbose = $(version_verbose_@AM_V@) | |
40 | version_verbose_ = $(version_verbose_@AM_DEFAULT_V@) | |
41 | version_verbose_0 = @echo " GEN " $@; | |
42 | ||
43 | version.i: | |
44 | $(version_verbose)rm -f version.i.tmp; \ | |
45 | if (test -r "$(top_srcdir)/bootstrap" && test -r "$(top_srcdir)/.git") && \ | |
46 | test -x "`which git 2>&1;true`"; then \ | |
47 | GIT_VERSION_STR="`cd "$(top_srcdir)" && git describe --tags --dirty`"; \ | |
48 | GIT_CURRENT_TAG="`cd "$(top_srcdir)" && git describe --tags --exact-match --match="v[0-9]*" HEAD 2> /dev/null`"; \ | |
49 | echo "#define GIT_VERSION \"$$GIT_VERSION_STR\"" > version.i.tmp; \ | |
50 | if ! $(GREP) -- "-dirty" version.i.tmp > /dev/null && \ | |
51 | test "x$$GIT_CURRENT_TAG" != "x"; then \ | |
52 | echo "#define GIT_VERSION \"\"" > version.i.tmp; \ | |
88564da0 | 53 | fi; \ |
0b83088a MJ |
54 | fi; \ |
55 | if test ! -f version.i.tmp; then \ | |
6fa7f7c2 JR |
56 | if test -f version.i; then \ |
57 | $(GREP) "^#define \bGIT_VERSION\b.*" version.i > version.i.tmp; \ | |
58 | else \ | |
59 | echo '#define GIT_VERSION ""' > version.i.tmp; \ | |
88564da0 | 60 | fi; \ |
6fa7f7c2 JR |
61 | fi; \ |
62 | echo "#define EXTRA_VERSION_NAME \"`$(SED) -n '1p' "$(top_srcdir)/version/extra_version_name" 2> /dev/null`\"" >> version.i.tmp; \ | |
63 | echo "#define EXTRA_VERSION_DESCRIPTION \"`$(SED) -E ':a ; N ; $$!ba ; s/[^a-zA-Z0-9 \n\t\.,]/-/g ; s/\r{0,1}\n/\\\n\\\t/g' "$(top_srcdir)/version/extra_version_description" 2> /dev/null`\"" >> version.i.tmp; \ | |
64 | if test ! -f version.i || \ | |
0b83088a MJ |
65 | test x"`cat version.i.tmp`" != x"`cat version.i`"; then \ |
66 | mv version.i.tmp version.i; \ | |
67 | fi; \ | |
68 | rm -f version.i.tmp; \ | |
69 | true | |
88564da0 RB |
70 | |
71 | ## | |
0b83088a MJ |
72 | ## version.i is defined as a .PHONY target even if it's a real file, |
73 | ## we want the target to be re-run on every make. | |
88564da0 | 74 | ## |
0b83088a | 75 | .PHONY: version.i |
88564da0 | 76 | |
0b83088a | 77 | CLEANFILES = version.i.tmp |
ec148ec6 | 78 | |
0b83088a MJ |
79 | ## |
80 | ## Only clean "version.i" on dist-clean, we need to keep it on regular | |
81 | ## clean when it's part of a dist tarball. | |
82 | ## | |
83 | DISTCLEANFILES = version.i | |
4c6ac053 | 84 | |
55d09795 | 85 | lttnginclude_HEADERS = \ |
d74df422 | 86 | lttng/health.h \ |
55d09795 | 87 | lttng/lttng.h \ |
1239a312 DG |
88 | lttng/constant.h \ |
89 | lttng/channel.h \ | |
90 | lttng/domain.h \ | |
91 | lttng/event.h \ | |
92 | lttng/handle.h \ | |
93 | lttng/session.h \ | |
55d09795 | 94 | lttng/lttng-error.h \ |
00c76cea | 95 | lttng/snapshot.h \ |
88564da0 | 96 | lttng/save.h \ |
0b83088a | 97 | lttng/load.h |
da3c9ec1 | 98 | |
55d09795 MD |
99 | noinst_HEADERS = \ |
100 | lttng/snapshot-internal.h \ | |
00c76cea | 101 | lttng/health-internal.h \ |
9245bd0e | 102 | lttng/save-internal.h \ |
0b83088a MJ |
103 | lttng/load-internal.h \ |
104 | version.h \ | |
105 | version.i |