xref: /aosp_15_r20/external/elfutils/src/Makefile.am (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1## Process this file with automake to create Makefile.in
2##
3## Copyright (C) 1996-2014, 2016 Red Hat, Inc.
4## This file is part of elfutils.
5##
6## This file is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; either version 3 of the License, or
9## (at your option) any later version.
10##
11## elfutils is distributed in the hope that it will be useful, but
12## WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program.  If not, see <http://www.gnu.org/licenses/>.
18##
19include $(top_srcdir)/config/eu.am
20DEFS += $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \
21	-DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
22AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
23	    -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \
24	    -I$(srcdir)/../libdwfl -I$(srcdir)/../libasm -I../debuginfod
25
26AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw $(STACK_USAGE_NO_ERROR)
27
28bin_PROGRAMS = readelf nm size strip elflint findtextrel addr2line \
29	       elfcmp objdump ranlib strings ar unstrip stack elfcompress \
30	       elfclassify srcfiles
31
32noinst_LIBRARIES = libar.a
33
34libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c
35
36EXTRA_DIST = arlib.h debugpred.h
37
38bin_SCRIPTS = make-debug-archive
39EXTRA_DIST += make-debug-archive.in
40CLEANFILES += make-debug-archive
41
42if BUILD_STATIC
43libasm = ../libasm/libasm.a
44libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) -ldl -lpthread
45libelf = ../libelf/libelf.a -lz $(zstd_LIBS)
46if LIBDEBUGINFOD
47libdebuginfod = ../debuginfod/libdebuginfod.a -lpthread $(libcurl_LIBS)
48else
49libdebuginfod =
50endif
51else
52libasm = ../libasm/libasm.so
53libdw = ../libdw/libdw.so
54libelf = ../libelf/libelf.so
55if LIBDEBUGINFOD
56libdebuginfod = ../debuginfod/libdebuginfod.so
57else
58libdebuginfod =
59endif
60endif
61libebl = ../libebl/libebl.a ../backends/libebl_backends.a ../libcpu/libcpu.a
62libeu = ../lib/libeu.a
63
64if DEMANGLE
65demanglelib = -lstdc++
66endif
67
68# Bad, bad stack usage...
69readelf_no_Wstack_usage = yes
70nm_no_Wstack_usage = yes
71size_no_Wstack_usage = yes
72strip_no_Wstack_usage = yes
73elflint_no_Wstack_usage = yes
74elfcmp_no_Wstack_usage = yes
75objdump_no_Wstack_usage = yes
76ranlib_no_Wstack_usage = yes
77ar_no_Wstack_usage = yes
78unstrip_no_Wstack_usage = yes
79
80readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD)
81nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS) \
82	   $(demanglelib)
83size_LDADD = $(libelf) $(libeu) $(argp_LDADD)
84strip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
85elflint_LDADD  = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
86findtextrel_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD)
87addr2line_LDADD = $(libdw) $(libelf) $(libeu) $(argp_LDADD) $(demanglelib)
88elfcmp_LDADD = $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
89objdump_LDADD  = $(libasm) $(libebl) $(libdw) $(libelf) $(libeu) $(argp_LDADD)
90ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
91strings_LDADD = $(libelf) $(libeu) $(argp_LDADD)
92ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) $(obstack_LIBS)
93unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
94stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) $(demanglelib)
95elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD)
96elfclassify_LDADD = $(libelf) $(libdw) $(libeu) $(argp_LDADD)
97srcfiles_SOURCES = srcfiles.cxx
98srcfiles_LDADD = $(libdw) $(libelf) $(libeu)  $(argp_LDADD) $(libarchive_LIBS) $(libdebuginfod)
99
100installcheck-binPROGRAMS: $(bin_PROGRAMS)
101	bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
102	  case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
103	   *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
104	  esac; \
105	  f=`echo "$$p" | \
106	     sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
107	  for opt in --help --version; do \
108	    if LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \
109	       $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \
110		 && test -n "`cat c$${pid}_.out`" \
111		 && test -z "`cat c$${pid}_.err`"; then :; \
112	    else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
113	  done; \
114	done; rm -f c$${pid}_.???; exit $$bad
115
116CLEANFILES += *.gconv
117
118make-debug-archive: $(srcdir)/make-debug-archive.in
119	$(AM_V_GEN)UNSTRIP=$(bindir)/`echo unstrip | sed '$(transform)'`; \
120	AR=$(bindir)/`echo ar | sed '$(transform)'`; \
121	sed -e "s,[@]UNSTRIP[@],$$UNSTRIP,g" -e "s,[@]AR[@],$$AR,g" \
122	    -e "s%[@]PACKAGE_NAME[@]%$(PACKAGE_NAME)%g" \
123	    -e "s%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g" \
124	    $(srcdir)/make-debug-archive.in > $@.new
125	$(AM_V_at)chmod +x $@.new
126	$(AM_V_at)mv -f $@.new $@
127