]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gold/Makefile.am
2009-01-20 Sriraman Tallam <tmsriram@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 layout.cc \
55 mapfile.cc \
56 merge.cc \
57 object.cc \
58 options.cc \
59 output.cc \
60 parameters.cc \
61 plugin.cc \
62 readsyms.cc \
63 reduced_debug_output.cc \
64 reloc.cc \
65 resolve.cc \
66 script-sections.cc \
67 script.cc \
68 stringpool.cc \
69 symtab.cc \
70 target-select.cc \
71 version.cc \
72 workqueue.cc \
73 workqueue-threads.cc
74
75 HFILES = \
76 archive.h \
77 binary.h \
78 common.h \
79 compressed_output.h \
80 copy-relocs.h \
81 cref.h \
82 defstd.h \
83 dirsearch.h \
84 descriptors.h \
85 dynobj.h \
86 dwarf_reader.h \
87 ehframe.h \
88 errors.h \
89 fileread.h \
90 gc.h \
91 gold.h \
92 gold-threads.h \
93 layout.h \
94 mapfile.h \
95 merge.h \
96 object.h \
97 options.h \
98 output.h \
99 parameters.h \
100 plugin.h \
101 readsyms.h \
102 reduced_debug_output.h \
103 reloc.h \
104 reloc-types.h \
105 script-c.h \
106 script-sections.h \
107 script.h \
108 stringpool.h \
109 symtab.h \
110 target.h \
111 target-reloc.h \
112 target-select.h \
113 tls.h \
114 token.h \
115 workqueue.h \
116 workqueue-internal.h
117
118 YFILES = \
119 yyscript.y
120
121 EXTRA_DIST = yyscript.c yyscript.h
122
123 TARGETSOURCES = \
124 i386.cc x86_64.cc sparc.cc powerpc.cc
125
126 ALL_TARGETOBJS = \
127 i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT)
128
129 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
130
131 sources_var = main.cc
132 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
133 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
134 $(THREADSLIB) $(LIBDL)
135
136 ld_new_SOURCES = $(sources_var)
137 ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS)
138 ld_new_LDADD = $(ldadd_var) $(LIBOBJS)
139
140 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
141
142 # Use an explicit dependency for the bison generated header file.
143 expression.$(OBJEXT): yyscript.h
144 script-sections.$(OBJEXT): yyscript.h
145 script.$(OBJEXT): yyscript.h
146
147 # We have to build libgold.a before we run the tests.
148 check: libgold.a
149
150 .PHONY: install-exec-local
151
152 install-exec-local: ld-new$(EXEEXT)
153 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
154 n=`echo ld | sed '$(transform)'`; \
155 $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
156 if test "$(bindir)" != "$(tooldir)/bin"; then \
157 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
158 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
159 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
160 fi
161
162 # We want install to imply install-info as per GNU standards, despite
163 # the cygnus option.
164 install-data-local: install-info
165
166 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
167
168 po/POTFILES.in: @MAINT@ Makefile
169 for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
170 && mv tmp $(srcdir)/po/POTFILES.in
171
172 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
173 # build ld2. ld1 and ld2 should be identical. ld-new need not be
174 # identical to ld1, since it was linked with the host linker.
175
176 if GCC
177 if NATIVE_LINKER
178
179 gcctestdir1/ld: ld-new
180 test -d gcctestdir1 || mkdir -p gcctestdir1
181 rm -f gcctestdir1/ld
182 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
183
184 ld1_SOURCES = $(sources_var)
185 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
186 ld1_LDADD = $(ldadd_var)
187 ld1_LDFLAGS = -Bgcctestdir1/
188
189 gcctestdir2/ld: ld1
190 test -d gcctestdir2 || mkdir -p gcctestdir2
191 rm -f gcctestdir2/ld
192 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
193
194 ld2_SOURCES = $(sources_var)
195 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
196 ld2_LDADD = $(ldadd_var)
197 ld2_LDFLAGS = -Bgcctestdir2/
198
199 bootstrap-test: ld2
200 rm -f $@
201 echo "#!/bin/sh" > $@
202 echo "cmp ld1 ld2" > $@
203 chmod +x $@
204
205 libgold-1-r.o: gcctestdir1/ld libgold.a
206 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
207
208 ld1_r_SOURCES = $(sources_var)
209 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
210 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
211 ld1_r_LDFLAGS = -Bgcctestdir1/
212
213 gcctestdir2-r/ld: ld1-r
214 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
215 rm -f gcctestdir2-r/ld
216 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
217
218 libgold-2-r.o: gcctestdir2-r/ld libgold.a
219 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
220
221 ld2_r_SOURCES = $(sources_var)
222 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
223 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
224 ld2_r_LDFLAGS = -Bgcctestdir2-r/
225
226 bootstrap-test-r: ld2-r
227 rm -f $@
228 echo "#!/bin/sh" > $@
229 echo "cmp ld1-r ld2-r" > $@
230 chmod +x $@
231
232 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
233 TESTS = bootstrap-test bootstrap-test-r
234
235 endif
236 endif