blob: de4507f21d9055fe7133b2c5162700c77b46e831 [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001## Makefile.am for libdwfl library subdirectory in elfutils.
2##
3## Process this file with automake to create Makefile.in
4##
5## Copyright (C) 2005 Red Hat, Inc.
6##
7## This program is Open Source software; you can redistribute it and/or
8## modify it under the terms of the Open Software License version 1.0 as
9## published by the Open Source Initiative.
10##
11## You should have received a copy of the Open Software License along
12## with this program; if not, you may obtain a copy of the Open Software
13## License version 1.0 from http://www.opensource.org/licenses/osl.php or
14## by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
15## 3001 King Ranch Road, Ukiah, CA 95482.
16##
17DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
18if MUDFLAP
19AM_CFLAGS = -fmudflap
20else
21AM_CFLAGS =
22endif
23AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99
24INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
25 -I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib
26VERSION = 1
27
28noinst_PROGRAMS = ptest test2
29
30test2_SOURCES = test2.c loc2c.c
31
32lib_LIBRARIES = libdwfl.a
33if !MUDFLAP
34noinst_LIBRARIES = libdwfl_pic.a
35noinst_PROGRAMS += $(noinst_LIBRARIES:_pic.a=.so)
36endif
37
38euincludedir = ${includedir}/elfutils
39euinclude_HEADERS = libdwfl.h
40
41libdwfl_a_SOURCES = dwfl_begin.c dwfl_end.c dwfl_error.c \
42 dwfl_module.c dwfl_report_elf.c relocate.c \
43 dwfl_module_info.c dwfl_getmodules.c \
44 dwfl_module_getdwarf.c dwfl_getdwarf.c \
45 argp-std.c find-debuginfo.c \
46 linux-kernel-modules.c linux-proc-maps.c \
47 dwfl_addrmodule.c dwfl_addrdwarf.c \
48 cu.c dwfl_module_nextcu.c dwfl_nextcu.c dwfl_cumodule.c \
49 dwfl_module_addrdie.c dwfl_addrdie.c \
50 lines.c dwfl_lineinfo.c dwfl_linemodule.c \
51 dwfl_module_getsrc.c dwfl_getsrc.c \
52 dwfl_module_getsrc_file.c \
53 elf-from-memory.c
54
55
56if MUDFLAP
57libdwfl = libdwfl.a $(libdw) $(libebl) $(libelf) $(libeu)
58libdw = ../libdw/libdw.a
59libelf = ../libelf/libelf.a
60libmudflap = -lmudflap
61else
62libdwfl = libdwfl.so
63libdw = ../libdw/libdw.so
64libelf = ../libelf/libelf.so
65endif
66libebl = ../libebl/libebl.a
67libeu = ../lib/libeu.a
68
69
70if !MUDFLAP
71libdwfl_pic_a_SOURCES =
72am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os)
73
74libdwfl_so_SOURCES =
75libdwfl_LIBS = $(libeu) $(libdw) $(libebl) $(libelf)
76libdwfl_so_LDADD = -ldl
77libdwfl.so: libdwfl_pic.a $(srcdir)/libdwfl.map $(libdwfl_LIBS)
78 $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
79 -Wl,--version-script,$(srcdir)/libdwfl.map,--no-undefined \
80 -Wl,--soname,$@.$(VERSION),-z,defs \
81 $(libdwfl_LIBS) $(libdwfl_so_LDADD)
82 if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
83 ln -fs $@ $@.$(VERSION)
84
85
86%.os: %.c %.o
87 if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
88 -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
89 then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
90 rm -f "$(DEPDIR)/$*.Tpo"; \
91 else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
92 fi
93
94install: install-am libdwfl.so
95 $(mkinstalldirs) $(DESTDIR)$(libdir)
96 $(INSTALL_PROGRAM) libdwfl.so $(DESTDIR)$(libdir)/libdwfl-$(PACKAGE_VERSION).so
97 ln -fs libdwfl-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libdwfl.so.$(VERSION)
98 ln -fs libdwfl.so.$(VERSION) $(DESTDIR)$(libdir)/libdwfl.so
99
100uninstall: uninstall-am
101 rm -f $(DESTDIR)$(libdir)/libdwfl-$(PACKAGE_VERSION).so
102 rm -f $(DESTDIR)$(libdir)/libdwfl.so.$(VERSION)
103 rm -f $(DESTDIR)$(libdir)/libdwfl.so
104 rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
105endif
106
107noinst_HEADERS = libdwflP.h loc2c.h
108
109EXTRA_DIST = libdwfl.map
110
111CLEANFILES = $(am_libdwfl_pic_a_OBJECTS)
112
113ptest_LDADD = $(libdwfl) $(libdw) $(libmudflap)
114test2_LDADD = $(libdwfl) $(libdw) $(libmudflap)