2005-09-09 Roland McGrath <roland@redhat.com>
[platform/upstream/elfutils.git] / libdw / Makefile.am
1 ## Process this file with automake to create Makefile.in
2 ##
3 ## Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc.
4 ##
5 ## This program is Open Source software; you can redistribute it and/or
6 ## modify it under the terms of the Open Software License version 1.0 as
7 ## published by the Open Source Initiative.
8 ##
9 ## You should have received a copy of the Open Software License along
10 ## with this program; if not, you may obtain a copy of the Open Software
11 ## License version 1.0 from http://www.opensource.org/licenses/osl.php or
12 ## by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
13 ## 3001 King Ranch Road, Ukiah, CA 95482.
14 ##
15 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DIS_LIBDW
16 if MUDFLAP
17 AM_CFLAGS = -fmudflap
18 else
19 AM_CFLAGS =
20 endif
21 AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99
22 INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
23 VERSION = 1
24
25 COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
26                                                        $(COMPILE)))
27
28 lib_LIBRARIES = libdw.a
29 if !MUDFLAP
30 noinst_LIBRARIES = libdw_pic.a
31 noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
32 endif
33
34 include_HEADERS = dwarf.h
35 euincludedir = ${includedir}/elfutils
36 euinclude_HEADERS = libdw.h
37
38 libdw_a_SOURCES = dwarf_begin.c dwarf_begin_elf.c dwarf_end.c dwarf_getelf.c \
39                   dwarf_getpubnames.c dwarf_getabbrev.c dwarf_tag.c \
40                   dwarf_error.c dwarf_nextcu.c dwarf_diename.c dwarf_offdie.c \
41                   dwarf_attr.c dwarf_formstring.c dwarf_abbrev_hash.c \
42                   dwarf_attr_integrate.c dwarf_hasattr_integrate.c \
43                   dwarf_child.c dwarf_haschildren.c dwarf_formaddr.c \
44                   dwarf_formudata.c dwarf_formsdata.c dwarf_lowpc.c \
45                   dwarf_entrypc.c dwarf_haspc.c dwarf_highpc.c \
46                   dwarf_formref.c dwarf_formref_die.c dwarf_siblingof.c \
47                   dwarf_dieoffset.c dwarf_cuoffset.c dwarf_hasattr.c \
48                   dwarf_hasform.c dwarf_whatform.c dwarf_whatattr.c \
49                   dwarf_bytesize.c dwarf_arrayorder.c dwarf_bitsize.c \
50                   dwarf_bitoffset.c dwarf_srclang.c dwarf_getabbrevtag.c \
51                   dwarf_getabbrevcode.c dwarf_abbrevhaschildren.c \
52                   dwarf_getattrcnt.c dwarf_getabbrevattr.c \
53                   dwarf_getsrclines.c dwarf_getsrc_die.c \
54                   dwarf_getscopes.c dwarf_getscopes_die.c dwarf_getscopevar.c \
55                   dwarf_linesrc.c dwarf_lineno.c dwarf_lineaddr.c \
56                   dwarf_linecol.c dwarf_linebeginstatement.c \
57                   dwarf_lineendsequence.c dwarf_lineblock.c \
58                   dwarf_lineprologueend.c dwarf_lineepiloguebegin.c \
59                   dwarf_onesrcline.c dwarf_formblock.c \
60                   dwarf_getsrcfiles.c dwarf_filesrc.c \
61                   dwarf_getloclist.c dwarf_getstring.c dwarf_offabbrev.c \
62                   dwarf_getaranges.c dwarf_onearange.c dwarf_getarangeinfo.c \
63                   dwarf_getarange_addr.c dwarf_getattrs.c dwarf_formflag.c \
64                   dwarf_getmacros.c dwarf_macro_opcode.c dwarf_macro_param1.c \
65                   dwarf_macro_param2.c dwarf_addrdie.c \
66                   dwarf_getfuncs.c dwarf_func_name.c dwarf_func_lowpc.c \
67                   dwarf_func_highpc.c dwarf_func_entrypc.c dwarf_func_file.c \
68                   dwarf_func_line.c dwarf_func_col.c dwarf_func_die.c \
69                   dwarf_func_inline.c dwarf_getsrc_file.c \
70                   libdw_findcu.c libdw_form.c libdw_alloc.c memory-access.c \
71                   libdw_visit_scopes.c \
72                   dwarf_entry_breakpoints.c
73
74 if !MUDFLAP
75 libdw_pic_a_SOURCES =
76 am_libdw_pic_a_OBJECTS = $(libdw_a_SOURCES:.c=.os)
77
78 libdw_so_SOURCES =
79 libdw.so: $(srcdir)/libdw.map libdw_pic.a \
80           ../libdwfl/libdwfl_pic.a ../libebl/libebl.a \
81           ../libelf/libelf.so
82         $(LINK) -shared -o $@ -Wl,--soname,$@.$(VERSION),-z,defs \
83                 -Wl,--version-script,$<,--no-undefined \
84                 -Wl,--whole-archive $(filter-out $<,$^) -Wl,--no-whole-archive\
85                 -ldl
86         if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
87         ln -fs $@ $@.$(VERSION)
88
89 %.os: %.c %.o
90         if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
91            -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
92         then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
93              rm -f "$(DEPDIR)/$*.Tpo"; \
94         else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
95         fi
96
97 install: install-am libdw.so
98         $(mkinstalldirs) $(DESTDIR)$(libdir)
99         $(INSTALL_PROGRAM) libdw.so $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
100         ln -fs libdw-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
101         ln -fs libdw.so.$(VERSION) $(DESTDIR)$(libdir)/libdw.so
102
103 uninstall: uninstall-am
104         rm -f $(DESTDIR)$(libdir)/libdw-$(PACKAGE_VERSION).so
105         rm -f $(DESTDIR)$(libdir)/libdw.so.$(VERSION)
106         rm -f $(DESTDIR)$(libdir)/libdw.so
107         rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
108 endif
109
110 libdw_a_LIBADD = $(addprefix ../libdwfl/,$(shell $(AR) t ../libdwfl/libdwfl.a))
111
112 noinst_HEADERS = libdwP.h memory-access.h dwarf_abbrev_hash.h
113
114 EXTRA_DIST = libdw.map
115
116 CLEANFILES = $(am_libdw_pic_a_OBJECTS) *.gcno *.gcda