1 ## Process this file with automake to create Makefile.in 2 ## 3 ## Copyright (C) 1996-2014 Red Hat, Inc. 4 ## This file is part of elfutils. 5 ## 6 ## This file is free software; you can redistribute it and/or modify 7 ## it under the terms of the GNU General Public License as published by 8 ## the Free Software Foundation; either version 3 of the License, or 9 ## (at your option) any later version. 10 ## 11 ## elfutils is distributed in the hope that it will be useful, but 12 ## WITHOUT ANY WARRANTY; without even the implied warranty of 13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 ## GNU General Public License for more details. 15 ## 16 ## You should have received a copy of the GNU General Public License 17 ## along with this program. If not, see <http://www.gnu.org/licenses/>. 18 ## 19 include $(top_srcdir)/config/eu.am 20 DEFS += $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \ 21 -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\" 22 AM_CPPFLAGS += -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ 23 -I$(srcdir)/../libdw -I$(srcdir)/../libdwelf \ 24 -I$(srcdir)/../libdwfl -I$(srcdir)/../libasm 25 26 AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw 27 28 YACC = @YACC@ -d 29 AM_YFLAGS = -pld 30 AM_LFLAGS = -Pld -olex.yy.c 31 ## Uncomment to enable debugging of linker script parser 32 ##YYDEBUG = -DYYDEBUG=1 33 34 native_ld = @native_ld@ 35 base_cpu = @base_cpu@ 36 37 bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \ 38 elfcmp objdump ranlib strings ar unstrip stack elfcompress 39 40 41 ld_dsos = libld_elf_i386_pic.a 42 if NATIVE_LD 43 noinst_LIBRARIES = libld_elf.a libar.a 44 native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) 45 else 46 noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) 47 noinst_PROGRAMS = $(ld_dsos:_pic.a=.so) 48 endif 49 if NEVER 50 # We never build this library but we need to get the dependency files 51 # of all the linker backends that might be used in a non-generic linker. 52 noinst_LIBRARIES += libdummy.a 53 libdummy_a_SOURCES = i386_ld.c 54 endif 55 56 57 ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ 58 versionhash.c 59 60 libar_a_SOURCES = arlib.c arlib2.c arlib-argp.c 61 62 noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ 63 ldscript.h xelf.h unaligned.h 64 65 EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) arlib.h \ 66 debugpred.h 67 ld_modules = i386_ld.c 68 69 bin_SCRIPTS = make-debug-archive 70 EXTRA_DIST += make-debug-archive.in 71 CLEANFILES += make-debug-archive 72 73 if BUILD_STATIC 74 libasm = ../libasm/libasm.a 75 libdw = ../libdw/libdw.a -lz $(zip_LIBS) $(libelf) $(libebl) -ldl 76 libelf = ../libelf/libelf.a -lz 77 else 78 libasm = ../libasm/libasm.so 79 libdw = ../libdw/libdw.so 80 libelf = ../libelf/libelf.so 81 endif 82 libebl = ../libebl/libebl.a 83 libeu = ../lib/libeu.a 84 85 if DEMANGLE 86 demanglelib = -lstdc++ 87 endif 88 89 # XXX While the file is not finished, don't warn about this 90 ldgeneric_no_Wunused = yes 91 ldgeneric_no_Wstack_usage = yes 92 ldlex_no_Wstack_usage = yes 93 94 # Bad, bad stack usage... 95 readelf_no_Wstack_usage = yes 96 nm_no_Wstack_usage = yes 97 size_no_Wstack_usage = yes 98 strip_no_Wstack_usage = yes 99 elflint_no_Wstack_usage = yes 100 findtextrel_no_Wstack_usage = yes 101 elfcmp_no_Wstack_usage = yes 102 objdump_no_Wstack_usage = yes 103 ranlib_no_Wstack_usage = yes 104 ar_no_Wstack_usage = yes 105 unstrip_no_Wstack_usage = yes 106 107 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl 108 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \ 109 $(demanglelib) 110 size_LDADD = $(libelf) $(libeu) $(argp_LDADD) 111 strip_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl 112 ld_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl 113 if NATIVE_LD 114 # -ldl is always needed for libebl. 115 ld_LDADD += libld_elf.a 116 endif 117 ld_LDFLAGS = -rdynamic 118 elflint_LDADD = $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl 119 findtextrel_LDADD = $(libdw) $(libelf) $(argp_LDADD) 120 addr2line_LDADD = $(libdw) $(libelf) $(argp_LDADD) $(demanglelib) 121 elfcmp_LDADD = $(libebl) $(libelf) $(argp_LDADD) -ldl 122 objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl 123 ranlib_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) 124 strings_LDADD = $(libelf) $(libeu) $(argp_LDADD) 125 ar_LDADD = libar.a $(libelf) $(libeu) $(argp_LDADD) 126 unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl 127 stack_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) -ldl $(demanglelib) 128 elfcompress_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(argp_LDADD) 129 130 ldlex.o: ldscript.c 131 ldlex_no_Werror = yes 132 ldscript.h: ldscript.c 133 134 if NATIVE_LD 135 # Machine-specific linker code. 136 libld_elf_a_SOURCES := $(base_cpu)_ld.c 137 else 138 libld_elf_i386_pic_a_SOURCES = 139 am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os 140 141 libld_elf_i386_so_SOURCES = 142 libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map 143 $(AM_V_CCLD)$(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ 144 $(libelf) $(libeu) \ 145 -Wl,--version-script,$(srcdir)/libld_elf_i386.map 146 @$(textrel_check) 147 endif 148 149 # Special rule to make it possible to define libld_elf_a_SOURCES as we do. 150 # Otherwise make would complain. 151 .deps/none_ld.Po: none_ld.os 152 @-: 153 154 155 installcheck-binPROGRAMS: $(bin_PROGRAMS) 156 bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ 157 case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ 158 *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ 159 esac; \ 160 f=`echo "$$p" | \ 161 sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 162 for opt in --help --version; do \ 163 if LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \ 164 $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ 165 && test -n "`cat c$${pid}_.out`" \ 166 && test -z "`cat c$${pid}_.err`"; then :; \ 167 else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ 168 done; \ 169 done; rm -f c$${pid}_.???; exit $$bad 170 171 CLEANFILES += none_ld.os $(ld_modules:.c=.os) *.gconv 172 173 MAINTAINERCLEANFILES = ldlex.c ldscript.c ldscript.h 174 175 176 make-debug-archive: $(srcdir)/make-debug-archive.in 177 $(AM_V_GEN)UNSTRIP=$(bindir)/`echo unstrip | sed '$(transform)'`; \ 178 AR=$(bindir)/`echo ar | sed '$(transform)'`; \ 179 sed -e "s,[@]UNSTRIP[@],$$UNSTRIP,g" -e "s,[@]AR[@],$$AR,g" \ 180 -e "s%[@]PACKAGE_NAME[@]%$(PACKAGE_NAME)%g" \ 181 -e "s%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g" \ 182 $(srcdir)/make-debug-archive.in > $@.new 183 $(AM_V_at)chmod +x $@.new 184 $(AM_V_at)mv -f $@.new $@ 185