1 ## Process this file with automake to create Makefile.in
3 ## Copyright (C) 1996-2012 Red Hat, Inc.
4 ## This file is part of Red Hat elfutils.
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.
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.
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.
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>.
27 include $(top_srcdir)/config/eu.am
28 DEFS += $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \
29 -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
30 INCLUDES += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \
31 -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \
34 AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw
36 no_mudflap.os = -fmudflap
40 AM_LFLAGS = -Pld -olex.yy.c
41 ## Uncomment to enable debugging of linker script parser
42 ##YYDEBUG = -DYYDEBUG=1
44 native_ld = @native_ld@
47 bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \
48 elfcmp objdump ranlib strings ar unstrip
51 ld_dsos = libld_elf_i386_pic.a
53 noinst_LIBRARIES = libld_elf.a libar.a
54 native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu)
56 noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos)
57 noinst_PROGRAMS = $(ld_dsos:_pic.a=.so)
60 # We never build this library but we need to get the dependency files
61 # of all the linker backends that might be used in a non-generic linker.
62 noinst_LIBRARIES += libdummy.a
63 libdummy_a_SOURCES = i386_ld.c
67 ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \
70 libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c
72 noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \
73 ldscript.h xelf.h unaligned.h
75 EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) arlib.h \
77 ld_modules = i386_ld.c
79 bin_SCRIPTS = make-debug-archive
80 EXTRA_DIST += make-debug-archive.in
81 CLEANFILES += make-debug-archive
84 libasm = ../libasm/libasm.a
85 libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl
86 libelf = ../libelf/libelf.a
88 libasm = ../libasm/libasm.so
89 libdw = ../libdw/libdw.so
90 libelf = ../libelf/libelf.so
92 libebl = ../libebl/libebl.a
93 libeu = ../lib/libeu.a
96 demanglelib = -lstdc++
100 size_no_Wformat = yes
101 strings_no_Wformat = yes
102 addr2line_no_Wformat = yes
103 # XXX While the file is not finished, don't warn about this
104 ldgeneric_no_Wunused = yes
106 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
107 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \
109 size_LDADD = $(libelf) $(libeu) $(libmudflap)
110 strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
111 ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
113 # -ldl is always needed for libebl.
114 ld_LDADD += libld_elf.a
116 ld_LDFLAGS = -rdynamic
117 elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
118 findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap)
119 addr2line_LDADD = $(libdw) $(libelf) $(libmudflap)
120 elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl
121 objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
122 ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap)
123 strings_LDADD = $(libelf) $(libeu) $(libmudflap)
124 ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap)
125 unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl
128 ldlex_no_Werror = yes
129 ldscript.h: ldscript.c
132 # Machine-specific linker code.
133 libld_elf_a_SOURCES := $(base_cpu)_ld.c
135 libld_elf_i386_pic_a_SOURCES =
136 am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os
138 libld_elf_i386_so_SOURCES =
139 libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map
140 $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \
142 -Wl,--version-script,$(srcdir)/libld_elf_i386.map
146 # Special rule to make it possible to define libld_elf_a_SOURCES as we do.
147 # Otherwise make would complain.
148 .deps/none_ld.Po: none_ld.os
152 installcheck-binPROGRAMS: $(bin_PROGRAMS)
153 bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
154 case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
155 *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
158 sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
159 for opt in --help --version; do \
160 if LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \
161 $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \
162 && test -n "`cat c$${pid}_.out`" \
163 && test -z "`cat c$${pid}_.err`"; then :; \
164 else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
166 done; rm -f c$${pid}_.???; exit $$bad
168 CLEANFILES += none_ld.os $(ld_modules:.c=.os) *.gconv
170 MAINTAINERCLEANFILES = ldlex.c ldscript.c ldscript.h
173 make-debug-archive: $(srcdir)/make-debug-archive.in
174 UNSTRIP=$(bindir)/`echo unstrip | sed '$(transform)'`; \
175 AR=$(bindir)/`echo ar | sed '$(transform)'`; \
176 sed -e "s,@UNSTRIP@,$$UNSTRIP,g" -e "s,@AR@,$$AR,g" \
177 -e "s%[@]PACKAGE_NAME[@]%$(PACKAGE_NAME)%g" \
178 -e "s%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g" \
179 $(srcdir)/make-debug-archive.in > $@.new