summaryrefslogtreecommitdiffstats
path: root/src/Makefile.am
blob: 71d56be030d59acf1024f6dfd2ec96f234f5bd40 (plain)
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
## Process this file with automake to create Makefile.in
##
## Copyright (C) 1996-2014, 2016 Red Hat, Inc.
## This file is part of elfutils.
##
## This file is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## elfutils 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 this program.  If not, see <http://www.gnu.org/licenses/>.
##
include $(top_srcdir)/config/eu.am
DEFS += $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \
	-DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
	    -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \
	    -I$(srcdir)/../libdwfl -I$(srcdir)/../libasm

AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw
AM_CFLAGS += -Wno-null-dereference

bin_PROGRAMS = readelf nm size strip elflint findtextrel addr2line \
	       elfcmp objdump ranlib strings ar unstrip stack elfcompress

noinst_LIBRARIES = libar.a

libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c

EXTRA_DIST = arlib.h debugpred.h

bin_SCRIPTS = make-debug-archive
EXTRA_DIST += make-debug-archive.in
CLEANFILES += make-debug-archive

if NATIVE_PE
dl_LDADD = -ldl -lpsapi
else
dl_LDADD = -ldl
endif

if BUILD_STATIC
libasm = ../libasm/libasm.a
libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) $(dl_LDADD)
libelf = ../libelf/libelf.a -lz
else
libasm = ../libasm/$(libasm_BARE)
libdw = ../libdw/$(libdw_BARE)
libelf = ../libelf/$(libelf_BARE)
endif
libebl = ../libebl/libebl.a
libeu = ../lib/libeu.a
if USE_GNULIB
libgnu = ../libgnu/libgnu.a
else
libgnu =
endif

if DEMANGLE
demanglelib = -lstdc++
endif

# Bad, bad stack usage...
readelf_no_Wstack_usage = yes
nm_no_Wstack_usage = yes
size_no_Wstack_usage = yes
strip_no_Wstack_usage = yes
elflint_no_Wstack_usage = yes
findtextrel_no_Wstack_usage = yes
elfcmp_no_Wstack_usage = yes
objdump_no_Wstack_usage = yes
ranlib_no_Wstack_usage = yes
ar_no_Wstack_usage = yes
unstrip_no_Wstack_usage = yes

readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) $(dl_LDADD)
nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) $(dl_LDADD) \
	   $(demanglelib)
size_LDADD = $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) $(intl_LDADD) $(dl_LDADD)
elflint_LDADD  = $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) $(dl_LDADD)
findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) $(demanglelib)
elfcmp_LDADD = $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) $(dl_LDADD)
objdump_LDADD  = $(libasm) $(libebl) $(libelf) $(libeu) $(libgnu) $(intl_LDADD) $(dl_LDADD)
ranlib_LDADD = libar.a $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
strings_LDADD = $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
ar_LDADD = libar.a $(libelf) $(libeu) $(libgnu) $(intl_LDADD)
unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) $(intl_LDADD) $(dl_LDADD)
stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) $(intl_LDADD) $(dl_LDADD) \
	      $(demanglelib)
elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libgnu) $(intl_LDADD)

if NATIVE_PE
ld_path_var = PATH
else
ld_path_var = LD_LIBRARY_PATH
endif

installcheck-binPROGRAMS: $(bin_PROGRAMS)
	bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
	  case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
	   *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
	  esac; \
	  f=`echo "$$p" | \
	     sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
	  for opt in --help --version; do \
	    if $(ld_path_var)=$$$(ld_path_var):$(DESTDIR)$(libdir) \
	       $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \
		 && test -n "`cat c$${pid}_.out`" \
		 && test -z "`cat c$${pid}_.err`"; then :; \
	    else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
	  done; \
	done; rm -f c$${pid}_.???; exit $$bad

CLEANFILES += *.gconv

make-debug-archive: $(srcdir)/make-debug-archive.in
	$(AM_V_GEN)UNSTRIP=$(bindir)/`echo unstrip | sed '$(transform)'`; \
	AR=$(bindir)/`echo ar | sed '$(transform)'`; \
	sed -e "s,[@]UNSTRIP[@],$$UNSTRIP,g" -e "s,[@]AR[@],$$AR,g" \
	    -e "s%[@]PACKAGE_NAME[@]%$(PACKAGE_NAME)%g" \
	    -e "s%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g" \
	    $(srcdir)/make-debug-archive.in > $@.new
	$(AM_V_at)chmod +x $@.new
	$(AM_V_at)mv -f $@.new $@