1## Process this file with automake to create Makefile.in
2##
3## Copyright (C) 2002, 2004, 2005, 2006, 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
33AM_CFLAGS += -std=gnu99 -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2
34INCLUDES = -I. -I$(srcdir) -I.. \
35	   -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl -I$(top_srcdir)/libdw\
36	   -I$(top_srcdir)/lib
37GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
38VERSION = 1
39
40COMPILE.os = $(filter-out -fprofile-arcs, $(filter-out -ftest-coverage, \
41						       $(COMPILE)))
42
43lib_LIBRARIES = libasm.a
44if !MUDFLAP
45noinst_LIBRARIES = libasm_pic.a
46noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
47endif
48pkginclude_HEADERS = libasm.h
49
50libasm_a_SOURCES = asm_begin.c asm_abort.c asm_end.c asm_error.c \
51		   asm_getelf.c asm_newscn.c asm_newscn_ingrp.c \
52		   asm_newsubscn.c asm_newsym.c asm_newcomsym.c \
53		   asm_newabssym.c \
54		   asm_newscngrp.c asm_scngrp_newsignature.c \
55		   asm_fill.c asm_align.c asm_addstrz.c \
56		   asm_addint8.c asm_adduint8.c \
57		   asm_addint16.c asm_adduint16.c \
58		   asm_addint32.c asm_adduint32.c \
59		   asm_addint64.c asm_adduint64.c \
60		   asm_adduleb128.c asm_addsleb128.c \
61		   disasm_begin.c disasm_cb.c disasm_end.c disasm_str.c \
62		   symbolhash.c
63
64if !MUDFLAP
65libasm_pic_a_SOURCES =
66am_libasm_pic_a_OBJECTS = $(libasm_a_SOURCES:.c=.os)
67
68libasm_so_LDLIBS =
69if USE_TLS
70libasm_so_LDLIBS += -lpthread
71endif
72
73libasm_so_SOURCES =
74libasm.so: libasm_pic.a libasm.map
75	$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
76		-Wl,--version-script,$(srcdir)/libasm.map,--no-undefined \
77		-Wl,--soname,$@.$(VERSION) \
78		../libebl/libebl.a ../libelf/libelf.so  $(libasm_so_LDLIBS)
79	if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
80	ln -fs $@ $@.$(VERSION)
81
82
83%.os: %.c %.o
84	if $(COMPILE.os) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
85	  -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
86	then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
87	     rm -f "$(DEPDIR)/$*.Tpo"; \
88	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
89	fi
90
91install: install-am libasm.so
92	$(mkinstalldirs) $(DESTDIR)$(libdir)
93	$(INSTALL_PROGRAM) libasm.so $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
94	ln -fs libasm-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
95	ln -fs libasm.so.$(VERSION) $(DESTDIR)$(libdir)/libasm.so
96
97uninstall: uninstall-am
98	rm -f $(DESTDIR)$(libdir)/libasm-$(PACKAGE_VERSION).so
99	rm -f $(DESTDIR)$(libdir)/libasm.so.$(VERSION)
100	rm -f $(DESTDIR)$(libdir)/libasm.so
101	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
102endif
103
104noinst_HEADERS = libasmP.h symbolhash.h
105EXTRA_DIST = libasm.map
106
107CLEANFILES = $(am_libasm_pic_a_OBJECTS) *.gcno *.gcda libasm.so.$(VERSION)
108