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 |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 18 | AM_CFLAGS = -fmudflap |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 19 | else |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 20 | AM_CFLAGS = |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 21 | endif |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 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 | |
Roland McGrath | ce4550a | 2005-08-10 08:10:07 +0000 | [diff] [blame] | 27 | INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl -I$(srcdir)/../lib -I$(srcdir)/../libdw -I.. |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 28 | |
| 29 | YACC = @YACC@ -d |
| 30 | AM_YFLAGS = -pld |
| 31 | AM_LFLAGS = -Pld -olex.yy.c |
| 32 | ## Uncomment to enable debugging of linker script parser |
| 33 | ##YYDEBUG = -DYYDEBUG=1 |
| 34 | |
| 35 | native_ld = @native_ld@ |
| 36 | base_cpu = @base_cpu@ |
| 37 | |
| 38 | bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \ |
Ulrich Drepper | 8a68774 | 2005-08-03 02:24:12 +0000 | [diff] [blame] | 39 | elfcmp objdump |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 40 | |
| 41 | |
| 42 | ld_dsos = libld_elf_i386_pic.a |
| 43 | if NATIVE_LD |
| 44 | noinst_LIBRARIES = libld_elf.a |
| 45 | native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu) |
| 46 | else |
| 47 | noinst_LIBRARIES = libld_elf.a $(ld_dsos) |
| 48 | noinst_PROGRAMS = $(ld_dsos:_pic.a=.so) |
| 49 | endif |
| 50 | |
| 51 | textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi |
| 52 | |
| 53 | |
| 54 | ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \ |
| 55 | versionhash.c |
| 56 | |
| 57 | noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \ |
| 58 | ldscript.h xelf.h unaligned.h |
| 59 | |
| 60 | EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules) |
| 61 | ld_modules = i386_ld.c |
| 62 | |
| 63 | if MUDFLAP |
Ulrich Drepper | 47be795 | 2005-08-07 04:41:39 +0000 | [diff] [blame] | 64 | libmudflap = -lmudflap |
| 65 | endif |
| 66 | |
| 67 | if BUILD_STATIC |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 68 | libdw = ../libdw/libdw.a |
| 69 | libelf = ../libelf/libelf.a |
| 70 | else |
| 71 | libdw = ../libdw/libdw.so |
| 72 | libelf = ../libelf/libelf.so |
| 73 | endif |
| 74 | libebl = ../libebl/libebl.a |
| 75 | libeu = ../lib/libeu.a |
| 76 | |
| 77 | nm_no_Wformat = yes |
| 78 | size_no_Wformat = yes |
| 79 | # XXX While the file is not finished, don't warn about this |
| 80 | ldgeneric_no_Wunused = yes |
| 81 | |
| 82 | readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 83 | nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 84 | size_LDADD = $(libelf) $(libeu) $(libmudflap) |
| 85 | strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 86 | ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 87 | if NATIVE_LD |
| 88 | ld_LDADD += libld_elf.a |
| 89 | endif |
| 90 | ld_LDFLAGS = -rdynamic |
| 91 | elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
| 92 | findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap) |
Roland McGrath | ce4550a | 2005-08-10 08:10:07 +0000 | [diff] [blame] | 93 | addr2line_LDADD = $(libdw) $(libelf) $(libmudflap) |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 94 | elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl |
Ulrich Drepper | 8a68774 | 2005-08-03 02:24:12 +0000 | [diff] [blame] | 95 | objdump_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl |
Ulrich Drepper | b08d5a8 | 2005-07-26 05:00:05 +0000 | [diff] [blame] | 96 | |
| 97 | ldlex.o: ldscript.c |
| 98 | ldlex_no_Werror = yes |
| 99 | ldscript.h: ldscript.c |
| 100 | |
| 101 | # Machine-specific linker code. |
| 102 | libld_elf_a_SOURCES = $(base_cpu)_ld.c |
| 103 | |
| 104 | libld_elf_i386_pic_a_SOURCES = |
| 105 | am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os |
| 106 | |
| 107 | libld_elf_i386_so_SOURCES = |
| 108 | libld_elf_i386.so: libld_elf_i386_pic.a libld_elf_i386.map |
| 109 | $(CC) -shared -o $@ -Wl,--whole-archive,$<,--no-whole-archive \ |
| 110 | $(libelf) $(libeu) \ |
| 111 | -Wl,--version-script,$(srcdir)/libld_elf_i386.map |
| 112 | $(textrel_check) |
| 113 | |
| 114 | |
| 115 | %.os: %.c %.o |
| 116 | if $(filter-out -fmudflap,$(COMPILE)) -c -o $@ -fpic -DPIC -DSHARED \ |
| 117 | -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \ |
| 118 | `test -f '$<' || echo '$(srcdir)/'`$<; \ |
| 119 | then cat "$(DEPDIR)/$*.Tpo" >> "$(DEPDIR)/$*.Po"; \ |
| 120 | rm -f "$(DEPDIR)/$*.Tpo"; \ |
| 121 | else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \ |
| 122 | fi |
| 123 | |
| 124 | # Special rule to make it possible to define libld_elf_a_SOURCES as we do. |
| 125 | # Otherwise make would complain. |
| 126 | .deps/none_ld.Po: none_ld.os |
| 127 | -: |
| 128 | |
| 129 | |
| 130 | installcheck-binPROGRAMS: $(bin_PROGRAMS) |
| 131 | bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \ |
| 132 | case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \ |
| 133 | *" $$p "* | *" $(srcdir)/$$p "*) continue;; \ |
| 134 | esac; \ |
| 135 | f=`echo "$$p" | \ |
| 136 | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ |
| 137 | for opt in --help --version; do \ |
| 138 | if LD_LIBRARY_PATH=$(DESTDIR)$(libdir) \ |
| 139 | $(DESTDIR)$(bindir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ |
| 140 | && test -n "`cat c$${pid}_.out`" \ |
| 141 | && test -z "`cat c$${pid}_.err`"; then :; \ |
| 142 | else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ |
| 143 | done; \ |
| 144 | done; rm -f c$${pid}_.???; exit $$bad |
| 145 | |
| 146 | CLEANFILES = none_ld.os $(ld_modules:.c=.os) |