1 # Process this file with automake to generate Makefile.in
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 noinst_PROGRAMS = ld-new
33 noinst_LIBRARIES = libgold.a
39 compressed_output.cc \
64 reduced_debug_output.cc \
104 reduced_debug_output.h \
123 EXTRA_DIST = yyscript.c yyscript.h
126 i386.cc x86_64.cc sparc.cc powerpc.cc arm.cc
129 i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT) \
132 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
134 sources_var = main.cc
135 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
136 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
137 $(THREADSLIB) $(LIBDL)
139 ld_new_SOURCES = $(sources_var)
140 ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS)
141 ld_new_LDADD = $(ldadd_var) $(LIBOBJS)
143 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
145 # Use an explicit dependency for the bison generated header file.
146 expression.$(OBJEXT): yyscript.h
147 script-sections.$(OBJEXT): yyscript.h
148 script.$(OBJEXT): yyscript.h
150 # We have to build libgold.a before we run the tests.
153 .PHONY: install-exec-local
155 install-exec-local: ld-new$(EXEEXT)
156 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
157 n=`echo ld | sed '$(transform)'`; \
158 $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
159 if test "$(bindir)" != "$(tooldir)/bin"; then \
160 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
161 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
162 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
165 # We want install to imply install-info as per GNU standards, despite
167 install-data-local: install-info
169 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
171 po/POTFILES.in: @MAINT@ Makefile
172 for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
173 && mv tmp $(srcdir)/po/POTFILES.in
175 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
176 # build ld2. ld1 and ld2 should be identical. ld-new need not be
177 # identical to ld1, since it was linked with the host linker.
182 gcctestdir1/ld: ld-new
183 test -d gcctestdir1 || mkdir -p gcctestdir1
185 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
187 ld1_SOURCES = $(sources_var)
188 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
189 ld1_LDADD = $(ldadd_var)
190 ld1_LDFLAGS = -Bgcctestdir1/
193 test -d gcctestdir2 || mkdir -p gcctestdir2
195 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
197 ld2_SOURCES = $(sources_var)
198 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
199 ld2_LDADD = $(ldadd_var)
200 ld2_LDFLAGS = -Bgcctestdir2/
204 echo "#!/bin/sh" > $@
205 echo "cmp ld1 ld2" > $@
208 libgold-1-r.o: gcctestdir1/ld libgold.a
209 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
211 ld1_r_SOURCES = $(sources_var)
212 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
213 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
214 ld1_r_LDFLAGS = -Bgcctestdir1/
216 gcctestdir2-r/ld: ld1-r
217 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
218 rm -f gcctestdir2-r/ld
219 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
221 libgold-2-r.o: gcctestdir2-r/ld libgold.a
222 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
224 ld2_r_SOURCES = $(sources_var)
225 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
226 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
227 ld2_r_LDFLAGS = -Bgcctestdir2-r/
229 bootstrap-test-r: ld2-r
231 echo "#!/bin/sh" > $@
232 echo "cmp ld1-r ld2-r" > $@
235 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
236 TESTS = bootstrap-test bootstrap-test-r