-
Notifications
You must be signed in to change notification settings - Fork 18
/
Makefile.am
141 lines (119 loc) · 6.26 KB
/
Makefile.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Top-level Makefile.am for UniversalCodeGrep
#
# Copyright 2015-2016 Gary R. Van Sickle ([email protected]).
#
# This file is part of UniversalCodeGrep.
#
# UniversalCodeGrep is free software: you can redistribute it and/or modify it under the
# terms of version 3 of the GNU General Public License as published by the Free
# Software Foundation.
#
# UniversalCodeGrep is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# UniversalCodeGrep. If not, see <http://www.gnu.org/licenses/>.
# Make sure autotools pick up the M4 macros in the ./m4 directory, and also copy
# any third-party macros (e.g. the system-wide ax_* Autoconf Macro Archive ones
# in /usr/share/aclocal) to ./m4 so they get distributed and automatically updated.
# Only useful in the top-level Makefile.am (see http://sources.redhat.com/automake/automake.html#Rebuilding).
ACLOCAL_AMFLAGS = -I m4 --install
# The subdirectories containing the source code, docs, and tests.
# Note: The code in src depends on the libraries in third_party, so make sure the latter is always listed before the former.
# Note that we can't list these other libraries in e.g. *_DEPENDENCIES because that replaces all Automake-generated dependencies.
SUBDIRS = third_party src . doc tests
# Set these *CLEANFILES Automake vars to empty, so that we can simply always append (+=) to them later.
CLEANFILES =
MOSTLYCLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
# Make sure README.rd and other docs get distributed and installed correctly.
dist_doc_DATA = README.md NEWS.md COPYING AUTHORS
# Update libtool if it gets out of date.
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status libtool
# The Automake rules for the ucg executable.
bin_PROGRAMS=ucg
ucg_SOURCES=main.cpp build_info.h libtool
nodist_ucg_SOURCES=build_info.cpp
CLEANFILES += build_info.cpp
ucg_CPPFLAGS = -I $(top_srcdir)/src $(AM_CPPFLAGS) $(PCRE_CPPFLAGS) $(PCRE2_CPPFLAGS) $(TBBMALLOC_PROXY_CPPFLAGS) $(TBBMALLOC_CPPFLAGS)
ucg_CFLAGS = $(AM_CFLAGS) $(PCRE_CFLAGS) $(PCRE2_CFLAGS)
ucg_CXXFLAGS = $(AM_CXXFLAGS) $(PCRE_CFLAGS) $(PCRE2_CFLAGS)
ucg_LDFLAGS = $(AM_LDFLAGS)
ucg_LDADD = ./src/libsrc.la ./src/libext/libext.la ./src/future/libfuture.la $(PCRE_LIBS) $(PCRE2_LIBS) $(TBBMALLOC_PROXY_LIBS) $(TBBMALLOC_LIBS)
# Collect some make-time info.
FORCE:
build_info.cpp: FORCE verify-provenance
$(AM_V_GEN) { test -f "$@" && rm "$@"; } || true;
$(AM_V_GEN) { test -f "[email protected]" && rm "[email protected]"; } || true;
$(AM_V_GEN) echo "// Build information file." > "[email protected]";\
echo "// THIS FILE IS AUTOMATICALLY GENERATED BY THE TOP-LEVEL MAKEFILE, DO NOT EDIT" >> "[email protected]";\
echo "// VCS repo info (git describe / tarball)" >> "[email protected]"; \
if [ -f $(top_srcdir)/.tarball-version ]; then \
: We are building from a tarball. ; \
GIT_DESCRIBE=$$(cat $(top_srcdir)/.tarball-version); \
elif (which git > /dev/null && cd $(top_srcdir) && git describe > /dev/null); then \
: We are building from a git repo. ; \
GIT_DESCRIBE="$$(cd $(top_srcdir) && git describe --long --dirty --always)"; \
else GIT_DESCRIBE="unknown"; \
fi; \
echo "const char *g_git_describe = \"$${GIT_DESCRIBE}\";" >> "[email protected]"; \
echo "// CXX" >> "[email protected]";\
echo "const char *g_cxx = \"$(CXX)\";" >> "[email protected]";
# This is known to work for g++ and clang++.
$(AM_V_GEN) CXX_VERSION_STR=$$(if $$($(CXX) --version > /dev/null); then echo "$$($(CXX) --version | $(ESED) '/^Configured.*$$/d;' | head -n 1)"; else echo "unknown"; fi;); \
echo "const char *g_cxx_version_str = \"$${CXX_VERSION_STR}\";" >> "[email protected]";
$(AM_V_GEN) mv "[email protected]" "$@"
# Make sure we're either trying to build from a git repo or a tarball, and not in some weird state.
verify-provenance:
@if [ -d "$(top_srcdir)/.git" -a -f "$(top_srcdir)/.tarball-version" ]; \
then \
echo "ERROR: The top-level source directory, \"$(top_srcdir)\", appears to be in an"; \
echo "inconsistent state: it looks like both an extracted tarball and a .git repo."; \
echo "Removing the file \"$(top_srcdir)/.tarball-version\" will allow it to build."; \
exit 1; \
fi;
# Valgrind rules.
# @todo Note that this expands to GNU-make-only constructs, which fails on the BSDs.
#@VALGRIND_CHECK_RULES@
#VALGRIND_SUPPRESSIONS_FILES = ## No suppressions currently.
#EXTRA_DIST = ## No suppressions currently.
# Doxygen rules
@DX_RULES@
MOSTLYCLEANFILES+=$(DX_CLEANFILES)
## ------------- ##
## Distribution. ##
## ------------- ##
# Hook the "make dist" target to generate a ".tarball-version" file in the root dir of the tarball.
# This .tarball-version file contains the repo version info corresponding to the repo from which the tarball was
# built. It should only ever exist in a distribution tarball (and the source tree extracted from that tarball).
# if it for some reason exists in the working directory of a repo, that's an error, and it will be caught above in the
# "verify-provenance" rule.
dist-hook:
printf '%s' "$$(cd $(top_srcdir) && git describe --long --dirty --always | tr -d '\r\n')-tarball" > "$(distdir)/.tarball-version"
##-------------------##
## Maintainer rules. ##
##-------------------##
# Short rule to rebuild configure if necessary and reconfigure, but not build the rest of the project.
.PHONY: reconf
reconf: ./config.status
$(SHELL) ./config.status --recheck
.PHONY: autoreconf
autoreconf:
$(SHELL) cd $(abs_top_srcdir) && autoreconf -if
check-malloc:
export MALLOC_CHECK_=3 && $(MAKE) check
.PHONY: check-vg-memcheck
check-vg-memcheck: ./ucg$(EXEEXT)
valgrind --log-file=$(builddir)/vg_memcheck_log.txt --track-fds=yes --read-inline-info=yes --read-var-info=yes --show-emwarns=yes \
--tool=memcheck -v --track-origins=yes --leak-check=full \
--partial-loads-ok=no --show-leak-kinds=all --expensive-definedness-checks=yes ./ucg --cpp 'BOOST.*HPP' ~/src/boost_1_58_0/
check-vg-drd: ./ucg$(EXEEXT)
valgrind --tool=drd --read-var-info=yes --trace-hb==yes --trace-mutex=yes --trace-rwlock=yes ./ucg --cpp 'BOOST.*HPP' ~/src/boost_1_58_0
check-clang:
$(MAKE) distclean && ../configure CC=clang CXX=clang++ && $(MAKE) check
# $(MAKE) distclean && ../configure
check-man: $(builddir)/doc/mancheck.man
run meld "$<" "$(srcdir)/doc/ucg.1"