1 if LTTNG_TOOLS_BUILD_GIT_SOURCE
2 GIT_DESCRIBE_CMD = (cd $(top_srcdir); git describe)
4 GIT_DESCRIBE_CMD = /bin/true
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
14 ## We first create variables for the current git version and
15 ## the locations of the version.h and version.h.tmpl files.
17 @echo $(ECHO_N) "Generating version.h... $(ECHO_C)"
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"; \
22 ## Check whether we are in a git repo.
24 git_describe="`$(GIT_DESCRIBE_CMD) 2>/dev/null`"; \
25 if [ $$? -eq 0 ]; then \
26 git_version="$${git_describe}"; \
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.
34 if [ ! -e "$${version_h}" ] || \
35 [ "$${version_h_tmpl}" -nt "$${version_h}" ]; then \
36 cp "$${version_h_tmpl}" "$${version_h}"; \
38 echo $(ECHO_N) "git version: \"$${git_version}\"$(ECHO_C)"; \
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.
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 -e "s'$${version_match}'$${new_version}'" "$${version_h}"; \
50 echo $(ECHO_N) " (cached)$(ECHO_C)"; \
52 echo $(ECHO_N) "... $(ECHO_C)"; \
57 ## version.h is defined as a .PHONY file even if it's a real file as
58 ## we want our routine to be ran for each build.
62 CLEANFILES = version.h
64 nodist_noinst_HEADERS = \
67 lttnginclude_HEADERS = \
85 lttngactioninclude_HEADERS= \
86 lttng/action/action.h \
89 lttngconditioninclude_HEADERS= \
90 lttng/condition/condition.h \
91 lttng/condition/buffer-usage.h \
92 lttng/condition/session-consumed-size.h \
93 lttng/condition/evaluation.h
95 lttngnotificationinclude_HEADERS= \
96 lttng/notification/channel.h \
97 lttng/notification/notification.h
99 lttngtriggerinclude_HEADERS= \
100 lttng/trigger/trigger.h
103 lttng/snapshot-internal.h \
104 lttng/health-internal.h \
105 lttng/save-internal.h \
106 lttng/load-internal.h \
107 lttng/action/action-internal.h \
108 lttng/action/notify-internal.h \
109 lttng/condition/condition-internal.h \
110 lttng/condition/buffer-usage-internal.h \
111 lttng/condition/session-consumed-size-internal.h \
112 lttng/condition/evaluation-internal.h \
113 lttng/notification/notification-internal.h \
114 lttng/trigger/trigger-internal.h \
115 lttng/endpoint-internal.h \
116 lttng/notification/channel-internal.h \
117 lttng/channel-internal.h \
118 lttng/rotate-internal.h \
119 lttng/ref-internal.h \
120 lttng/location-internal.h