blob: 6d7eb667c8aee4fc8d9ac6fcf056942f0fc025d5 [file] [log] [blame]
Roland McGrathe47ab762005-11-17 03:16:00 +00001## Process this file with automake to create Makefile.in
2##
Roland McGratheb9ba472009-04-14 18:44:45 -07003## Copyright (C) 2000-2009 Red Hat, Inc.
Ulrich Drepper361df7d2006-04-04 21:38:57 +00004## This file is part of Red Hat elfutils.
Roland McGrathe47ab762005-11-17 03:16:00 +00005##
Ulrich Drepper361df7d2006-04-04 21:38:57 +00006## 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.
Roland McGrathe47ab762005-11-17 03:16:00 +00009##
Ulrich Drepper361df7d2006-04-04 21:38:57 +000010## 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,
Ulrich Drepper1e9ef502006-04-04 22:29:06 +000017## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
Ulrich Drepper361df7d2006-04-04 21:38:57 +000018##
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>.
Roland McGrathe47ab762005-11-17 03:16:00 +000026##
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
Ulrich Drepper3cbdd382008-01-02 17:44:39 +000035INCLUDES = -I$(srcdir) -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
Roland McGrathe47ab762005-11-17 03:16:00 +000036 -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw \
37 -I$(top_srcdir)/lib -I..
Roland McGrathe47ab762005-11-17 03:16:00 +000038
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
Roland McGrathe47ab762005-11-17 03:16:00 +000062
Roland McGrath994b4892005-12-05 22:46:21 +000063i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c \
Roland McGrath1d8bb252008-08-07 08:39:41 +000064 i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c
Ulrich Drepper3cbdd382008-01-02 17:44:39 +000065cpu_i386 = ../libcpu/libcpu_i386.a
Roland McGrathe47ab762005-11-17 03:16:00 +000066libebl_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
Roland McGrath994b4892005-12-05 22:46:21 +000073x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c \
Roland McGrath1d8bb252008-08-07 08:39:41 +000074 x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c
Ulrich Drepperff993222008-01-09 05:39:28 +000075cpu_x86_64 = ../libcpu/libcpu_x86_64.a
Roland McGrathe47ab762005-11-17 03:16:00 +000076libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS)
77am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
78
Roland McGrath95024622006-07-21 10:06:31 +000079ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c
Roland McGrathe47ab762005-11-17 03:16:00 +000080libebl_ia64_pic_a_SOURCES = $(ia64_SRCS)
81am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
82
Roland McGrathcb6d8652007-08-23 08:10:54 +000083alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \
Roland McGrath059c83e2008-02-21 06:19:39 +000084 alpha_corenote.c alpha_auxv.c
Roland McGrathe47ab762005-11-17 03:16:00 +000085libebl_alpha_pic_a_SOURCES = $(alpha_SRCS)
86am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
87
Roland McGratheb9ba472009-04-14 18:44:45 -070088arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \
89 arm_auxv.c arm_attrs.c arm_retval.c
Roland McGrathe47ab762005-11-17 03:16:00 +000090libebl_arm_pic_a_SOURCES = $(arm_SRCS)
91am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
92
Ulrich Drepperb597dfa2007-10-16 05:21:27 +000093sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \
94 sparc_corenote.c sparc64_corenote.c sparc_auxv.c
Roland McGrathe47ab762005-11-17 03:16:00 +000095libebl_sparc_pic_a_SOURCES = $(sparc_SRCS)
96am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os)
97
Roland McGrathcb6d8652007-08-23 08:10:54 +000098ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \
Roland McGrath1d8bb252008-08-07 08:39:41 +000099 ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c
Roland McGrathe47ab762005-11-17 03:16:00 +0000100libebl_ppc_pic_a_SOURCES = $(ppc_SRCS)
101am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os)
102
Roland McGrathcb6d8652007-08-23 08:10:54 +0000103ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \
Roland McGrath1d8bb252008-08-07 08:39:41 +0000104 ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c
Roland McGrathe47ab762005-11-17 03:16:00 +0000105libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS)
106am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
107
Roland McGrath321327a2006-01-13 00:51:21 +0000108s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c
Roland McGrathe47ab762005-11-17 03:16:00 +0000109libebl_s390_pic_a_SOURCES = $(s390_SRCS)
110am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os)
111
112
Ulrich Drepper3cbdd382008-01-02 17:44:39 +0000113libebl_%.so: libebl_%_pic.a libebl_%.map $(libelf) $(libdw) \
114 $(cpu_$(@:libebl_%.so=%)
115 $(LINK) -shared -o $@ -Wl,--whole-archive,$<\
116 $(cpu_$(@:libebl_%.so=%)) -Wl,--no-whole-archive \
117 -Wl,--version-script,$(word 2,$^) \
118 -Wl,-z,defs -Wl,--as-needed $(libelf) $(libdw) $(libmudflap)
119 $(textrel_check)
120
121# XXX Should not be needed...
122libebl_i386.so: $(cpu_i386)
123libebl_x86_64.so: $(cpu_x86_64)
124
125libebl_%.map: Makefile
126 echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' > $@
127
Roland McGrathc812a832006-08-08 20:02:11 +0000128%.os: %.c
Roland McGrathe47ab762005-11-17 03:16:00 +0000129 if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
130 -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
Roland McGrathc812a832006-08-08 20:02:11 +0000131 then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
Roland McGrathe47ab762005-11-17 03:16:00 +0000132 else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
133 fi
134
135install: install-am install-ebl-modules
136install-ebl-modules:
137 $(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
138 for m in $(modules); do \
139 $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
140 ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
141 done
142
143uninstall: uninstall-am
144 for m in $(modules); do \
145 rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
146 rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
147 done
148 rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
Roland McGrathe47ab762005-11-17 03:16:00 +0000149
Roland McGratha845f682008-12-03 03:41:58 +0000150noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
Roland McGrathe47ab762005-11-17 03:16:00 +0000151EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def)
152
153CLEANFILES = *.gcno *.gcda \
Roland McGrath3dca43b2005-11-18 02:30:43 +0000154 $(foreach m,$(modules),\
155 libebl_$(m).so $(am_libebl_$(m)_pic_a_OBJECTS))