1## Process this file with automake to create Makefile.in
2##
3## Copyright (C) 2000-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 -DOBJDIR=\"$(shell pwd)\"
28if MUDFLAP
29AM_CFLAGS = -fmudflap
30else
31AM_CFLAGS =
32endif
33AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \
34	     -std=gnu99
35INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
36	   -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \
37	   -I$(top_srcdir)/lib -I..
38
39
40modules = i386 sh x86_64 ia64 alpha arm sparc ppc ppc64 s390
41libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a \
42	     libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a \
43	     libebl_sparc_pic.a libebl_ppc_pic.a libebl_ppc64_pic.a \
44	     libebl_s390_pic.a
45noinst_LIBRARIES = $(libebl_pic)
46noinst_DATA = $(libebl_pic:_pic.a=.so)
47
48
49if MUDFLAP
50libelf = ../libelf/libelf.a
51libdw = ../libdw/libdw.a
52libmudflap = -lmudflap
53else
54libelf = ../libelf/libelf.so
55libdw = ../libdw/libdw.so
56libmudflap =
57endif
58
59
60textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
61
62
63i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c \
64	    i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c
65cpu_i386 = ../libcpu/libcpu_i386.a
66libebl_i386_pic_a_SOURCES = $(i386_SRCS)
67am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os)
68
69sh_SRCS = sh_init.c sh_symbol.c
70libebl_sh_pic_a_SOURCES = $(sh_SRCS)
71am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os)
72
73x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c \
74	      x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c
75cpu_x86_64 = ../libcpu/libcpu_x86_64.a
76libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS)
77am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
78
79ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c
80libebl_ia64_pic_a_SOURCES = $(ia64_SRCS)
81am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
82
83alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \
84	     alpha_corenote.c alpha_auxv.c
85libebl_alpha_pic_a_SOURCES = $(alpha_SRCS)
86am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
87
88arm_SRCS = arm_init.c arm_symbol.c
89libebl_arm_pic_a_SOURCES = $(arm_SRCS)
90am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
91
92sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \
93	     sparc_corenote.c sparc64_corenote.c sparc_auxv.c
94libebl_sparc_pic_a_SOURCES = $(sparc_SRCS)
95am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os)
96
97ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \
98	   ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c
99libebl_ppc_pic_a_SOURCES = $(ppc_SRCS)
100am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os)
101
102ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \
103	     ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c
104libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS)
105am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
106
107s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c
108libebl_s390_pic_a_SOURCES = $(s390_SRCS)
109am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os)
110
111
112libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw) \
113	     $(cpu_$(@:libebl_%.so=%)
114	$(LINK) -shared -o $@ -Wl,--whole-archive,$<\
115		$(cpu_$(@:libebl_%.so=%)) -Wl,--no-whole-archive \
116		-Wl,--version-script,$(word 2,$^) \
117		-Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
118	$(textrel_check)
119
120# XXX Should not be needed...
121libebl_i386.so: $(cpu_i386)
122libebl_x86_64.so: $(cpu_x86_64)
123
124libebl_%.map: Makefile
125	echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $@
126
127%.os: %.c
128	if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
129	  -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
130	then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
131	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
132	fi
133
134install: install-am install-ebl-modules
135install-ebl-modules:
136	$(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
137	for m in $(modules); do \
138	  $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
139	  ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
140	done
141
142uninstall: uninstall-am
143	for m in $(modules); do \
144	  rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
145	  rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
146	done
147	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
148
149noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
150EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def)
151
152CLEANFILES = *.gcno *.gcda \
153	     $(foreach m,$(modules),\
154		       libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS))
155