Home | History | Annotate | Download | only in libdw
      1 ## Process this file with automake to create Makefile.in
      2 ##
      3 ## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Red Hat, Inc.
      4 ## This file is part of Red Hat elfutils.
      5 ##
      6 ## Red Hat elfutils is free software; you can redistribute it and/or modify
      7 ## it under the terms of the GNU General Public License as published by the
      8 ## Free Software Foundation; version 2 of the License.
      9 ##
     10 ## Red Hat elfutils is distributed in the hope that it will be useful, but
     11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
     12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13 ## General Public License for more details.
     14 ##
     15 ## You should have received a copy of the GNU General Public License along
     16 ## with Red Hat elfutils; if not, write to the Free Software Foundation,
     17 ## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
     18 ##
     19 ## Red Hat elfutils is an included package of the Open Invention Network.
     20 ## An included package of the Open Invention Network is a package for which
     21 ## Open Invention Network licensees cross-license their patents.  No patent
     22 ## license is granted, either expressly or impliedly, by designation as an
     23 ## included package.  Should you wish to participate in the Open Invention
     24 ## Network licensing program, please visit www.openinventionnetwork.com
     25 ## <http://www.openinventionnetwork.com>.
     26 ##
     27 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DIS_LIBDW
     28 if MUDFLAP
     29 AM_CFLAGS = -fmudflap
     30 else
     31 AM_CFLAGS =
     32 endif
     33 if BUILD_STATIC
     34 AM_CFLAGS += -fpic
     35 endif
     36 AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99
     37 INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
     38 VERSION = 1
     39 
     40 COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
     41 						       $(COMPILE)))
     42 
     43 lib_LIBRARIES = libdw.a
     44 if !MUDFLAP
     45 noinst_LIBRARIES = libdw_pic.a
     46 noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
     47 endif
     48 
     49 include_HEADERS = dwarf.h
     50 pkginclude_HEADERS = libdw.h
     51 
     52 libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
     53 		  dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \
     54 		  dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \
     55 		  dwarf_attr.c dwarf_formstring.c dwarf_abbrev_hash.c \
     56 		  dwarf_attr_integrate.c dwarf_hasattr_integrate.c \
     57 		  dwarf_child.c dwarf_haschildren.c dwarf_formaddr.c \
     58 		  dwarf_formudata.c dwarf_formsdata.c dwarf_lowpc.c \
     59 		  dwarf_entrypc.c dwarf_haspc.c dwarf_highpc.c dwarf_ranges.c \
     60 		  dwarf_formref.c dwarf_formref_die.c dwarf_siblingof.c \
     61 		  dwarf_dieoffset.c dwarf_cuoffset.c dwarf_diecu.c \
     62 		  dwarf_hasattr.c dwarf_hasform.c \
     63 		  dwarf_whatform.c dwarf_whatattr.c \
     64 		  dwarf_bytesize.c dwarf_arrayorder.c dwarf_bitsize.c \
     65 		  dwarf_bitoffset.c dwarf_srclang.c dwarf_getabbrevtag.c \
     66 		  dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \
     67 		  dwarf_getattrcnt.c dwarf_getabbrevattr.c \
     68 		  dwarf_getsrclines.c dwarf_getsrc_die.c \
     69 		  dwarf_getscopes.c dwarf_getscopes_die.c dwarf_getscopevar.c \
     70 		  dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \
     71 		  dwarf_linecol.c dwarf_linebeginstatement.c \
     72 		  dwarf_lineendsequence.c dwarf_lineblock.c \
     73 		  dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \
     74 		  dwarf_onesrcline.c dwarf_formblock.c \
     75 		  dwarf_getsrcfiles.c dwarf_filesrc.c dwarf_getsrcdirs.c \
     76 		  dwarf_getlocation.c dwarf_getstring.c dwarf_offabbrev.c \
     77 		  dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \
     78 		  dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \
     79 		  dwarf_getmacros.c dwarf_macro_opcode.c dwarf_macro_param1.c \
     80 		  dwarf_macro_param2.c dwarf_addrdie.c \
     81 		  dwarf_getfuncs.c  \
     82 		  dwarf_decl_file.c dwarf_decl_line.c dwarf_decl_column.c \
     83 		  dwarf_func_inline.c dwarf_getsrc_file.c \
     84 		  libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \
     85 		  libdw_visit_scopes.c \
     86 		  dwarf_entry_breakpoints.c
     87 
     88 if !MUDFLAP
     89 libdw_pic_a_SOURCES =
     90 am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
     91 
     92 libdw_so_SOURCES =
     93 libdw.so: $(srcdir)/libdw.map libdw_pic.a \
     94 	  ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
     95 	  ../libelf/libelf.so
     96 # The rpath is necessary for libebl because its $ORIGIN use will
     97 # not fly in a setuid executable that links in libdw.
     98 	$(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
     99 		-Wl,--enable-new-dtags,-rpath,$(pkglibdir) \
    100 		-Wl,--version-script,$<,--no-undefined \
    101 		-Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
    102 		-ldl
    103 	if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
    104 	ln -fs $@ $@.$(VERSION)
    105 
    106 %.os: %.c %.o
    107 	if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
    108 	   -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
    109 	then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
    110 	     rm -f "$(DEPDIR)/$*.Tpo"; \
    111 	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
    112 	fi
    113 
    114 install: install-am libdw.so
    115 	$(mkinstalldirs) $(DESTDIR)$(libdir)
    116 	$(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
    117 	ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
    118 	ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
    119 
    120 uninstall: uninstall-am
    121 	rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
    122 	rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
    123 	rm -f $(DESTDIR)$(libdir)/libdw.so
    124 	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
    125 endif
    126 
    127 libdw_a_LIBADD = $(addprefix ../libdwfl/,$(shell $(AR) t ../libdwfl/libdwfl.a))
    128 
    129 noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h
    130 
    131 EXTRA_DIST = libdw.map
    132 
    133 CLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda libdw.so.$(VERSION)
    134