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 ## 27 DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) -DDEBUGPRED=@DEBUGPRED@ \ 28 -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\" 29 if MUDFLAP 30 AM_CFLAGS = -fmudflap 31 else 32 AM_CFLAGS = 33 endif 34 AM_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 39 INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl \ 40 -I$(srcdir)/../libdw -I$(srcdir)/../libdwfl \ 41 -I$(srcdir)/../libasm -I$(srcdir)/../lib -I.. 42 43 AM_LDFLAGS = -Wl,-rpath-link,../libelf:../libdw 44 45 YACC = @YACC@ -d 46 AM_YFLAGS = -pld 47 AM_LFLAGS = -Pld -olex.yy.c 48 ## Uncomment to enable debugging of linker script parser 49 ##YYDEBUG = -DYYDEBUG=1 50 51 native_ld = @native_ld@ 52 base_cpu = @base_cpu@ 53 54 bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \ 55 elfcmp objdump ranlib strings ar unstrip 56 57 58 ld_dsos = libld_elf_i386_pic.a 59 if NATIVE_LD 60 noinst_LIBRARIES = libld_elf.a libar.a 61 native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) 62 else 63 noinst_LIBRARIES = libld_elf.a libar.a $(ld_dsos) 64 noinst_PROGRAMS = $(ld_dsos:_pic.a=.so) 65 endif 66 if 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. 69 noinst_LIBRARIES += libdummy.a 70 libdummy_a_SOURCES = i386_ld.c 71 endif 72 73 textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi 74 75 76 ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ 77 versionhash.c 78 79 libar_a_SOURCES = arlib.c arlib2.c 80 81 noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ 82 ldscript.h xelf.h unaligned.h 83 84 EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) arlib.h \ 85 debugpred.h 86 ld_modules = i386_ld.c 87 88 bin_SCRIPTS = make-debug-archive 89 EXTRA_DIST += make-debug-archive.in 90 CLEANFILES = make-debug-archive 91 92 if MUDFLAP 93 libmudflap = -lmudflap 94 endif 95 96 if BUILD_STATIC 97 libasm = ../libasm/libasm.a 98 libdw = ../libdw/libdw.a $(libelf) $(libebl) -ldl 99 libelf = ../libelf/libelf.a 100 else 101 libasm = ../libasm/libasm.so 102 libdw = ../libdw/libdw.so 103 libelf = ../libelf/libelf.so 104 endif 105 libebl = ../libebl/libebl.a 106 libeu = ../lib/libeu.a 107 108 nm_no_Wformat = yes 109 size_no_Wformat = yes 110 strings_no_Wformat = yes 111 # XXX While the file is not finished, don't warn about this 112 ldgeneric_no_Wunused = yes 113 114 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 115 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 116 size_LDADD = $(libelf) $(libeu) $(libmudflap) 117 strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 118 ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 119 if NATIVE_LD 120 # -ldl is always needed for libebl. 121 ld_LDADD += libld_elf.a 122 endif 123 ld_LDFLAGS = -rdynamic 124 elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 125 findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) 126 addr2line_LDADD = $(libdw) $(libmudflap) 127 elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl 128 objdump_LDADD = $(libasm) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl 129 ranlib_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) 130 strings_LDADD = $(libelf) $(libeu) $(libmudflap) 131 ar_LDADD = libar.a $(libelf) $(libeu) $(libmudflap) 132 CFLAGS_ar = -DAR=\"$(shell echo ar|sed '$(transform)')\" 133 unstrip_LDADD = $(libebl) $(libelf) $(libdw) $(libeu) $(libmudflap) -ldl 134 135 ldlex.o: ldscript.c 136 ldlex_no_Werror = yes 137 ldscript.h: ldscript.c 138 139 if NATIVE_LD 140 # Machine-specific linker code. 141 libld_elf_a_SOURCES := $(base_cpu)_ld.c 142 else 143 libld_elf_i386_pic_a_SOURCES = 144 am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os 145 146 libld_elf_i386_so_SOURCES = 147 libld_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) 152 endif 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 170 installcheck-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 186 CLEANFILES += none_ld.os $(ld_modules:.c=.os) *.gcno *.gcda *.gconv 187 188 MAINTAINERCLEANFILES = ldlex.c ldscript.c ldscript.h 189 190 191 make-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