1## Process this file with automake to create Makefile.in
2##
3## Copyright (C) 1996-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##
27DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
28if MUDFLAP
29AM_CFLAGS = -fmudflap
30else
31AM_CFLAGS =
32endif
33if BUILD_STATIC
34AM_CFLAGS += -fpic
35endif
36AM_CFLAGS += -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 -std=gnu99 \
37	     $($(*F)_CFLAGS)
38INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I..
39GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
40VERSION = 1
41PACKAGE_VERSION = @PACKAGE_VERSION@
42
43COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
44						       $(COMPILE)))
45
46lib_LIBRARIES = libelf.a
47if !MUDFLAP
48noinst_LIBRARIES = libelf_pic.a
49noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
50endif
51include_HEADERS = libelf.h gelf.h nlist.h
52
53pkginclude_HEADERS = elf-knowledge.h
54
55libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
56		   elf_begin.c elf_next.c elf_rand.c elf_end.c elf_kind.c \
57		   gelf_getclass.c elf_getbase.c elf_getident.c \
58		   elf32_fsize.c elf64_fsize.c gelf_fsize.c \
59		   elf32_xlatetof.c elf32_xlatetom.c elf64_xlatetof.c \
60		   elf64_xlatetom.c gelf_xlate.c \
61		   elf32_getehdr.c elf64_getehdr.c gelf_getehdr.c \
62		   elf32_newehdr.c elf64_newehdr.c gelf_newehdr.c \
63		   gelf_update_ehdr.c \
64		   elf32_getphdr.c elf64_getphdr.c gelf_getphdr.c \
65		   elf32_newphdr.c elf64_newphdr.c gelf_newphdr.c \
66		   gelf_update_phdr.c \
67		   elf_getarhdr.c elf_getarsym.c \
68		   elf_rawfile.c elf_readall.c elf_cntl.c \
69		   elf_getscn.c elf_nextscn.c elf_ndxscn.c elf_newscn.c \
70		   elf32_getshdr.c elf64_getshdr.c gelf_getshdr.c \
71		   gelf_update_shdr.c \
72		   elf_strptr.c elf_rawdata.c elf_getdata.c elf_newdata.c \
73		   elf_getdata_rawchunk.c \
74		   elf_flagelf.c elf_flagehdr.c elf_flagphdr.c elf_flagscn.c \
75		   elf_flagshdr.c elf_flagdata.c elf_memory.c \
76		   elf_update.c elf32_updatenull.c elf64_updatenull.c \
77		   elf32_updatefile.c elf64_updatefile.c \
78		   gelf_getsym.c gelf_update_sym.c \
79		   gelf_getversym.c gelf_getverneed.c gelf_getvernaux.c \
80		   gelf_getverdef.c gelf_getverdaux.c \
81		   gelf_getrel.c gelf_getrela.c \
82		   gelf_update_rel.c gelf_update_rela.c \
83		   gelf_getdyn.c gelf_update_dyn.c \
84		   gelf_getmove.c gelf_update_move.c \
85		   gelf_getsyminfo.c gelf_update_syminfo.c \
86		   gelf_getauxv.c gelf_update_auxv.c \
87		   gelf_getnote.c \
88		   gelf_xlatetof.c gelf_xlatetom.c \
89		   nlist.c \
90		   gelf_getsymshndx.c gelf_update_symshndx.c \
91		   gelf_update_versym.c gelf_update_verneed.c \
92		   gelf_update_vernaux.c gelf_update_verdef.c \
93		   gelf_update_verdaux.c \
94		   elf_getshnum.c elf_getshstrndx.c \
95		   gelf_checksum.c elf32_checksum.c elf64_checksum.c \
96		   libelf_crc32.c libelf_next_prime.c \
97		   elf_clone.c \
98		   gelf_getlib.c gelf_update_lib.c \
99		   elf32_offscn.c elf64_offscn.c gelf_offscn.c \
100		   elf_getaroff.c \
101		   elf_gnu_hash.c \
102		   elf_scnshndx.c
103
104if !MUDFLAP
105libelf_pic_a_SOURCES =
106am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
107
108libelf_so_LDLIBS =
109if USE_TLS
110libelf_so_LDLIBS += -lpthread
111endif
112
113libelf_so_SOURCES =
114libelf.so: libelf_pic.a libelf.map
115	$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
116		-Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
117		-Wl,--soname,$@.$(VERSION),-z,-defs,-z,relro $(libelf_so_LDLIBS)
118	if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
119	ln -fs $@ $@.$(VERSION)
120
121%.os: %.c %.o
122	if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
123	  -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
124	then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
125	     rm -f "$(DEPDIR)/$*.Tpo"; \
126	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
127	fi
128
129install: install-am libelf.so
130	$(mkinstalldirs) $(DESTDIR)$(libdir)
131	$(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
132	ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
133	ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
134
135uninstall: uninstall-am
136	rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
137	rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
138	rm -f $(DESTDIR)$(libdir)/libelf.so
139endif
140
141noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
142		 version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h
143EXTRA_DIST = libelf.map
144
145CLEANFILES = $(am_libelf_pic_a_OBJECTS) *.gcno *.gcda libelf.so.$(VERSION)
146