Commit | Line | Data |
---|---|---|
ab5be9fa | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
88564da0 | 2 | ## |
337d64f0 MJ |
3 | ## This target generates an include file that contains the git version |
4 | ## string of the current branch, it must be continuously updated when | |
5 | ## we build in the git repo and shipped in dist tarballs to reflect the | |
6 | ## status of the tree when it was generated. If the tree is clean and | |
7 | ## the current commit is tag a starting with "v", consider this a | |
8 | ## release version and set an empty git version. | |
88564da0 | 9 | ## |
337d64f0 MJ |
10 | ## Here is what the inline script does: |
11 | ## | |
12 | ## First, delete any stale "version.i.tmp" file. | |
13 | ## | |
14 | ## If "bootstrap" and ".git" exists in the top source directory and the git | |
15 | ## executable is available, get the current git version string in the form: | |
16 | ## | |
17 | ## "latest_tag"(-"number_of_commits_on_top")(-g"latest_commit_hash")(-dirty) | |
18 | ## | |
19 | ## And store it in "version.i.tmp", if the current commit is tagged, the tag | |
20 | ## starts with "v" and the tree is clean, consider this a release version and | |
21 | ## overwrite the git version with an empty string in "version.i.tmp". | |
22 | ## | |
23 | ## If we don't have a "version.i.tmp" nor a "version.i", generate an empty | |
2ebe596e JR |
24 | ## string as a failover. If a "version.i" is present, for example when building |
25 | ## from a distribution tarball, get the git_version using grep. | |
337d64f0 | 26 | ## |
2ebe596e JR |
27 | ## Fetch the EXTRA_VERSION_NAME define from "version/extra_version_name" and output it |
28 | ## to "version.i.tmp". | |
29 | ## | |
30 | ## Fetch the EXTRA_VERSION_DESCRIPTION define from "version/extra_version_description", | |
31 | ## sanitize and format it with a sed script to replace all non-alpha-numeric values | |
32 | ## with "-" and join all lines by replacing "\n" with litteral string c-style "\n\t" and | |
33 | ## output it to "version.i.tmp". | |
34 | ## | |
7f5ed73a JR |
35 | ## Repeat the same logic for the "version/extra_patches" directory. |
36 | ## Data fetched from "version/extra_patches" must be sanitized and | |
37 | ## formatted. | |
38 | ## The data is fetched using "ls" with an ignore pattern for the README file. | |
39 | ## The sanitize step uses sed with a script to replace all | |
40 | ## non-alpha-numeric values, except " " (space), to "-". | |
41 | ## The formatting step uses sed with a script to join all lines | |
42 | ## by replacing "\n" with litteral string c-style "\n\t". | |
43 | ## | |
2ebe596e JR |
44 | ## If we don't have a "version.i" or we have both files (version.i, version.i.tmp) |
45 | ## and they are different, copy "version.i.tmp" over "version.i". | |
46 | ## This way the dependent targets are only rebuilt when the git version | |
47 | ## string or either one of extra version string change. | |
337d64f0 MJ |
48 | ## |
49 | version_verbose = $(version_verbose_@AM_V@) | |
50 | version_verbose_ = $(version_verbose_@AM_DEFAULT_V@) | |
51 | version_verbose_0 = @echo " GEN " $@; | |
52 | ||
53 | version.i: | |
54 | $(version_verbose)rm -f version.i.tmp; \ | |
9aba4735 JR |
55 | if (test ! -f version.i && test -f "$(top_srcdir)/include/version.i"); then \ |
56 | cp "$(top_srcdir)/include/version.i" version.i; \ | |
57 | fi; \ | |
337d64f0 MJ |
58 | if (test -r "$(top_srcdir)/bootstrap" && test -r "$(top_srcdir)/.git") && \ |
59 | test -x "`which git 2>&1;true`"; then \ | |
60 | GIT_VERSION_STR="`cd "$(top_srcdir)" && git describe --tags --dirty`"; \ | |
61 | GIT_CURRENT_TAG="`cd "$(top_srcdir)" && git describe --tags --exact-match --match="v[0-9]*" HEAD 2> /dev/null`"; \ | |
62 | echo "#define GIT_VERSION \"$$GIT_VERSION_STR\"" > version.i.tmp; \ | |
63 | if ! $(GREP) -- "-dirty" version.i.tmp > /dev/null && \ | |
64 | test "x$$GIT_CURRENT_TAG" != "x"; then \ | |
65 | echo "#define GIT_VERSION \"\"" > version.i.tmp; \ | |
88564da0 | 66 | fi; \ |
337d64f0 MJ |
67 | fi; \ |
68 | if test ! -f version.i.tmp; then \ | |
2ebe596e JR |
69 | if test -f version.i; then \ |
70 | $(GREP) "^#define \bGIT_VERSION\b.*" version.i > version.i.tmp; \ | |
71 | else \ | |
72 | echo '#define GIT_VERSION ""' > version.i.tmp; \ | |
88564da0 | 73 | fi; \ |
2ebe596e JR |
74 | fi; \ |
75 | echo "#define EXTRA_VERSION_NAME \"`$(SED) -n '1p' "$(top_srcdir)/version/extra_version_name" 2> /dev/null`\"" >> version.i.tmp; \ | |
76 | 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; \ | |
9c65854d | 77 | echo "#define EXTRA_VERSION_PATCHES \"`ls -1 "$(top_srcdir)/version/extra_patches" | $(GREP) -v '^README' | $(SED) -E ':a ; N ; $$!ba ; s/[^a-zA-Z0-9 \n\t\.]/-/g ; s/\r{0,1}\n/\\\n\\\t/g' 2> /dev/null`\"" >> version.i.tmp; \ |
2ebe596e | 78 | if test ! -f version.i || \ |
337d64f0 MJ |
79 | test x"`cat version.i.tmp`" != x"`cat version.i`"; then \ |
80 | mv version.i.tmp version.i; \ | |
81 | fi; \ | |
82 | rm -f version.i.tmp; \ | |
83 | true | |
88564da0 RB |
84 | |
85 | ## | |
337d64f0 MJ |
86 | ## version.i is defined as a .PHONY target even if it's a real file, |
87 | ## we want the target to be re-run on every make. | |
88564da0 | 88 | ## |
337d64f0 | 89 | .PHONY: version.i |
88564da0 | 90 | |
337d64f0 | 91 | CLEANFILES = version.i.tmp |
ec148ec6 | 92 | |
337d64f0 MJ |
93 | ## |
94 | ## Only clean "version.i" on dist-clean, we need to keep it on regular | |
95 | ## clean when it's part of a dist tarball. | |
96 | ## | |
97 | DISTCLEANFILES = version.i | |
4c6ac053 | 98 | |
55d09795 | 99 | lttnginclude_HEADERS = \ |
1239a312 | 100 | lttng/channel.h \ |
a2744201 JR |
101 | lttng/clear-handle.h \ |
102 | lttng/clear.h \ | |
103 | lttng/constant.h \ | |
104 | lttng/destruction-handle.h \ | |
1239a312 | 105 | lttng/domain.h \ |
a2744201 | 106 | lttng/endpoint.h \ |
b99a0cb3 | 107 | lttng/error-query.h \ |
48c47564 | 108 | lttng/event-expr.h \ |
d28fcdec | 109 | lttng/event-field-value.h \ |
a2744201 | 110 | lttng/event.h \ |
1239a312 | 111 | lttng/handle.h \ |
a2744201 | 112 | lttng/health.h \ |
49cddecd | 113 | lttng/kernel.h \ |
a2744201 | 114 | lttng/kernel-probe.h \ |
9245bd0e | 115 | lttng/load.h \ |
1ce46cfe | 116 | lttng/location.h \ |
85b05318 | 117 | lttng/log-level-rule.h \ |
a2744201 | 118 | lttng/lttng-error.h \ |
4bd69c5f | 119 | lttng/lttng-export.h \ |
a2744201 JR |
120 | lttng/lttng.h \ |
121 | lttng/rotation.h \ | |
122 | lttng/save.h \ | |
3e3665b8 | 123 | lttng/session-descriptor.h \ |
a2744201 JR |
124 | lttng/session.h \ |
125 | lttng/snapshot.h \ | |
808cb744 | 126 | lttng/tracker.h \ |
a2744201 | 127 | lttng/userspace-probe.h |
da3c9ec1 | 128 | |
a58c490f JG |
129 | lttngactioninclude_HEADERS= \ |
130 | lttng/action/action.h \ | |
ad63a966 | 131 | lttng/action/list.h \ |
58397d0d | 132 | lttng/action/notify.h \ |
27993cc2 | 133 | lttng/action/path.h \ |
bfb2ec6a | 134 | lttng/action/rotate-session.h \ |
757c48a2 | 135 | lttng/action/snapshot-session.h \ |
931bdbaa | 136 | lttng/action/start-session.h \ |
347f2c91 | 137 | lttng/action/stop-session.h \ |
7f4d5b07 | 138 | lttng/action/rate-policy.h |
a58c490f JG |
139 | |
140 | lttngconditioninclude_HEADERS= \ | |
141 | lttng/condition/condition.h \ | |
142 | lttng/condition/buffer-usage.h \ | |
670a26e4 | 143 | lttng/condition/event-rule-matches.h \ |
e8360425 | 144 | lttng/condition/session-consumed-size.h \ |
c19092cd | 145 | lttng/condition/session-rotation.h \ |
a58c490f JG |
146 | lttng/condition/evaluation.h |
147 | ||
148 | lttngnotificationinclude_HEADERS= \ | |
149 | lttng/notification/channel.h \ | |
150 | lttng/notification/notification.h | |
151 | ||
152 | lttngtriggerinclude_HEADERS= \ | |
153 | lttng/trigger/trigger.h | |
154 | ||
7a3dcaf6 | 155 | lttngeventruleinclude_HEADERS= \ |
077192fd | 156 | lttng/event-rule/event-rule.h \ |
b47b01d8 | 157 | lttng/event-rule/jul-logging.h \ |
85522de5 | 158 | lttng/event-rule/kernel-kprobe.h \ |
4f7da553 | 159 | lttng/event-rule/kernel-syscall.h \ |
af0818ef | 160 | lttng/event-rule/kernel-tracepoint.h \ |
0a23a07d | 161 | lttng/event-rule/kernel-uprobe.h \ |
138d6838 | 162 | lttng/event-rule/log4j-logging.h \ |
6530ec7d | 163 | lttng/event-rule/python-logging.h \ |
0a23a07d | 164 | lttng/event-rule/user-tracepoint.h |
7a3dcaf6 | 165 | |
55d09795 | 166 | noinst_HEADERS = \ |
c9e313bc SM |
167 | lttng/action/action-internal.hpp \ |
168 | lttng/action/list-internal.hpp \ | |
169 | lttng/action/notify-internal.hpp \ | |
170 | lttng/action/path-internal.hpp \ | |
171 | lttng/action/rotate-session-internal.hpp \ | |
172 | lttng/action/snapshot-session-internal.hpp \ | |
173 | lttng/action/start-session-internal.hpp \ | |
174 | lttng/action/stop-session-internal.hpp \ | |
175 | lttng/action/rate-policy-internal.hpp \ | |
176 | lttng/channel-internal.hpp \ | |
177 | lttng/condition/buffer-usage-internal.hpp \ | |
178 | lttng/condition/condition-internal.hpp \ | |
179 | lttng/condition/evaluation-internal.hpp \ | |
180 | lttng/condition/event-rule-matches-internal.hpp \ | |
181 | lttng/condition/session-consumed-size-internal.hpp \ | |
182 | lttng/condition/session-rotation-internal.hpp \ | |
183 | lttng/domain-internal.hpp \ | |
184 | lttng/endpoint-internal.hpp \ | |
185 | lttng/error-query-internal.hpp \ | |
186 | lttng/event-expr-internal.hpp \ | |
187 | lttng/event-field-value-internal.hpp \ | |
188 | lttng/event-internal.hpp \ | |
189 | lttng/event-rule/event-rule-internal.hpp \ | |
190 | lttng/event-rule/jul-logging-internal.hpp \ | |
191 | lttng/event-rule/kernel-kprobe-internal.hpp \ | |
192 | lttng/event-rule/kernel-syscall-internal.hpp \ | |
193 | lttng/event-rule/kernel-tracepoint-internal.hpp \ | |
194 | lttng/event-rule/kernel-uprobe-internal.hpp \ | |
195 | lttng/event-rule/log4j-logging-internal.hpp \ | |
196 | lttng/event-rule/python-logging-internal.hpp \ | |
197 | lttng/event-rule/user-tracepoint-internal.hpp \ | |
198 | lttng/health-internal.hpp \ | |
199 | lttng/kernel-probe-internal.hpp \ | |
200 | lttng/load-internal.hpp \ | |
201 | lttng/location-internal.hpp \ | |
202 | lttng/log-level-rule-internal.hpp \ | |
203 | lttng/notification/channel-internal.hpp \ | |
204 | lttng/notification/notification-internal.hpp \ | |
205 | lttng/ref-internal.hpp \ | |
206 | lttng/rotate-internal.hpp \ | |
207 | lttng/save-internal.hpp \ | |
208 | lttng/session-descriptor-internal.hpp \ | |
209 | lttng/session-internal.hpp \ | |
210 | lttng/snapshot-internal.hpp \ | |
211 | lttng/trigger/trigger-internal.hpp \ | |
212 | lttng/userspace-probe-internal.hpp \ | |
213 | version.hpp \ | |
337d64f0 | 214 | version.i |