cli: move `--params` option's format parsing to its own file
[babeltrace.git] / src / common / Makefile.am
CommitLineData
578e048b
MJ
1AM_CPPFLAGS += -DINSTALL_LIBDIR=\"$(libdir)\"
2
3noinst_LTLIBRARIES = libbabeltrace2-common.la
4
5libbabeltrace2_common_la_SOURCES = \
6 assert.h \
7 assert.c \
8 common.c \
86d8b7b8 9 common.h
578e048b
MJ
10
11noinst_HEADERS = \
12 align.h \
578e048b 13 list.h \
91d81473 14 macros.h \
578e048b 15 mmap-align.h \
91d81473 16 safe.h \
578e048b
MJ
17 version.h \
18 version.i
19
20##
21## This target generates an include file that contains the git version
22## string of the current branch, it must be continuously updated when
23## we build in the git repo and shipped in dist tarballs to reflect the
24## status of the tree when it was generated. If the tree is clean and
25## the current commit is tag a starting with "v", consider this a
26## release version and set an empty git version.
27##
28## Here is what the inline script does:
29##
30## First, delete any stale "version.i.tmp" file.
31##
32## If "bootstrap" and ".git" exists in the top source directory and the git
33## executable is available, get the current git version string in the form:
34##
35## "latest_tag"(-"number_of_commits_on_top")(-g"latest_commit_hash")(-dirty)
36##
37## And store it in "version.i.tmp", if the current commit is tagged, the tag
38## starts with "v" and the tree is clean, consider this a release version and
39## overwrite the git version with an empty string in "version.i.tmp".
40##
41## If we don't have a "version.i.tmp" nor a "version.i", generate an empty
42## string as a failover.
43##
44## If we don't have a "version.i" or we have both files and they are different,
45## copy "version.i.tmp" over "version.i". This way the dependent targets are
46## only rebuilt when the version string changes.
47##
48
49version_verbose = $(version_verbose_@AM_V@)
50version_verbose_ = $(version_verbose_@AM_DEFAULT_V@)
51version_verbose_0 = @echo " GEN " $@;
52
53version.i:
54 $(version_verbose)rm -f version.i.tmp; \
55 if (test -r "$(top_srcdir)/bootstrap" && test -r "$(top_srcdir)/.git") && \
56 test -x "`which git 2>&1;true`"; then \
57 GIT_VERSION_STR="`cd "$(top_srcdir)" && git describe --tags --dirty`"; \
58 GIT_CURRENT_TAG="`cd "$(top_srcdir)" && git describe --tags --exact-match --match="v[0-9]*" HEAD 2> /dev/null`"; \
59 echo "#define GIT_VERSION \"$$GIT_VERSION_STR\"" > version.i.tmp; \
60 if ! $(GREP) -- "-dirty" version.i.tmp > /dev/null && \
61 test "x$$GIT_CURRENT_TAG" != "x"; then \
62 echo "#define GIT_VERSION \"\"" > version.i.tmp; \
63 fi; \
64 fi; \
65 if test ! -f version.i.tmp; then \
66 if test ! -f version.i; then \
67 echo '#define GIT_VERSION ""' > version.i; \
68 fi; \
69 elif test ! -f version.i || \
70 test x"`cat version.i.tmp`" != x"`cat version.i`"; then \
71 mv version.i.tmp version.i; \
72 fi; \
73 rm -f version.i.tmp; \
74 true
75
76##
77## version.i is defined as a .PHONY target even if it's a real file,
78## we want the target to be re-run on every make.
79##
80.PHONY: version.i
81
82CLEANFILES = version.i.tmp
83
84##
85## Only clean "version.i" on dist-clean, we need to keep it on regular
86## clean when it's part of a dist tarball.
87##
88DISTCLEANFILES = version.i
This page took 0.036709 seconds and 4 git commands to generate.