]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gold/Makefile.am
2009-06-23 Doug Kwan <dougkwan@google.com>
[thirdparty/binutils-gdb.git] / gold / Makefile.am
1 # Process this file with automake to generate Makefile.in
2
3 AUTOMAKE_OPTIONS =
4
5 SUBDIRS = po testsuite
6
7 tooldir = $(exec_prefix)/$(target_alias)
8
9 ACLOCAL_AMFLAGS = -I ../bfd -I ../config
10
11 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS)
12 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS)
13
14 INCLUDES = \
15 -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
16 -DLOCALEDIR="\"$(datadir)/locale\"" \
17 -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \
18 @INCINTL@
19
20 LIBIBERTY = ../libiberty/libiberty.a
21
22 if PLUGINS
23 LIBDL = -ldl
24 endif
25
26 if THREADS
27 THREADSLIB = -lpthread
28 endif
29
30 AM_YFLAGS = -d
31
32 noinst_PROGRAMS = ld-new
33 noinst_LIBRARIES = libgold.a
34
35 CCFILES = \
36 archive.cc \
37 binary.cc \
38 common.cc \
39 compressed_output.cc \
40 copy-relocs.cc \
41 cref.cc \
42 defstd.cc \
43 descriptors.cc \
44 dirsearch.cc \
45 dynobj.cc \
46 dwarf_reader.cc \
47 ehframe.cc \
48 errors.cc \
49 expression.cc \
50 fileread.cc \
51 gc.cc \
52 gold.cc \
53 gold-threads.cc \
54 incremental.cc \
55 layout.cc \
56 mapfile.cc \
57 merge.cc \
58 object.cc \
59 options.cc \
60 output.cc \
61 parameters.cc \
62 plugin.cc \
63 readsyms.cc \
64 reduced_debug_output.cc \
65 reloc.cc \
66 resolve.cc \
67 script-sections.cc \
68 script.cc \
69 stringpool.cc \
70 symtab.cc \
71 target.cc \
72 target-select.cc \
73 version.cc \
74 workqueue.cc \
75 workqueue-threads.cc
76
77 HFILES = \
78 archive.h \
79 binary.h \
80 common.h \
81 compressed_output.h \
82 copy-relocs.h \
83 cref.h \
84 defstd.h \
85 dirsearch.h \
86 descriptors.h \
87 dynobj.h \
88 dwarf_reader.h \
89 ehframe.h \
90 errors.h \
91 fileread.h \
92 freebsd.h \
93 gc.h \
94 gold.h \
95 gold-threads.h \
96 layout.h \
97 mapfile.h \
98 merge.h \
99 object.h \
100 options.h \
101 output.h \
102 parameters.h \
103 plugin.h \
104 readsyms.h \
105 reduced_debug_output.h \
106 reloc.h \
107 reloc-types.h \
108 script-c.h \
109 script-sections.h \
110 script.h \
111 stringpool.h \
112 symtab.h \
113 target.h \
114 target-reloc.h \
115 target-select.h \
116 tls.h \
117 token.h \
118 workqueue.h \
119 workqueue-internal.h
120
121 YFILES = \
122 yyscript.y
123
124 EXTRA_DIST = yyscript.c yyscript.h
125
126 TARGETSOURCES = \
127 i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc
128
129 ALL_TARGETOBJS = \
130 i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
131 arm.$(OBJEXT)
132
133 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
134 libgold_a_LIBADD = $(LIBOBJS)
135
136 sources_var = main.cc
137 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
138 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
139 $(THREADSLIB) $(LIBDL)
140
141 ld_new_SOURCES = $(sources_var)
142 ld_new_DEPENDENCIES = $(deps_var)
143 ld_new_LDADD = $(ldadd_var)
144
145 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
146
147 # Use an explicit dependency for the bison generated header file.
148 expression.$(OBJEXT): yyscript.h
149 script-sections.$(OBJEXT): yyscript.h
150 script.$(OBJEXT): yyscript.h
151
152 # We have to build libgold.a before we run the tests.
153 check: libgold.a
154
155 .PHONY: install-exec-local
156
157 install-exec-local: ld-new$(EXEEXT)
158 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
159 n=`echo ld | sed '$(transform)'`; \
160 $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
161 if test "$(bindir)" != "$(tooldir)/bin"; then \
162 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
163 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
164 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
165 fi
166
167 # We want install to imply install-info as per GNU standards, despite
168 # the cygnus option.
169 install-data-local: install-info
170
171 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
172
173 po/POTFILES.in: @MAINT@ Makefile
174 for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
175 && mv tmp $(srcdir)/po/POTFILES.in
176
177 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
178 # build ld2. ld1 and ld2 should be identical. ld-new need not be
179 # identical to ld1, since it was linked with the host linker.
180
181 if GCC
182 if NATIVE_LINKER
183
184 gcctestdir1/ld: ld-new
185 test -d gcctestdir1 || mkdir -p gcctestdir1
186 rm -f gcctestdir1/ld
187 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
188
189 ld1_SOURCES = $(sources_var)
190 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
191 ld1_LDADD = $(ldadd_var)
192 ld1_LDFLAGS = -Bgcctestdir1/
193
194 gcctestdir2/ld: ld1
195 test -d gcctestdir2 || mkdir -p gcctestdir2
196 rm -f gcctestdir2/ld
197 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
198
199 ld2_SOURCES = $(sources_var)
200 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
201 ld2_LDADD = $(ldadd_var)
202 ld2_LDFLAGS = -Bgcctestdir2/
203
204 bootstrap-test: ld2
205 rm -f $@
206 echo "#!/bin/sh" > $@
207 echo "cmp ld1 ld2" > $@
208 chmod +x $@
209
210 libgold-1-r.o: gcctestdir1/ld libgold.a
211 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
212
213 ld1_r_SOURCES = $(sources_var)
214 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
215 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
216 ld1_r_LDFLAGS = -Bgcctestdir1/
217
218 gcctestdir2-r/ld: ld1-r
219 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
220 rm -f gcctestdir2-r/ld
221 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
222
223 libgold-2-r.o: gcctestdir2-r/ld libgold.a
224 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
225
226 ld2_r_SOURCES = $(sources_var)
227 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
228 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
229 ld2_r_LDFLAGS = -Bgcctestdir2-r/
230
231 bootstrap-test-r: ld2-r
232 rm -f $@
233 echo "#!/bin/sh" > $@
234 echo "cmp ld1-r ld2-r" > $@
235 chmod +x $@
236
237 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
238 TESTS = bootstrap-test bootstrap-test-r
239
240 endif
241 endif