1## Process this file with automake to create Makefile.in
2## Configure input file for elfutils.
3##
4## Copyright (C) 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
5##
6## This program is Open Source software; you can redistribute it and/or
7## modify it under the terms of the Open Software License version 1.0 as
8## published by the Open Source Initiative.
9##
10## You should have received a copy of the Open Software License along
11## with this program; if not, you may obtain a copy of the Open Software
12## License version 1.0 from http://www.opensource.org/licenses/osl.php or
13## by writing the Open Source Initiative c/o Lawrence Rosen, Esq.,
14## 3001 King Ranch Road, Ukiah, CA 95482.
15##
16DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DOBJDIR=\"$(shell pwd)\"
17if MUDFLAP
18AM_CFLAGS = -Wall -Wshadow -fpic
19else
20AM_CFLAGS = -Wall -Werror -Wshadow -fpic
21endif
22AM_CFLAGS += -DLIBSTR=\"$$(basename $(libdir))\"
23
24INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/lib -I..
25VERSION = 1
26PACKAGE_VERSION = @PACKAGE_VERSION@
27
28lib_LIBRARIES = libebl.a
29modules = i386 sh mips x86_64 ia64 alpha arm sparc ppc ppc64
30noinst_LIBRARIES = libebl_i386_pic.a libebl_sh_pic.a libebl_mips_pic.a \
31		   libebl_x86_64_pic.a libebl_ia64_pic.a libebl_alpha_pic.a \
32		   libebl_arm_pic.a libebl_sparc_pic.a libebl_ppc_pic.a \
33		   libebl_ppc64_pic.a
34noinst_PROGRAMS = $(noinst_LIBRARIES:_pic.a=.so)
35
36euincludedir = $(includedir)/elfutils
37euinclude_HEADERS = libebl.h
38
39gen_SOURCES = eblopenbackend.c eblclosebackend.c eblstrtab.c \
40	      eblreloctypename.c eblsegmenttypename.c \
41	      eblsectiontypename.c eblmachineflagname.c \
42	      eblsymboltypename.c ebldynamictagname.c eblsectionname.c \
43	      eblobjecttypename.c eblsymbolbindingname.c \
44	      eblbackendname.c eblshflagscombine.c eblwstrtab.c \
45	      eblgstrtab.c eblosabiname.c eblmachineflagcheck.c \
46	      eblreloctypecheck.c eblrelocvaliduse.c ebldynamictagcheck.c \
47	      eblcorenotetypename.c eblobjnotetypename.c \
48	      eblcorenote.c eblobjnote.c ebldebugscnp.c \
49	      eblgotpcreloccheck.c
50
51libebl_a_SOURCES = $(gen_SOURCES)
52
53#
54# XXX Use --enable-new-dtags as soon as ld.so handles DT_RUNPATH when
55# using dlopen correctly.
56#	      -Wl,--rpath,\$$ORIGIN/elfutils \
57#
58i386_SRCS = i386_init.c i386_destr.c i386_symbol.c i386_corenote.c
59libebl_i386_pic_a_SOURCES =
60am_libebl_i386_pic_a_OBJECTS = $(i386_SRCS:.c=.os)
61
62if MUDFLAP
63libelf = ../libelf/libelf.a
64libmudflap = -lmudflap
65else
66libelf = ../libelf/libelf.so
67libmudflap =
68endif
69
70libebl_i386_so_SOURCES =
71libebl_i386.so: libebl_i386_pic.a libebl_i386.map
72	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
73	      -Wl,--version-script,$(srcdir)/libebl_i386.map \
74	      -Wl,-z,defs $(libelf) $(libmudflap)
75
76
77sh_SRCS = sh_init.c sh_destr.c sh_symbol.c
78libebl_sh_pic_a_SOURCES =
79am_libebl_sh_pic_a_OBJECTS = $(sh_SRCS:.c=.os)
80
81libebl_sh_so_SOURCES =
82libebl_sh.so: libebl_sh_pic.a libebl_sh.map
83	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
84	      -Wl,--version-script,$(srcdir)/libebl_sh.map \
85	      -Wl,-z,defs $(libmudflap)
86
87
88mips_SRCS = mips_init.c mips_destr.c mips_symbol.c
89libebl_mips_pic_a_SOURCES =
90am_libebl_mips_pic_a_OBJECTS = $(mips_SRCS:.c=.os)
91
92libebl_mips_so_SOURCES =
93libebl_mips.so: libebl_mips_pic.a libebl_mips.map
94	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
95	      -Wl,--version-script,$(srcdir)/libebl_mips.map \
96	      -Wl,-z,defs $(libmudflap)
97
98
99x86_64_SRCS = x86_64_init.c x86_64_destr.c x86_64_symbol.c
100libebl_x86_64_pic_a_SOURCES =
101am_libebl_x86_64_pic_a_OBJECTS = $(x86_64_SRCS:.c=.os)
102
103libebl_x86_64_so_SOURCES =
104libebl_x86_64.so: libebl_x86_64_pic.a libebl_x86_64.map
105	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
106	      -Wl,--version-script,$(srcdir)/libebl_x86_64.map \
107	      -Wl,-z,defs $(libelf) $(libmudflap)
108
109
110ia64_SRCS = ia64_init.c ia64_destr.c ia64_symbol.c
111libebl_ia64_pic_a_SOURCES =
112am_libebl_ia64_pic_a_OBJECTS = $(ia64_SRCS:.c=.os)
113
114libebl_ia64_so_SOURCES =
115libebl_ia64.so: libebl_ia64_pic.a libebl_ia64.map
116	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
117	      -Wl,--version-script,$(srcdir)/libebl_ia64.map \
118	      -Wl,-z,defs $(libmudflap)
119
120
121alpha_SRCS = alpha_init.c alpha_destr.c alpha_symbol.c
122libebl_alpha_pic_a_SOURCES =
123am_libebl_alpha_pic_a_OBJECTS = $(alpha_SRCS:.c=.os)
124
125libebl_alpha_so_SOURCES =
126libebl_alpha.so: libebl_alpha_pic.a libebl_alpha.map
127	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
128	      -Wl,--version-script,$(srcdir)/libebl_alpha.map \
129	      -Wl,-z,defs $(libmudflap)
130
131
132arm_SRCS = arm_init.c arm_destr.c arm_symbol.c
133libebl_arm_pic_a_SOURCES =
134am_libebl_arm_pic_a_OBJECTS = $(arm_SRCS:.c=.os)
135
136libebl_arm_so_SOURCES =
137libebl_arm.so: libebl_arm_pic.a libebl_arm.map
138	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
139	      -Wl,--version-script,$(srcdir)/libebl_arm.map \
140	      -Wl,-z,defs $(libmudflap)
141
142
143sparc_SRCS = sparc_init.c sparc_destr.c sparc_symbol.c
144libebl_sparc_pic_a_SOURCES =
145am_libebl_sparc_pic_a_OBJECTS = $(sparc_SRCS:.c=.os)
146
147libebl_sparc_so_SOURCES =
148libebl_sparc.so: libebl_sparc_pic.a libebl_sparc.map
149	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
150	      -Wl,--version-script,$(srcdir)/libebl_sparc.map \
151	      -Wl,-z,defs $(libmudflap)
152
153
154ppc_SRCS = ppc_init.c ppc_destr.c ppc_symbol.c
155libebl_ppc_pic_a_SOURCES =
156am_libebl_ppc_pic_a_OBJECTS = $(ppc_SRCS:.c=.os)
157
158libebl_ppc_so_SOURCES =
159libebl_ppc.so: libebl_ppc_pic.a libebl_ppc.map
160	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
161	      -Wl,--version-script,$(srcdir)/libebl_ppc.map \
162	      -Wl,-z,defs $(libelf) $(libmudflap)
163
164
165ppc64_SRCS = ppc64_init.c ppc64_destr.c ppc64_symbol.c
166libebl_ppc64_pic_a_SOURCES =
167am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
168
169libebl_ppc64_so_SOURCES =
170libebl_ppc64.so: libebl_ppc64_pic.a libebl_ppc64.map
171	$(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
172	      -Wl,--version-script,$(srcdir)/libebl_ppc64.map \
173	      -Wl,-z,defs $(libelf) $(libmudflap)
174
175
176%.os: %.c %.o
177	if $(COMPILE) -c -o $@ -fpic -DPIC -DSHARED -MT $@ -MD -MP \
178	  -MF "$(DEPDIR)/$*.Tpo" `test -f '$<' || echo '$(srcdir)/'`$<; \
179	then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \
180	     rm -f "$(DEPDIR)/$*.Tpo"; \
181	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
182	fi
183
184install: install-am
185	$(mkinstalldirs) $(DESTDIR)$(libdir)/elfutils
186	for m in $(modules); do \
187	  $(INSTALL_PROGRAM) libebl_$${m}.so $(DESTDIR)$(libdir)/elfutils/libebl_$${m}-$(PACKAGE_VERSION).so; \
188	  ln -fs libebl_$${m}-$(PACKAGE_VERSION).so $(DESTDIR)$(libdir)/elfutils/libebl_$${m}.so; \
189	done
190
191uninstall: uninstall-am
192	for m in $(modules); do \
193	  rm -f $(DESTDIR)$(libdir)/elfutils/libebl_$${m}-$(PACKAGE_VERSION).so; \
194	  rm -f $(DESTDIR)$(libdir)/elfutils/libebl_$${m}.so; \
195	done
196	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(libdir)/elfutils
197	rmdir --ignore-fail-on-non-empty $(DESTDIR)$(includedir)/elfutils
198
199noinst_HEADERS = libeblP.h $(noinst_LIBRARIES:%_pic.a=%.h)
200EXTRA_DIST = $(noinst_LIBRARIES:%_pic.a=%.map) \
201	     $(foreach m,$(modules),$($(m)_SRCS))
202
203CLEANFILES = $(am_libebl_pic_a_OBJECTS) \
204	     $(foreach m,$(modules),$(am_libebl_$(m)_pic_a_OBJECTS))
205