add packaging
[platform/upstream/elfutils.git] / Makefile.am
1 ## Process this file with automake to create Makefile.in
2 ## Configure input file for elfutils.
3 ##
4 ## Copyright (C) 1996-2006, 2008, 2009, 2015 Red Hat, Inc.
5 ##
6 ## This file is part of elfutils.
7 ##
8 ## This file is free software; you can redistribute it and/or modify
9 ## it under the terms of the GNU General Public License as published by
10 ## the Free Software Foundation; either version 3 of the License, or
11 ## (at your option) any later version.
12 ##
13 ## elfutils is distributed in the hope that it will be useful, but
14 ## WITHOUT ANY WARRANTY; without even the implied warranty of
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 ## GNU General Public License for more details.
17 ##
18 ## You should have received a copy of the GNU General Public License
19 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
20 ##
21 ACLOCAL_AMFLAGS = -I m4
22
23 # automake already tells which subdir is being entered.
24 # Don't make make repeat.
25 AM_MAKEFLAGS = --no-print-directory
26
27 pkginclude_HEADERS = version.h
28
29 SUBDIRS = config lib libelf libcpu backends libebl libdwelf libdwfl libdw \
30           libasm debuginfod src po doc tests
31
32 EXTRA_DIST = elfutils.spec GPG-KEY NOTES CONTRIBUTING \
33              COPYING COPYING-GPLV2 COPYING-LGPLV3
34
35 # Make sure the test install uses lib64 when $LIB will yield lib64.
36 # Make sure the test build uses the same compiler, which on e.g. ppc64
37 # determines which platform we are actually testing.
38 # Run all tests under valgrind.
39 AM_DISTCHECK_CONFIGURE_FLAGS = \
40         --libdir=`echo $(libdir) | sed "s,^$(exec_prefix),$$dc_install_base,"`\
41         CC="$(CC)"
42
43 distcheck-hook:
44         chmod -R u+w $(distdir)
45
46 rpm: dist
47         rpmbuild -ts elfutils-@PACKAGE_VERSION@.tar.bz2
48
49 if GCOV
50
51 COVERAGE_OUTPUT_FILE = $(PACKAGE_NAME).lcov
52 COVERAGE_OUTPUT_DIRECTORY = coverage
53 COVERAGE_OUTPUT_INDEX_HTML = $(COVERAGE_OUTPUT_DIRECTORY)/index.html
54 COVERAGE_TITLE = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
55
56 COVERAGE_DIRS = $(filter-out tests,$(SUBDIRS))
57 src_COVERAGE_DIRS = $(patsubst %,$(srcdir)/%,$(COVERAGE_DIRS))
58 build_COVERAGE_DIRS = $(patsubst %,$(builddir)/%,$(COVERAGE_DIRS))
59 all_COVERAGE_DIRS = $(sort $(src_COVERAGE_DIRS) $(build_COVERAGE_DIRS))
60 LCOV_DIRS_ARGS = $(patsubst %,--directory=%,$(all_COVERAGE_DIRS))
61
62 CLEANFILES = $(COVERAGE_OUTPUT_FILE)
63
64 .PHONY: coverage coverage-clean
65
66 clean-local: coverage-clean
67 distclean-local: coverage-clean
68
69 coverage-clean:
70         -rm -rf $(COVERAGE_OUTPUT_DIRECTORY)
71
72 coverage: $(COVERAGE_OUTPUT_INDEX_HTML)
73         @echo 'file://$(abs_builddir)/$(COVERAGE_OUTPUT_INDEX_HTML)'
74
75 $(COVERAGE_OUTPUT_INDEX_HTML): $(COVERAGE_OUTPUT_FILE)
76         LC_ALL=C $(GENHTML) \
77                 --legend \
78                 --show-details \
79                 --rc=genhtml_branch_coverage=1 \
80                 --title='$(COVERAGE_TITLE)' \
81                 --prefix='$(abspath $(abs_srcdir))' \
82                 --prefix='$(realpath $(abs_srcdir))' \
83                 --prefix='$(abspath $(abs_builddir)/..)' \
84                 --prefix='$(realpath $(abs_builddir)/..)' \
85                 --output-directory='$(COVERAGE_OUTPUT_DIRECTORY)' \
86                 $<
87
88 $(COVERAGE_OUTPUT_FILE):
89         $(LCOV) \
90                 --capture \
91                 --no-external \
92                 --no-checksum \
93                 --rc=lcov_branch_coverage=1 \
94                 --gcov-tool='$(GCOV)' \
95                 --output-file='$@' \
96                 $(LCOV_DIRS_ARGS)
97
98 endif
99
100 # Tell version 3.79 and up of GNU make to not build goals in this
101 # directory in parallel.
102 .NOTPARALLEL: