52de7a3b5e0e077d17d2c13c998f40dafc3be610
[platform/upstream/elfutils.git] / libasm / Makefile.am
1 ## Process this file with automake to create Makefile.in
2 ##
3 ## Copyright (C) 2002-2010 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 ##
27 include $(top_srcdir)/config/eu.am
28 INCLUDES += -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl -I$(top_srcdir)/libdw
29
30 GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
31 VERSION = 1
32
33 lib_LIBRARIES = libasm.a
34 if !MUDFLAP
35 noinst_LIBRARIES = libasm_pic.a
36 noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
37 endif
38 pkginclude_HEADERS = libasm.h
39
40 libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
41                    asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \
42                    asm_newsubscn.c asm_newsym.c asm_newcomsym.c \
43                    asm_newabssym.c \
44                    asm_newscngrp.c asm_scngrp_newsignature.c \
45                    asm_fill.c asm_align.c asm_addstrz.c \
46                    asm_addint8.c asm_adduint8.c \
47                    asm_addint16.c asm_adduint16.c \
48                    asm_addint32.c asm_adduint32.c \
49                    asm_addint64.c asm_adduint64.c \
50                    asm_adduleb128.c asm_addsleb128.c \
51                    disasm_begin.c disasm_cb.c disasm_end.c disasm_str.c \
52                    symbolhash.c
53
54 if !MUDFLAP
55 libasm_pic_a_SOURCES =
56 am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
57
58 libasm_so_LDLIBS =
59 if USE_LOCKS
60 libasm_so_LDLIBS += -lpthread
61 endif
62
63 libasm_so_SOURCES =
64 libasm.so: libasm_pic.a libasm.map
65         $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
66                 -Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \
67                 -Wl,--soname,$@.$(VERSION) \
68                 ../libebl/libebl.a ../libelf/libelf.so  $(libasm_so_LDLIBS)
69         if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
70         ln -fs $@ $@.$(VERSION)
71
72 install: install-am libasm.so
73         $(mkinstalldirs) $(DESTDIR)$(libdir)
74         $(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
75         ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
76         ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so
77
78 uninstall: uninstall-am
79         rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
80         rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
81         rm -f $(DESTDIR)$(libdir)/libasm.so
82         rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
83 endif
84
85 noinst_HEADERS = libasmP.h symbolhash.h
86 EXTRA_DIST = libasm.map
87
88 CLEANFILES += $(am_libasm_pic_a_OBJECTS) libasm.so.$(VERSION)