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