4b59e72d8589d28af21e7b4a531539e0fdcbc050
[lttng-tools.git] / include / Makefile.am
1 if LTTNG_TOOLS_BUILD_GIT_SOURCE
2 GIT_DESCRIBE_CMD = (cd $(top_srcdir); git describe)
3 else
4 GIT_DESCRIBE_CMD = /bin/true
5 endif
6
7 ##
8 ## The version.h file must be verified and generated or updated if the
9 ## git commit id (called git version here) changed since the last build
10 ## of lttng-tools.
11 ##
12 version.h:
13 ##
14 ## We first create variables for the current git version and
15 ## the locations of the version.h and version.h.tmpl files.
16 ##
17 @echo -n "Generating version.h... "
18 @(version_h_tmpl="$(top_srcdir)/include/version.h.tmpl"; \
19 if [ -f "$${version_h_tmpl}" ]; then \
20 version_h="$(top_builddir)/include/version.h"; \
21 ##
22 ## Check whether we are in a git repo.
23 ##
24 git_describe="$$($(GIT_DESCRIBE_CMD) 2>/dev/null)"; \
25 if [ $$? -eq 0 ]; then \
26 git_version="$${git_describe}"; \
27 else \
28 git_version=""; \
29 fi; \
30 ##
31 ## If the version.h file doesn't exist or is not up to date,
32 ## We replace it by the version.h.tmpl file.
33 ##
34 if [ ! -e "$${version_h}" ] || \
35 [ "$${version_h_tmpl}" -nt "$${version_h}" ]; then \
36 cp "$${version_h_tmpl}" "$${version_h}"; \
37 fi; \
38 echo -n "git version: \"$${git_version}\""; \
39 ##
40 ## We verify that git_version isn't the same as the one
41 ## currently in the file (if there is one), as we don't
42 ## want to update the file if it is already up to date.
43 ##
44 version_match='^#define GIT_VERSION.*'; \
45 old_version=$$(grep "$${version_match}" "$${version_h}"); \
46 new_version="#define GIT_VERSION \"$${git_version}\""; \
47 if [ x"$${old_version}" != x"$${new_version}" ]; then \
48 sed -i "s'$${version_match}'$${new_version}'" "$${version_h}"; \
49 else \
50 echo -n " (cached)"; \
51 fi; \
52 echo -n "... "; \
53 fi)
54 @echo "ok"
55
56 ##
57 ## version.h is defined as a .PHONY file even if it's a real file as
58 ## we want our routine to be runned for each build.
59 ##
60 .PHONY: version.h
61
62 nodist_noinst_HEADERS = \
63 version.h
64
65 lttnginclude_HEADERS = \
66 lttng/health.h \
67 lttng/lttng.h \
68 lttng/constant.h \
69 lttng/channel.h \
70 lttng/domain.h \
71 lttng/event.h \
72 lttng/handle.h \
73 lttng/session.h \
74 lttng/lttng-error.h \
75 lttng/snapshot.h \
76 lttng/save.h \
77 lttng/load.h \
78 version.h.tmpl
79
80 noinst_HEADERS = \
81 lttng/snapshot-internal.h \
82 lttng/health-internal.h \
83 lttng/save-internal.h \
84 lttng/load-internal.h
This page took 0.033712 seconds and 3 git commands to generate.