1 ## Process this file with automake to create Makefile.in 2 ## 3 ## Copyright (C) 1996-2012 Red Hat, Inc. 4 ## This file is part of Red Hat elfutils. 5 ## 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. 9 ## 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. 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, 17 ## Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. 18 ## 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>. 26 ## 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 \ 32 -I$(srcdir)/../libasm 33 34 AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw 35 36 no_mudflap.os = -fmudflap 37 38 YACC = @YACC@ -d 39 AM_YFLAGS = -pld 40 AM_LFLAGS = -Pld -olex.yy.c 41 ## Uncomment to enable debugging of linker script parser 42 ##YYDEBUG = -DYYDEBUG=1 43 44 native_ld = @native_ld@ 45 base_cpu = @base_cpu@ 46 47 bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \ 48 elfcmp objdump ranlib strings ar unstrip 49 50 51 ld_dsos = libld_elf_i386_pic.a 52 if NATIVE_LD 53 noinst_LIBRARIES = libld_elf.a libar.a 54 native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) 55 else 56 noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) 57 noinst_PROGRAMS = $(ld_dsos:_pic.a=.so) 58 endif 59 if NEVER 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 64 endif 65 66 67 ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ 68 versionhash.c 69 70 libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c 71 72 noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ 73 ldscript.h xelf.h unaligned.h 74 75 EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) arlib.h \ 76 debugpred.h 77 ld_modules = i386_ld.c 78 79 bin_SCRIPTS = make-debug-archive 80 EXTRA_DIST += make-debug-archive.in 81 CLEANFILES += make-debug-archive 82 83 if BUILD_STATIC 84 libasm = ../libasm/libasm.a 85 libdw = ../libdw/libdw.a $(zip_LIBS) $(libelf) $(libebl) -ldl 86 libelf = ../libelf/libelf.a 87 else 88 libasm = ../libasm/libasm.so 89 libdw = ../libdw/libdw.so 90 libelf = ../libelf/libelf.so 91 endif 92 libebl = ../libebl/libebl.a 93 libeu = ../lib/libeu.a 94 95 if DEMANGLE 96 demanglelib = -lstdc++ 97 endif 98 99 nm_no_Wformat = yes 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 105 106 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 107 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl \ 108 $(demanglelib) 109 size_LDADD = $(libelf) $(libeu) $(libmudflap) 110 strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 111 ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 112 if NATIVE_LD 113 # -ldl is always needed for libebl. 114 ld_LDADD += libld_elf.a 115 endif 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 126 127 ldlex.o: ldscript.c 128 ldlex_no_Werror = yes 129 ldscript.h: ldscript.c 130 131 if NATIVE_LD 132 # Machine-specific linker code. 133 libld_elf_a_SOURCES := $(base_cpu)_ld.c 134 else 135 libld_elf_i386_pic_a_SOURCES = 136 am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os 137 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 \ 141 $(libelf) $(libeu) \ 142 -Wl,--version-script,$(srcdir)/libld_elf_i386.map 143 $(textrel_check) 144 endif 145 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 149 -: 150 151 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;; \ 156 esac; \ 157 f=`echo "$$p" | \ 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; \ 165 done; \ 166 done; rm -f c$${pid}_.???; exit $$bad 167 168 CLEANFILES += none_ld.os $(ld_modules:.c=.os) *.gconv 169 170 MAINTAINERCLEANFILES = ldlex.c ldscript.c ldscript.h 171 172 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 180 chmod +x $@.new 181 mv -f $@.new $@ 182