Introduce EXTRA_VERSION_PATCHES
[lttng-tools.git] / include / Makefile.am
CommitLineData
88564da0 1##
337d64f0
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##
337d64f0
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
2ebe596e
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.
337d64f0 25##
2ebe596e
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##
7f5ed73a
JR
34## Repeat the same logic for the "version/extra_patches" directory.
35## Data fetched from "version/extra_patches" must be sanitized and
36## formatted.
37## The data is fetched using "ls" with an ignore pattern for the README file.
38## The sanitize step uses sed with a script to replace all
39## non-alpha-numeric values, except " " (space), to "-".
40## The formatting step uses sed with a script to join all lines
41## by replacing "\n" with litteral string c-style "\n\t".
42##
2ebe596e
JR
43## If we don't have a "version.i" or we have both files (version.i, version.i.tmp)
44## and they are different, copy "version.i.tmp" over "version.i".
45## This way the dependent targets are only rebuilt when the git version
46## string or either one of extra version string change.
337d64f0
MJ
47##
48version_verbose = $(version_verbose_@AM_V@)
49version_verbose_ = $(version_verbose_@AM_DEFAULT_V@)
50version_verbose_0 = @echo " GEN " $@;
51
52version.i:
53 $(version_verbose)rm -f version.i.tmp; \
54 if (test -r "$(top_srcdir)/bootstrap" && test -r "$(top_srcdir)/.git") && \
55 test -x "`which git 2>&1;true`"; then \
56 GIT_VERSION_STR="`cd "$(top_srcdir)" && git describe --tags --dirty`"; \
57 GIT_CURRENT_TAG="`cd "$(top_srcdir)" && git describe --tags --exact-match --match="v[0-9]*" HEAD 2> /dev/null`"; \
58 echo "#define GIT_VERSION \"$$GIT_VERSION_STR\"" > version.i.tmp; \
59 if ! $(GREP) -- "-dirty" version.i.tmp > /dev/null && \
60 test "x$$GIT_CURRENT_TAG" != "x"; then \
61 echo "#define GIT_VERSION \"\"" > version.i.tmp; \
88564da0 62 fi; \
337d64f0
MJ
63 fi; \
64 if test ! -f version.i.tmp; then \
2ebe596e
JR
65 if test -f version.i; then \
66 $(GREP) "^#define \bGIT_VERSION\b.*" version.i > version.i.tmp; \
67 else \
68 echo '#define GIT_VERSION ""' > version.i.tmp; \
88564da0 69 fi; \
2ebe596e
JR
70 fi; \
71 echo "#define EXTRA_VERSION_NAME \"`$(SED) -n '1p' "$(top_srcdir)/version/extra_version_name" 2> /dev/null`\"" >> version.i.tmp; \
72 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; \
7f5ed73a 73 echo "#define EXTRA_VERSION_PATCHES \"`ls --ignore='README' -1 "$(top_srcdir)/version/extra_patches" | $(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 74 if test ! -f version.i || \
337d64f0
MJ
75 test x"`cat version.i.tmp`" != x"`cat version.i`"; then \
76 mv version.i.tmp version.i; \
77 fi; \
78 rm -f version.i.tmp; \
79 true
88564da0
RB
80
81##
337d64f0
MJ
82## version.i is defined as a .PHONY target even if it's a real file,
83## we want the target to be re-run on every make.
88564da0 84##
337d64f0 85.PHONY: version.i
88564da0 86
337d64f0 87CLEANFILES = version.i.tmp
ec148ec6 88
337d64f0
MJ
89##
90## Only clean "version.i" on dist-clean, we need to keep it on regular
91## clean when it's part of a dist tarball.
92##
93DISTCLEANFILES = version.i
4c6ac053 94
55d09795 95lttnginclude_HEADERS = \
d74df422 96 lttng/health.h \
55d09795 97 lttng/lttng.h \
1239a312
DG
98 lttng/constant.h \
99 lttng/channel.h \
100 lttng/domain.h \
101 lttng/event.h \
102 lttng/handle.h \
103 lttng/session.h \
55d09795 104 lttng/lttng-error.h \
00c76cea 105 lttng/snapshot.h \
88564da0 106 lttng/save.h \
9245bd0e 107 lttng/load.h \
a58c490f 108 lttng/endpoint.h \
db66e574 109 lttng/rotation.h \
1ce46cfe 110 lttng/location.h \
b178f53e 111 lttng/userspace-probe.h \
3e3665b8
JG
112 lttng/session-descriptor.h \
113 lttng/destruction-handle.h
da3c9ec1 114
a58c490f
JG
115lttngactioninclude_HEADERS= \
116 lttng/action/action.h \
117 lttng/action/notify.h
118
119lttngconditioninclude_HEADERS= \
120 lttng/condition/condition.h \
121 lttng/condition/buffer-usage.h \
e8360425 122 lttng/condition/session-consumed-size.h \
c19092cd 123 lttng/condition/session-rotation.h \
a58c490f
JG
124 lttng/condition/evaluation.h
125
126lttngnotificationinclude_HEADERS= \
127 lttng/notification/channel.h \
128 lttng/notification/notification.h
129
130lttngtriggerinclude_HEADERS= \
131 lttng/trigger/trigger.h
132
55d09795
MD
133noinst_HEADERS = \
134 lttng/snapshot-internal.h \
00c76cea 135 lttng/health-internal.h \
9245bd0e 136 lttng/save-internal.h \
a58c490f
JG
137 lttng/load-internal.h \
138 lttng/action/action-internal.h \
139 lttng/action/notify-internal.h \
140 lttng/condition/condition-internal.h \
141 lttng/condition/buffer-usage-internal.h \
e8360425 142 lttng/condition/session-consumed-size-internal.h \
a58c490f 143 lttng/condition/evaluation-internal.h \
c19092cd 144 lttng/condition/session-rotation-internal.h \
a58c490f
JG
145 lttng/notification/notification-internal.h \
146 lttng/trigger/trigger-internal.h \
147 lttng/endpoint-internal.h \
932a07e0 148 lttng/notification/channel-internal.h \
159e8e73 149 lttng/channel-internal.h \
2d1318e4 150 lttng/event-internal.h \
8abe313a 151 lttng/rotate-internal.h \
434131e4 152 lttng/ref-internal.h \
337d64f0 153 lttng/location-internal.h \
1ce46cfe 154 lttng/userspace-probe-internal.h \
b178f53e
JG
155 lttng/session-internal.h \
156 lttng/session-descriptor-internal.h \
337d64f0
MJ
157 version.h \
158 version.i
This page took 0.059528 seconds and 4 git commands to generate.