1## Process this file with automake to create Makefile.in
2##
3## Copyright (C) 2002-2010, 2012, 2014 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 either
8##
9##   * the GNU Lesser General Public License as published by the Free
10##     Software Foundation; either version 3 of the License, or (at
11##     your option) any later version
12##
13## or
14##
15##   * the GNU General Public License as published by the Free
16##     Software Foundation; either version 2 of the License, or (at
17##     your option) any later version
18##
19## or both in parallel, as here.
20##
21## elfutils is distributed in the hope that it will be useful, but
22## WITHOUT ANY WARRANTY; without even the implied warranty of
23## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24## General Public License for more details.
25##
26## You should have received copies of the GNU General Public License and
27## the GNU Lesser General Public License along with this program.  If
28## not, see <http://www.gnu.org/licenses/>.
29##
30include $(top_srcdir)/config/eu.am
31if BUILD_STATIC
32AM_CFLAGS += -fPIC
33endif
34AM_CPPFLAGS += -I$(srcdir)/../libelf
35VERSION = 1
36
37lib_LIBRARIES = libdw.a
38noinst_LIBRARIES = libdw_pic.a
39noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
40
41include_HEADERS = dwarf.h
42pkginclude_HEADERS = libdw.h known-dwarf.h
43
44libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
45		  dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \
46		  dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \
47		  dwarf_attr.c dwarf_formstring.c \
48		  dwarf_abbrev_hash.c dwarf_sig8_hash.c \
49		  dwarf_attr_integrate.c dwarf_hasattr_integrate.c \
50		  dwarf_child.c dwarf_haschildren.c dwarf_formaddr.c \
51		  dwarf_formudata.c dwarf_formsdata.c dwarf_lowpc.c \
52		  dwarf_entrypc.c dwarf_haspc.c dwarf_highpc.c dwarf_ranges.c \
53		  dwarf_formref.c dwarf_formref_die.c dwarf_siblingof.c \
54		  dwarf_dieoffset.c dwarf_cuoffset.c dwarf_diecu.c \
55		  dwarf_hasattr.c dwarf_hasform.c \
56		  dwarf_whatform.c dwarf_whatattr.c \
57		  dwarf_bytesize.c dwarf_arrayorder.c dwarf_bitsize.c \
58		  dwarf_bitoffset.c dwarf_srclang.c dwarf_getabbrevtag.c \
59		  dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \
60		  dwarf_getattrcnt.c dwarf_getabbrevattr.c \
61		  dwarf_getsrclines.c dwarf_getsrc_die.c \
62		  dwarf_getscopes.c dwarf_getscopes_die.c dwarf_getscopevar.c \
63		  dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \
64		  dwarf_linecol.c dwarf_linebeginstatement.c \
65		  dwarf_lineendsequence.c dwarf_lineblock.c \
66		  dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \
67		  dwarf_lineisa.c dwarf_linediscriminator.c \
68		  dwarf_lineop_index.c \
69		  dwarf_onesrcline.c dwarf_formblock.c \
70		  dwarf_getsrcfiles.c dwarf_filesrc.c dwarf_getsrcdirs.c \
71		  dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \
72		  dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \
73		  dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \
74		  dwarf_getmacros.c dwarf_macro_getparamcnt.c	\
75		  dwarf_macro_opcode.c dwarf_macro_param.c	\
76		  dwarf_macro_param1.c dwarf_macro_param2.c	\
77		  dwarf_macro_getsrcfiles.c			\
78		  dwarf_addrdie.c dwarf_getfuncs.c \
79		  dwarf_decl_file.c dwarf_decl_line.c dwarf_decl_column.c \
80		  dwarf_func_inline.c dwarf_getsrc_file.c \
81		  libdw_findcu.c libdw_form.c libdw_alloc.c \
82		  libdw_visit_scopes.c \
83		  dwarf_entry_breakpoints.c \
84		  dwarf_next_cfi.c \
85		  cie.c fde.c cfi.c frame-cache.c \
86		  dwarf_frame_info.c dwarf_frame_cfa.c dwarf_frame_register.c \
87		  dwarf_cfi_addrframe.c \
88		  dwarf_getcfi.c dwarf_getcfi_elf.c dwarf_cfi_end.c \
89		  dwarf_aggregate_size.c dwarf_getlocation_implicit_pointer.c \
90		  dwarf_getlocation_die.c dwarf_getlocation_attr.c \
91		  dwarf_getalt.c dwarf_setalt.c dwarf_cu_getdwarf.c \
92		  dwarf_cu_die.c dwarf_peel_type.c
93
94if MAINTAINER_MODE
95BUILT_SOURCES = $(srcdir)/known-dwarf.h
96MAINTAINERCLEANFILES = $(srcdir)/known-dwarf.h
97$(srcdir)/known-dwarf.h: $(top_srcdir)/config/known-dwarf.awk $(srcdir)/dwarf.h
98	gawk -f $^ > $@.new
99	mv -f $@.new $@
100endif
101
102libdw_pic_a_SOURCES =
103am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
104
105libdw_so_SOURCES =
106libdw.so$(EXEEXT): $(srcdir)/libdw.map libdw_pic.a ../libdwelf/libdwelf_pic.a \
107	  ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
108	  ../libelf/libelf.so
109# The rpath is necessary for libebl because its $ORIGIN use will
110# not fly in a setuid executable that links in libdw.
111	$(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
112		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
113		-Wl,--version-script,$<,--no-undefined \
114		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
115		-ldl -lz $(argp_LDADD) $(zip_LIBS)
116	@$(textrel_check)
117	$(AM_V_at)ln -fs $@ $@.$(VERSION)
118
119install: install-am libdw.so
120	$(mkinstalldirs) $(DESTDIR)$(libdir)
121	$(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
122	ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
123	ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
124
125uninstall: uninstall-am
126	rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
127	rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
128	rm -f $(DESTDIR)$(libdir)/libdw.so
129	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
130
131libdwfl_objects = $(shell $(AR) t ../libdwfl/libdwfl.a)
132libdw_a_LIBADD = $(addprefix ../libdwfl/,$(libdwfl_objects))
133
134libdwelf_objects = $(shell $(AR) t ../libdwelf/libdwelf.a)
135libdw_a_LIBADD += $(addprefix ../libdwelf/,$(libdwelf_objects))
136
137noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h \
138		 dwarf_sig8_hash.h cfi.h encoded-value.h
139
140EXTRA_DIST = libdw.map
141
142MOSTLYCLEANFILES = $(am_libdw_pic_a_OBJECTS) libdw.so.$(VERSION)
143