Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame^] | 1 | ## Process this file with automake to create Makefile.in |
| 2 | ## |
| 3 | ## Copyright (C) 1996-2002, 2003, 2004, 2005 Red Hat, Inc. |
| 4 | ## |
| 5 | ## This program is Open Source software; you can redistribute it and/or |
| 6 | ## modify it under the terms of the Open Software License version 1.0 as |
| 7 | ## published by the Open Source Initiative. |
| 8 | ## |
| 9 | ## You should have received a copy of the Open Software License along |
| 10 | ## with this program; if not, you may obtain a copy of the Open Software |
| 11 | ## License version 1.0 from http://www.opensource.org/licenses/osl.php or |
| 12 | ## by writing the Open Source Initiative c/o Lawrence Rosen, Esq., |
| 13 | ## 3001 King Ranch Road, Ukiah, CA 95482. |
| 14 | ## |
| 15 | DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) \ |
| 16 | -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\" |
| 17 | if MUDFLAP |
| 18 | AM_CFLAGS = -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fmudflap \ |
| 19 | $(native_ld_cflags) $(if $($(*F)_no_Wunused),,-Wunused) \ |
| 20 | $(if $($(*F)_no_Wformat),,-Wformat=2) |
| 21 | else |
| 22 | AM_CFLAGS = -Wall -Wshadow -std=gnu99 $(native_ld_cflags) \ |
| 23 | $(if $($(*F)_no_Werror),,-Werror) \ |
| 24 | $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \ |
| 25 | $(if $($(*F)_no_Wformat),,-Wformat=2) |
| 26 | endif |
| 27 | if MUDFLAP |
| 28 | libmudflap = -lmudflap |
| 29 | endif |
| 30 | INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl -I$(srcdir)/../lib -I$(srcdir)/../libdw -I.. |
| 31 | |
| 32 | YACC = @YACC@ -d |
| 33 | AM_YFLAGS = -pld |
| 34 | AM_LFLAGS = -Pld -olex.yy.c |
| 35 | ## Uncomment to enable debugging of linker script parser |
| 36 | ##YYDEBUG = -DYYDEBUG=1 |
| 37 | |
| 38 | native_ld = @native_ld@ |
| 39 | base_cpu = @base_cpu@ |
| 40 | |
| 41 | bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \ |
| 42 | elfcmp |
| 43 | |
| 44 | |
| 45 | ld_dsos = libld_elf_i386_pic.a |
| 46 | if NATIVE_LD |
| 47 | noinst_LIBRARIES = libld_elf.a |
| 48 | native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) |
| 49 | else |
| 50 | noinst_LIBRARIES = libld_elf.a $(ld_dsos) |
| 51 | noinst_PROGRAMS = $(ld_dsos:_pic.a=.so) |
| 52 | endif |
| 53 | |
| 54 | textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi |
| 55 | |
| 56 | |
| 57 | ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ |
| 58 | versionhash.c |
| 59 | |
| 60 | noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ |
| 61 | ldscript.h xelf.h unaligned.h |
| 62 | |
| 63 | EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) |
| 64 | ld_modules = i386_ld.c |
| 65 | |
| 66 | if MUDFLAP |
| 67 | libdw = ../libdw/libdw.a |
| 68 | libelf = ../libelf/libelf.a |
| 69 | else |
| 70 | libdw = ../libdw/libdw.so |
| 71 | libelf = ../libelf/libelf.so |
| 72 | endif |
| 73 | libebl = ../libebl/libebl.a |
| 74 | libeu = ../lib/libeu.a |
| 75 | |
| 76 | nm_no_Wformat = yes |
| 77 | size_no_Wformat = yes |
| 78 | # XXX While the file is not finished, don't warn about this |
| 79 | ldgeneric_no_Wunused = yes |
| 80 | |
| 81 | readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 82 | nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 83 | size_LDADD = $(libelf) $(libeu) $(libmudflap) |
| 84 | strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 85 | ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 86 | if NATIVE_LD |
| 87 | ld_LDADD += libld_elf.a |
| 88 | endif |
| 89 | ld_LDFLAGS = -rdynamic |
| 90 | elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 91 | findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) |
| 92 | addr2line_LDADD = $(libdw) $(libelf) $(libmudflap) |
| 93 | elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl |
| 94 | |
| 95 | ldlex.o: ldscript.c |
| 96 | ldlex_no_Werror = yes |
| 97 | ldscript.h: ldscript.c |
| 98 | |
| 99 | # Machine-specific linker code. |
| 100 | libld_elf_a_SOURCES = $(base_cpu)_ld.c |
| 101 | |
| 102 | libld_elf_i386_pic_a_SOURCES = |
| 103 | am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os |
| 104 | |
| 105 | libld_elf_i386_so_SOURCES = |
| 106 | libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map |
| 107 | $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ |
| 108 | $(libelf) $(libeu) \ |
| 109 | -Wl,--version-script,$(srcdir)/libld_elf_i386.map |
| 110 | $(textrel_check) |
| 111 | |
| 112 | |
| 113 | %.os: %.c %.o |
| 114 | if $(filter-out -fmudflap,$(COMPILE)) -c -o $@ -fpic -DPIC -DSHARED \ |
| 115 | -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ |
| 116 | `test -f '$<' || echo '$(srcdir)/'`$<; \ |
| 117 | then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ |
| 118 | rm -f "$(DEPDIR)/$*.Tpo"; \ |
| 119 | else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ |
| 120 | fi |
| 121 | |
| 122 | # Special rule to make it possible to define libld_elf_a_SOURCES as we do. |
| 123 | # Otherwise make would complain. |
| 124 | .deps/none_ld.Po: none_ld.os |
| 125 | -: |
| 126 | |
| 127 | |
| 128 | installcheck-binPROGRAMS: $(bin_PROGRAMS) |
| 129 | bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ |
| 130 | case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ |
| 131 | *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ |
| 132 | esac; \ |
| 133 | f=`echo "$$p" | \ |
| 134 | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ |
| 135 | for opt in --help --version; do \ |
| 136 | if LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \ |
| 137 | $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ |
| 138 | && test -n "`cat c$${pid}_.out`" \ |
| 139 | && test -z "`cat c$${pid}_.err`"; then :; \ |
| 140 | else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ |
| 141 | done; \ |
| 142 | done; rm -f c$${pid}_.???; exit $$bad |
| 143 | |
| 144 | CLEANFILES = none_ld.os $(ld_modules:.c=.os) |