blob: 73c82dc681adbd695ee2a4159713141163d1ccd3 [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001## 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##
15DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) \
16 -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
17if MUDFLAP
Ulrich Drepper47be7952005-08-07 04:41:39 +000018AM_CFLAGS = -fmudflap
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000019else
Ulrich Drepper47be7952005-08-07 04:41:39 +000020AM_CFLAGS =
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000021endif
Ulrich Drepper47be7952005-08-07 04:41:39 +000022AM_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 McGrathce4550a2005-08-10 08:10:07 +000027INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl -I$(srcdir)/../lib -I$(srcdir)/../libdw -I..
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000028
29YACC = @YACC@ -d
30AM_YFLAGS = -pld
31AM_LFLAGS = -Pld -olex.yy.c
32## Uncomment to enable debugging of linker script parser
33##YYDEBUG = -DYYDEBUG=1
34
35native_ld = @native_ld@
36base_cpu = @base_cpu@
37
38bin_PROGRAMS = readelf nm size strip ld elflint findtextrel addr2line \
Ulrich Drepper8a687742005-08-03 02:24:12 +000039 elfcmp objdump
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000040
41
42ld_dsos = libld_elf_i386_pic.a
43if NATIVE_LD
44noinst_LIBRARIES = libld_elf.a
45native_ld_cflags = -DBASE_ELF_NAME=elf_$(base_cpu)
46else
47noinst_LIBRARIES = libld_elf.a $(ld_dsos)
48noinst_PROGRAMS = $(ld_dsos:_pic.a=.so)
49endif
50
51textrel_check = if readelf -d $@ | fgrep -q TEXTREL; then exit 1; fi
52
53
54ld_SOURCES = ld.c ldgeneric.c ldlex.l ldscript.y symbolhash.c sectionhash.c \
55 versionhash.c
56
57noinst_HEADERS = ld.h symbolhash.h sectionhash.h versionhash.h \
58 ldscript.h xelf.h unaligned.h
59
60EXTRA_DIST = elf32-i386.script libld_elf_i386.map $(ld_modules)
61ld_modules = i386_ld.c
62
63if MUDFLAP
Ulrich Drepper47be7952005-08-07 04:41:39 +000064libmudflap = -lmudflap
65endif
66
67if BUILD_STATIC
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000068libdw = ../libdw/libdw.a
69libelf = ../libelf/libelf.a
70else
71libdw = ../libdw/libdw.so
72libelf = ../libelf/libelf.so
73endif
74libebl = ../libebl/libebl.a
75libeu = ../lib/libeu.a
76
77nm_no_Wformat = yes
78size_no_Wformat = yes
79# XXX While the file is not finished, don't warn about this
80ldgeneric_no_Wunused = yes
81
82readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
83nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
84size_LDADD = $(libelf) $(libeu) $(libmudflap)
85strip_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
86ld_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
87if NATIVE_LD
88ld_LDADD += libld_elf.a
89endif
90ld_LDFLAGS = -rdynamic
91elflint_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
92findtextrel_LDADD = $(libdw) $(libelf) $(libmudflap)
Roland McGrathce4550a2005-08-10 08:10:07 +000093addr2line_LDADD = $(libdw) $(libelf) $(libmudflap)
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000094elfcmp_LDADD = $(libebl) $(libelf) $(libmudflap) -ldl
Ulrich Drepper8a687742005-08-03 02:24:12 +000095objdump_LDADD = $(libebl) $(libelf) $(libeu) $(libmudflap) -ldl
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000096
97ldlex.o: ldscript.c
98ldlex_no_Werror = yes
99ldscript.h: ldscript.c
100
101# Machine-specific linker code.
102libld_elf_a_SOURCES = $(base_cpu)_ld.c
103
104libld_elf_i386_pic_a_SOURCES =
105am_libld_elf_i386_pic_a_OBJECTS = i386_ld.os
106
107libld_elf_i386_so_SOURCES =
108libld_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
130installcheck-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
146CLEANFILES = none_ld.os $(ld_modules:.c=.os)