1## Process this file with automake to create Makefile.in 2## 3## Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2007 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## 27DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \ 28 -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\" 29if MUDFLAP 30AM_CFLAGS = -fmudflap 31else 32AM_CFLAGS = 33endif 34AM_CFLAGS += -Wall -Wshadow -std=gnu99 $(native_ld_cflags) \ 35 $(if $($(*F)_no_Werror),,-Werror) \ 36 $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ 37 $(if $($(*F)_no_Wformat),,-Wformat=2) $(CFLAGS_$(*F)) 38 39INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ 40 -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \ 41 -I$(srcdir)/../libasm -I$(srcdir)/../lib -I.. 42 43AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw 44 45YACC = @YACC@ -d 46AM_YFLAGS = -pld 47AM_LFLAGS = -Pld -olex.yy.c 48## Uncomment to enable debugging of linker script parser 49##YYDEBUG = -DYYDEBUG=1 50 51native_ld = @native_ld@ 52base_cpu = @base_cpu@ 53 54bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \ 55 elfcmp objdump ranlib strings ar unstrip 56 57 58ld_dsos = libld_elf_i386_pic.a 59if NATIVE_LD 60noinst_LIBRARIES = libld_elf.a libar.a 61native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) 62else 63noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) 64noinst_PROGRAMS = $(ld_dsos:_pic.a=.so) 65endif 66if NEVER 67# We never build this library but we need to get the dependency files 68# of all the linker backends that might be used in a non-generic linker. 69noinst_LIBRARIES += libdummy.a 70libdummy_a_SOURCES = i386_ld.c 71endif 72 73textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi 74 75 76ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ 77 versionhash.c 78 79libar_a_SOURCES = arlib.c arlib2.c 80 81noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ 82 ldscript.h xelf.h unaligned.h 83 84EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) arlib.h \ 85 debugpred.h 86ld_modules = i386_ld.c 87 88bin_SCRIPTS = make-debug-archive 89EXTRA_DIST += make-debug-archive.in 90CLEANFILES = make-debug-archive 91 92if MUDFLAP 93libmudflap = -lmudflap 94endif 95 96if BUILD_STATIC 97libasm = ../libasm/libasm.a 98libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl 99libelf = ../libelf/libelf.a 100else 101libasm = ../libasm/libasm.so 102libdw = ../libdw/libdw.so 103libelf = ../libelf/libelf.so 104endif 105libebl = ../libebl/libebl.a 106libeu = ../lib/libeu.a 107 108nm_no_Wformat = yes 109size_no_Wformat = yes 110strings_no_Wformat = yes 111# XXX While the file is not finished, don't warn about this 112ldgeneric_no_Wunused = yes 113 114readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 115nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 116size_LDADD = $(libelf) $(libeu) $(libmudflap) 117strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 118ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 119if NATIVE_LD 120# -ldl is always needed for libebl. 121ld_LDADD += libld_elf.a 122endif 123ld_LDFLAGS = -rdynamic 124elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 125findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) 126addr2line_LDADD = $(libdw) $(libmudflap) 127elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl 128objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 129ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) 130strings_LDADD = $(libelf) $(libeu) $(libmudflap) 131ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) 132CFLAGS_ar = -DAR=\"$(shell echo ar|sed '$(transform)')\" 133unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl 134 135ldlex.o: ldscript.c 136ldlex_no_Werror = yes 137ldscript.h: ldscript.c 138 139if NATIVE_LD 140# Machine-specific linker code. 141libld_elf_a_SOURCES := $(base_cpu)_ld.c 142else 143libld_elf_i386_pic_a_SOURCES = 144am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os 145 146libld_elf_i386_so_SOURCES = 147libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map 148 $(LINK) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ 149 $(libelf) $(libeu) \ 150 -Wl,--version-script,$(srcdir)/libld_elf_i386.map 151 $(textrel_check) 152endif 153 154 155%.os: %.c %.o 156 if $(filter-out -fmudflap,$(COMPILE)) -c -o $@ -fpic -DPIC -DSHARED \ 157 -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ 158 `test -f '$<' || echo '$(srcdir)/'`$<; \ 159 then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ 160 rm -f "$(DEPDIR)/$*.Tpo"; \ 161 else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ 162 fi 163 164# Special rule to make it possible to define libld_elf_a_SOURCES as we do. 165# Otherwise make would complain. 166.deps/none_ld.Po: none_ld.os 167 -: 168 169 170installcheck-binPROGRAMS: $(bin_PROGRAMS) 171 bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ 172 case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ 173 *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ 174 esac; \ 175 f=`echo "$$p" | \ 176 sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ 177 for opt in --help --version; do \ 178 if LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \ 179 $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ 180 && test -n "`cat c$${pid}_.out`" \ 181 && test -z "`cat c$${pid}_.err`"; then :; \ 182 else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ 183 done; \ 184 done; rm -f c$${pid}_.???; exit $$bad 185 186CLEANFILES += none_ld.os $(ld_modules:.c=.os) *.gcno *.gcda *.gconv 187 188MAINTAINERCLEANFILES = ldlex.c ldscript.c ldscript.h 189 190 191make-debug-archive: $(srcdir)/make-debug-archive.in 192 UNSTRIP=$(bindir)/`echo unstrip | sed '$(transform)'`; \ 193 AR=$(bindir)/`echo ar | sed '$(transform)'`; \ 194 sed -e "s,@UNSTRIP@,$$UNSTRIP,g" -e "s,@AR@,$$AR,g" \ 195 -e "s%[@]PACKAGE_NAME[@]%$(PACKAGE_NAME)%g" \ 196 -e "s%[@]PACKAGE_VERSION[@]%$(PACKAGE_VERSION)%g" \ 197 $(srcdir)/make-debug-archive.in > $@.new 198 chmod +x $@.new 199 mv -f $@.new $@ 200