0c14ec86b5f1a306f5121a43fd2b9dc9452782d1
[platform/upstream/elfutils.git] / backends / Makefile.am
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/>.
30 include $(top_srcdir)/config/eu.am
31 AM_CPPFLAGS += -I$(top_srcdir)/libebl -I$(top_srcdir)/libasm \
32            -I$(top_srcdir)/libelf -I$(top_srcdir)/libdw
33
34
35 modules = i386 sh x86_64 ia64 alpha arm aarch64 sparc ppc ppc64 s390 \
36           tilegx m68k bpf riscv
37 libebl_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
42 noinst_LIBRARIES = $(libebl_pic)
43 noinst_DATA = $(libebl_pic:_pic.a=.so)
44
45
46 libelf = ../libelf/libelf.so
47 libdw = ../libdw/libdw.so
48 libeu = ../lib/libeu.a
49
50 i386_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
53 cpu_i386 = ../libcpu/libcpu_i386.a
54 libebl_i386_pic_a_SOURCES = $(i386_SRCS)
55 am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os)
56
57 sh_SRCS = sh_init.c sh_symbol.c sh_corenote.c sh_regs.c sh_retval.c
58 libebl_sh_pic_a_SOURCES = $(sh_SRCS)
59 am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os)
60
61 x86_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
64 cpu_x86_64 = ../libcpu/libcpu_x86_64.a
65 libebl_x86_64_pic_a_SOURCES = $(x86_64_SRCS)
66 am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
67
68 ia64_SRCS = ia64_init.c ia64_symbol.c ia64_regs.c ia64_retval.c
69 libebl_ia64_pic_a_SOURCES = $(ia64_SRCS)
70 am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
71
72 alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c alpha_regs.c \
73              alpha_corenote.c alpha_auxv.c
74 libebl_alpha_pic_a_SOURCES = $(alpha_SRCS)
75 am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
76
77 arm_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
79 libebl_arm_pic_a_SOURCES = $(arm_SRCS)
80 am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
81
82 aarch64_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
85 libebl_aarch64_pic_a_SOURCES = $(aarch64_SRCS)
86 am_libebl_aarch64_pic_a_OBJECTS = $(aarch64_SRCS:.c=.os)
87
88 sparc_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
91 libebl_sparc_pic_a_SOURCES = $(sparc_SRCS)
92 am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os)
93
94 ppc_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
97 libebl_ppc_pic_a_SOURCES = $(ppc_SRCS)
98 am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os)
99
100 ppc64_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
103 libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS)
104 am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
105
106 s390_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
109 libebl_s390_pic_a_SOURCES = $(s390_SRCS)
110 am_libebl_s390_pic_a_OBJECTS = $(s390_SRCS:.c=.os)
111
112 tilegx_SRCS = tilegx_init.c tilegx_symbol.c tilegx_regs.c \
113               tilegx_retval.c tilegx_corenote.c
114 libebl_tilegx_pic_a_SOURCES = $(tilegx_SRCS)
115 am_libebl_tilegx_pic_a_OBJECTS = $(tilegx_SRCS:.c=.os)
116
117 m68k_SRCS = m68k_init.c m68k_symbol.c m68k_regs.c \
118             m68k_retval.c m68k_corenote.c
119 libebl_m68k_pic_a_SOURCES = $(m68k_SRCS)
120 am_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.
127 m68k_corenote_no_Wpacked_not_aligned = yes
128
129 bpf_SRCS = bpf_init.c bpf_regs.c
130 cpu_bpf = ../libcpu/libcpu_bpf.a
131 libebl_bpf_pic_a_SOURCES = $(bpf_SRCS)
132 am_libebl_bpf_pic_a_OBJECTS = $(bpf_SRCS:.c=.os)
133
134 riscv_SRCS = riscv_init.c riscv_symbol.c riscv_cfi.c riscv_regs.c
135 libebl_riscv_pic_a_SOURCES = $(riscv_SRCS)
136 am_libebl_riscv_pic_a_OBJECTS = $(riscv_SRCS:.c=.os)
137
138
139 libebl_%.so libebl_%.map: libebl_%_pic.a $(libelf) $(libdw) $(libeu)
140         @rm -f $(@:.so=.map)
141         $(AM_V_at)echo 'ELFUTILS_$(PACKAGE_VERSION) { global: $*_init; local: *; };' \
142           > $(@:.so=.map)
143         $(AM_V_CCLD)$(LINK) $(dso_LDFLAGS) -o $(@:.map=.so) \
144                 -Wl,--whole-archive $< $(cpu_$*) -Wl,--no-whole-archive \
145                 -Wl,--version-script,$(@:.so=.map),--no-undefined \
146                 -Wl,--as-needed $(libelf) $(libdw) $(libeu)
147         @$(textrel_check)
148
149 libebl_i386.so: $(cpu_i386)
150 libebl_x86_64.so: $(cpu_x86_64)
151 libebl_bpf.so: $(cpu_bpf)
152
153 install: install-am install-ebl-modules
154 install-ebl-modules:
155         $(mkinstalldirs) $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
156         for m in $(modules); do \
157           $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
158           ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
159         done
160
161 uninstall: uninstall-am
162         for m in $(modules); do \
163           rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}-$(PACKAGE_VERSION).so; \
164           rm -f $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)/libebl_$${m}.so; \
165         done
166         rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/$(LIBEBL_SUBDIR)
167
168 noinst_HEADERS = libebl_CPU.h common-reloc.c linux-core-note.c x86_corenote.c
169 EXTRA_DIST = $(foreach m,$(modules),$($(m)_SRCS)) $(modules:=_reloc.def)
170
171 CLEANFILES += $(foreach m,$(modules),\
172                         libebl_$(m).map libebl_$(m).so \
173                         $(am_libebl_$(m)_pic_a_OBJECTS))