Imported Upstream version 0.155
[platform/upstream/elfutils.git] / libelf / Makefile.am
1 ## Process this file with automake to create Makefile.in
2 ##
3 ## Copyright (C) 1996-2010 Red Hat, Inc.
4 ## This file is part of elfutils.
5 ##
6 ## This file is free software; you can redistribute it and/or modify
7 ## it under the terms of either
8 ##
9 ##   * the GNU Lesser General Public License as published by the Free
10 ##     Software Foundation; either version 3 of the License, or (at
11 ##     your option) any later version
12 ##
13 ## or
14 ##
15 ##   * the GNU General Public License as published by the Free
16 ##     Software Foundation; either version 2 of the License, or (at
17 ##     your option) any later version
18 ##
19 ## or both in parallel, as here.
20 ##
21 ## elfutils is distributed in the hope that it will be useful, but
22 ## WITHOUT ANY WARRANTY; without even the implied warranty of
23 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
24 ## General Public License for more details.
25 ##
26 ## You should have received copies of the GNU General Public License and
27 ## the GNU Lesser General Public License along with this program.  If
28 ## not, see <http://www.gnu.org/licenses/>.
29 ##
30 include $(top_srcdir)/config/eu.am
31 if BUILD_STATIC
32 AM_CFLAGS += -fpic
33 endif
34 GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
35 VERSION = 1
36
37 lib_LIBRARIES = libelf.a
38 if !MUDFLAP
39 noinst_LIBRARIES = libelf_pic.a
40 noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
41 endif
42 include_HEADERS = libelf.h gelf.h nlist.h
43
44 pkginclude_HEADERS = elf-knowledge.h
45
46 libelf_a_SOURCES = elf_version.c elf_hash.c elf_error.c elf_fill.c \
47                    elf_begin.c elf_next.c elf_rand.c elf_end.c elf_kind.c \
48                    gelf_getclass.c elf_getbase.c elf_getident.c \
49                    elf32_fsize.c elf64_fsize.c gelf_fsize.c \
50                    elf32_xlatetof.c elf32_xlatetom.c elf64_xlatetof.c \
51                    elf64_xlatetom.c gelf_xlate.c \
52                    elf32_getehdr.c elf64_getehdr.c gelf_getehdr.c \
53                    elf32_newehdr.c elf64_newehdr.c gelf_newehdr.c \
54                    gelf_update_ehdr.c \
55                    elf32_getphdr.c elf64_getphdr.c gelf_getphdr.c \
56                    elf32_newphdr.c elf64_newphdr.c gelf_newphdr.c \
57                    gelf_update_phdr.c \
58                    elf_getarhdr.c elf_getarsym.c \
59                    elf_rawfile.c elf_readall.c elf_cntl.c \
60                    elf_getscn.c elf_nextscn.c elf_ndxscn.c elf_newscn.c \
61                    elf32_getshdr.c elf64_getshdr.c gelf_getshdr.c \
62                    gelf_update_shdr.c \
63                    elf_strptr.c elf_rawdata.c elf_getdata.c elf_newdata.c \
64                    elf_getdata_rawchunk.c \
65                    elf_flagelf.c elf_flagehdr.c elf_flagphdr.c elf_flagscn.c \
66                    elf_flagshdr.c elf_flagdata.c elf_memory.c \
67                    elf_update.c elf32_updatenull.c elf64_updatenull.c \
68                    elf32_updatefile.c elf64_updatefile.c \
69                    gelf_getsym.c gelf_update_sym.c \
70                    gelf_getversym.c gelf_getverneed.c gelf_getvernaux.c \
71                    gelf_getverdef.c gelf_getverdaux.c \
72                    gelf_getrel.c gelf_getrela.c \
73                    gelf_update_rel.c gelf_update_rela.c \
74                    gelf_getdyn.c gelf_update_dyn.c \
75                    gelf_getmove.c gelf_update_move.c \
76                    gelf_getsyminfo.c gelf_update_syminfo.c \
77                    gelf_getauxv.c gelf_update_auxv.c \
78                    gelf_getnote.c \
79                    gelf_xlatetof.c gelf_xlatetom.c \
80                    nlist.c \
81                    gelf_getsymshndx.c gelf_update_symshndx.c \
82                    gelf_update_versym.c gelf_update_verneed.c \
83                    gelf_update_vernaux.c gelf_update_verdef.c \
84                    gelf_update_verdaux.c \
85                    elf_getphdrnum.c elf_getshdrnum.c elf_getshdrstrndx.c \
86                    gelf_checksum.c elf32_checksum.c elf64_checksum.c \
87                    libelf_crc32.c libelf_next_prime.c \
88                    elf_clone.c \
89                    gelf_getlib.c gelf_update_lib.c \
90                    elf32_offscn.c elf64_offscn.c gelf_offscn.c \
91                    elf_getaroff.c \
92                    elf_gnu_hash.c \
93                    elf_scnshndx.c
94
95 if !MUDFLAP
96 libelf_pic_a_SOURCES =
97 am_libelf_pic_a_OBJECTS = $(libelf_a_SOURCES:.c=.os)
98
99 libelf_so_LDLIBS =
100 if USE_LOCKS
101 libelf_so_LDLIBS += -lpthread
102 endif
103
104 libelf_so_SOURCES =
105 libelf.so: libelf_pic.a libelf.map
106         $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
107                 -Wl,--version-script,$(srcdir)/libelf.map,--no-undefined \
108                 -Wl,--soname,$@.$(VERSION),-z,defs,-z,relro $(libelf_so_LDLIBS)
109         if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
110         ln -fs $@ $@.$(VERSION)
111
112 install: install-am libelf.so
113         $(mkinstalldirs) $(DESTDIR)$(libdir)
114         $(INSTALL_PROGRAM) libelf.so $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
115         ln -fs libelf-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
116         ln -fs libelf.so.$(VERSION) $(DESTDIR)$(libdir)/libelf.so
117
118 uninstall: uninstall-am
119         rm -f $(DESTDIR)$(libdir)/libelf-$(PACKAGE_VERSION).so
120         rm -f $(DESTDIR)$(libdir)/libelf.so.$(VERSION)
121         rm -f $(DESTDIR)$(libdir)/libelf.so
122 endif
123
124 noinst_HEADERS = elf.h abstract.h common.h exttypes.h gelf_xlate.h libelfP.h \
125                  version_xlate.h gnuhash_xlate.h note_xlate.h dl-hash.h
126 EXTRA_DIST = libelf.map
127
128 CLEANFILES += $(am_libelf_pic_a_OBJECTS) libelf.so.$(VERSION)