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