1 # Process this file with automake to generate Makefile.in
3 AUTOMAKE_OPTIONS = foreign
7 tooldir = $(exec_prefix)/$(target_alias)
9 ACLOCAL_AMFLAGS = -I ../bfd -I ../config
11 AM_CFLAGS = $(WARN_CFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS)
12 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS) $(RANDOM_SEED_CFLAGS)
15 -I$(srcdir) -I$(srcdir)/../include -I$(srcdir)/../elfcpp \
16 -DLOCALEDIR="\"$(datadir)/locale\"" \
17 -DBINDIR="\"$(bindir)\"" -DTOOLBINDIR="\"$(tooldir)/bin\"" \
20 LIBIBERTY = ../libiberty/libiberty.a
27 THREADSLIB = -lpthread
32 # Automake 1.10+ disables lex and yacc output file regeneration if
33 # maintainer mode is disabled. Avoid this.
37 noinst_PROGRAMS = ld-new incremental-dump
38 noinst_LIBRARIES = libgold.a
45 compressed_output.cc \
72 reduced_debug_output.cc \
116 reduced_debug_output.h \
135 EXTRA_DIST = yyscript.c yyscript.h
138 i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc
141 i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
144 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
145 libgold_a_LIBADD = $(LIBOBJS)
147 sources_var = main.cc
148 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
149 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
150 $(THREADSLIB) $(LIBDL)
152 ld_new_SOURCES = $(sources_var)
153 ld_new_DEPENDENCIES = $(deps_var)
154 ld_new_LDADD = $(ldadd_var)
156 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
158 incremental_dump_SOURCES = incremental-dump.cc
159 incremental_dump_DEPENDENCIES = $(TARGETOBJS) libgold.a $(LIBIBERTY) \
160 $(THREADSLIB) $(LIBDL)
161 incremental_dump_LDADD = $(TARGETOBJS) libgold.a $(LIBIBERTY) \
162 $(THREADSLIB) $(LIBDL)
164 # Use an explicit dependency for the bison generated header file.
165 expression.$(OBJEXT): yyscript.h
166 script-sections.$(OBJEXT): yyscript.h
167 script.$(OBJEXT): yyscript.h
169 # We have to build libgold.a before we run the tests.
172 .PHONY: install-exec-local
174 install-exec-local: ld-new$(EXEEXT)
175 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
176 n=`echo ld | sed '$(transform)'`; \
177 $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
178 if test "$(bindir)" != "$(tooldir)/bin"; then \
179 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
180 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
181 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
184 # We want install to imply install-info as per GNU standards, despite
186 install-data-local: install-info
188 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
190 po/POTFILES.in: @MAINT@ Makefile
191 for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
192 && mv tmp $(srcdir)/po/POTFILES.in
194 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
195 # build ld2. ld1 and ld2 should be identical. ld-new need not be
196 # identical to ld1, since it was linked with the host linker.
201 gcctestdir1/ld: ld-new
202 test -d gcctestdir1 || mkdir -p gcctestdir1
204 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
206 ld1_SOURCES = $(sources_var)
207 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
208 ld1_LDADD = $(ldadd_var)
209 ld1_LDFLAGS = -Bgcctestdir1/
212 test -d gcctestdir2 || mkdir -p gcctestdir2
214 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
216 ld2_SOURCES = $(sources_var)
217 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
218 ld2_LDADD = $(ldadd_var)
219 ld2_LDFLAGS = -Bgcctestdir2/
223 echo "#!/bin/sh" > $@
224 echo "cmp ld1 ld2" > $@
227 libgold-1-r.o: gcctestdir1/ld libgold.a
228 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
230 ld1_r_SOURCES = $(sources_var)
231 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
232 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
233 ld1_r_LDFLAGS = -Bgcctestdir1/
235 gcctestdir2-r/ld: ld1-r
236 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
237 rm -f gcctestdir2-r/ld
238 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
240 libgold-2-r.o: gcctestdir2-r/ld libgold.a
241 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
243 ld2_r_SOURCES = $(sources_var)
244 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
245 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
246 ld2_r_LDFLAGS = -Bgcctestdir2-r/
248 bootstrap-test-r: ld2-r
250 echo "#!/bin/sh" > $@
251 echo "cmp ld1-r ld2-r" > $@
254 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
255 TESTS = bootstrap-test bootstrap-test-r