Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame^] | 1 | ## 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 | ## |
| 17 | DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H |
| 18 | if MUDFLAP |
| 19 | AM_CFLAGS = -fmudflap |
| 20 | else |
| 21 | AM_CFLAGS = |
| 22 | endif |
| 23 | AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99 |
| 24 | INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ |
| 25 | -I$(srcdir)/../libdw -I.. -I$(srcdir)/../lib |
| 26 | VERSION = 1 |
| 27 | |
| 28 | noinst_PROGRAMS = ptest test2 |
| 29 | |
| 30 | test2_SOURCES = test2.c loc2c.c |
| 31 | |
| 32 | lib_LIBRARIES = libdwfl.a |
| 33 | if !MUDFLAP |
| 34 | noinst_LIBRARIES = libdwfl_pic.a |
| 35 | noinst_PROGRAMS += $(noinst_LIBRARIES:_pic.a=.so) |
| 36 | endif |
| 37 | |
| 38 | euincludedir = ${includedir}/elfutils |
| 39 | euinclude_HEADERS = libdwfl.h |
| 40 | |
| 41 | libdwfl_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 | |
| 56 | if MUDFLAP |
| 57 | libdwfl = libdwfl.a $(libdw) $(libebl) $(libelf) $(libeu) |
| 58 | libdw = ../libdw/libdw.a |
| 59 | libelf = ../libelf/libelf.a |
| 60 | libmudflap = -lmudflap |
| 61 | else |
| 62 | libdwfl = libdwfl.so |
| 63 | libdw = ../libdw/libdw.so |
| 64 | libelf = ../libelf/libelf.so |
| 65 | endif |
| 66 | libebl = ../libebl/libebl.a |
| 67 | libeu = ../lib/libeu.a |
| 68 | |
| 69 | |
| 70 | if !MUDFLAP |
| 71 | libdwfl_pic_a_SOURCES = |
| 72 | am_libdwfl_pic_a_OBJECTS = $(libdwfl_a_SOURCES:.c=.os) |
| 73 | |
| 74 | libdwfl_so_SOURCES = |
| 75 | libdwfl_LIBS = $(libeu) $(libdw) $(libebl) $(libelf) |
| 76 | libdwfl_so_LDADD = -ldl |
| 77 | libdwfl.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 | |
| 94 | install: 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 | |
| 100 | uninstall: 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 |
| 105 | endif |
| 106 | |
| 107 | noinst_HEADERS = libdwflP.h loc2c.h |
| 108 | |
| 109 | EXTRA_DIST = libdwfl.map |
| 110 | |
| 111 | CLEANFILES = $(am_libdwfl_pic_a_OBJECTS) |
| 112 | |
| 113 | ptest_LDADD = $(libdwfl) $(libdw) $(libmudflap) |
| 114 | test2_LDADD = $(libdwfl) $(libdw) $(libmudflap) |