1## Process this file with automake to create Makefile.in
2##
3## Copyright (C) 2000-2010, 2013, 2014 Red Hat, Inc.
4## Copyright (C) 2012 Tilera Corporation
5## This file is part of elfutils.
6##
7## This file is free software; you can redistribute it and/or modify
8## it under the terms of either
9##
10##   * the GNU Lesser General Public License as published by the Free
11##     Software Foundation; either version 3 of the License, or (at
12##     your option) any later version
13##
14## or
15##
16##   * the GNU General Public License as published by the Free
17##     Software Foundation; either version 2 of the License, or (at
18##     your option) any later version
19##
20## or both in parallel, as here.
21##
22## elfutils is distributed in the hope that it will be useful, but
23## WITHOUT ANY WARRANTY; without even the implied warranty of
24## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25## General Public License for more details.
26##
27## You should have received copies of the GNU General Public License and
28## the GNU Lesser General Public License along with this program.  If
29## not, see <http://www.gnu.org/licenses/>.
30include $(top_srcdir)/config/eu.am
31AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
32	   -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
33
34
35modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
36	  tilegx m68k bpf riscv
37libebl_pic = libebl_i386_pic.a libebl_sh_pic.a libebl_x86_64_pic.a    \
38	     libebl_ia64_pic.a libebl_alpha_pic.a libebl_arm_pic.a    \
39	     libebl_aarch64_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
40	     libebl_ppc64_pic.a libebl_s390_pic.a libebl_tilegx_pic.a \
41	     libebl_m68k_pic.a libebl_bpf_pic.a libebl_riscv_pic.a
42noinst_LIBRARIES = $(libebl_pic)
43noinst_DATA = $(libebl_pic:_pic.a=.so)
44
45
46libelf = ../libelf/libelf.so
47libdw = ../libdw/libdw.so
48libeu = ../lib/libeu.a
49
50i386_SRCS = i386_init.c i386_symbol.c i386_corenote.c i386_cfi.c \
51	    i386_retval.c i386_regs.c i386_auxv.c i386_syscall.c \
52	    i386_initreg.c i386_unwind.c
53cpu_i386 = ../libcpu/libcpu_i386.a
54libebl_i386_pic_a_SOURCES = $(i386_SRCS)
55am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os)
56
57sh_SRCS = sh_init.c sh_symbol.c sh_corenote.c sh_regs.c sh_retval.c
58libebl_sh_pic_a_SOURCES = $(sh_SRCS)
59am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os)
60
61x86_64_SRCS = x86_64_init.c x86_64_symbol.c x86_64_corenote.c x86_64_cfi.c \
62	      x86_64_retval.c x86_64_regs.c i386_auxv.c x86_64_syscall.c \
63	      x86_64_initreg.c x86_64_unwind.c x32_corenote.c
64cpu_x86_64 = ../libcpu/libcpu_x86_64.a
65libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS)
66am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
67
68ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c
69libebl_ia64_pic_a_SOURCES = $(ia64_SRCS)
70am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
71
72alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \
73	     alpha_corenote.c alpha_auxv.c
74libebl_alpha_pic_a_SOURCES = $(alpha_SRCS)
75am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
76
77arm_SRCS = arm_init.c arm_symbol.c arm_regs.c arm_corenote.c \
78	   arm_auxv.c arm_attrs.c arm_retval.c arm_cfi.c arm_initreg.c
79libebl_arm_pic_a_SOURCES = $(arm_SRCS)
80am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
81
82aarch64_SRCS = aarch64_init.c aarch64_regs.c aarch64_symbol.c	\
83	       aarch64_corenote.c aarch64_retval.c aarch64_cfi.c \
84	       aarch64_initreg.c aarch64_unwind.c
85libebl_aarch64_pic_a_SOURCES = $(aarch64_SRCS)
86am_libebl_aarch64_pic_a_OBJECTS = $(aarch64_SRCS:.c=.os)
87
88sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c sparc_retval.c \
89	     sparc_corenote.c sparc64_corenote.c sparc_auxv.c sparc_attrs.c \
90             sparc_cfi.c sparc_initreg.c
91libebl_sparc_pic_a_SOURCES = $(sparc_SRCS)
92am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os)
93
94ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c \
95	   ppc_corenote.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \
96	   ppc_cfi.c ppc_initreg.c
97libebl_ppc_pic_a_SOURCES = $(ppc_SRCS)
98am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os)
99
100ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \
101	     ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \
102	     ppc_cfi.c ppc_initreg.c ppc64_unwind.c ppc64_resolve_sym.c
103libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS)
104am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
105
106s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c \
107	    s390_corenote.c s390x_corenote.c s390_cfi.c s390_initreg.c \
108	    s390_unwind.c
109libebl_s390_pic_a_SOURCES = $(s390_SRCS)
110am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os)
111
112tilegx_SRCS = tilegx_init.c tilegx_symbol.c tilegx_regs.c \
113              tilegx_retval.c tilegx_corenote.c
114libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS)
115am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os)
116
117m68k_SRCS = m68k_init.c m68k_symbol.c m68k_regs.c \
118	    m68k_retval.c m68k_corenote.c m68k_cfi.c m68k_initreg.c
119libebl_m68k_pic_a_SOURCES = $(m68k_SRCS)
120am_libebl_m68k_pic_a_OBJECTS = $(m68k_SRCS:.c=.os)
121
122# m68k prstatus core notes are described by a packed structure
123# which has not naturally aligned fields. Since we don't access
124# these fields directly, but take their offset to be used later
125# to extract the data through elfxx_xlatetom/memmove, this isn't
126# an issue.
127m68k_corenote_no_Wpacked_not_aligned = yes
128
129bpf_SRCS = bpf_init.c bpf_regs.c bpf_symbol.c
130cpu_bpf = ../libcpu/libcpu_bpf.a
131libebl_bpf_pic_a_SOURCES = $(bpf_SRCS)
132am_libebl_bpf_pic_a_OBJECTS = $(bpf_SRCS:.c=.os)
133
134riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c \
135	     riscv_initreg.c riscv_corenote.c riscv64_corenote.c riscv_retval.c
136libebl_riscv_pic_a_SOURCES = $(riscv_SRCS)
137am_libebl_riscv_pic_a_OBJECTS = $(riscv_SRCS:.c=.os)
138
139
140libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) $(libeu)
141	@rm -f $(@:.so=.map)
142	$(AM_V_at)echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
143	  > $(@:.so=.map)
144	$(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $(@:.map=.so) \
145		-Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
146		-Wl,--version-script,$(@:.so=.map),--no-undefined \
147		-Wl,--as-needed $(libelf) $(libdw) $(libeu)
148	@$(textrel_check)
149
150libebl_i386.so: $(cpu_i386)
151libebl_x86_64.so: $(cpu_x86_64)
152libebl_bpf.so: $(cpu_bpf)
153
154install: install-am install-ebl-modules
155install-ebl-modules:
156	$(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
157	for m in $(modules); do \
158	  $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
159	  ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
160	done
161
162uninstall: uninstall-am
163	for m in $(modules); do \
164	  rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
165	  rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
166	done
167	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
168
169noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
170EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def)
171
172CLEANFILES += $(foreach m,$(modules),\
173			libebl_$(m).map libebl_$(m).so \
174			$(am_libebl_$(m)_pic_a_OBJECTS))
175