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 \
103 reduced_debug_output.h \
122 EXTRA_DIST = yyscript.c yyscript.h
125 i386.cc x86_64.cc sparc.cc powerpc.cc
128 i386.$(OBJEXT) x86_64.$(OBJEXT) sparc.$(OBJEXT) powerpc.$(OBJEXT)
130 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
132 sources_var = main.cc
133 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
134 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) \
135 $(THREADSLIB) $(LIBDL)
137 ld_new_SOURCES = $(sources_var)
138 ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS)
139 ld_new_LDADD = $(ldadd_var) $(LIBOBJS)
141 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
143 # Use an explicit dependency for the bison generated header file.
144 expression.$(OBJEXT): yyscript.h
145 script-sections.$(OBJEXT): yyscript.h
146 script.$(OBJEXT): yyscript.h
148 # We have to build libgold.a before we run the tests.
151 .PHONY: install-exec-local
153 install-exec-local: ld-new$(EXEEXT)
154 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
155 n=`echo ld | sed '$(transform)'`; \
156 $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
157 if test "$(bindir)" != "$(tooldir)/bin"; then \
158 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
159 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
160 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
163 # We want install to imply install-info as per GNU standards, despite
165 install-data-local: install-info
167 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
169 po/POTFILES.in: @MAINT@ Makefile
170 for f in $(POTFILES); do echo $$f; done | LC_ALL=C sort > tmp \
171 && mv tmp $(srcdir)/po/POTFILES.in
173 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
174 # build ld2. ld1 and ld2 should be identical. ld-new need not be
175 # identical to ld1, since it was linked with the host linker.
180 gcctestdir1/ld: ld-new
181 test -d gcctestdir1 || mkdir -p gcctestdir1
183 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
185 ld1_SOURCES = $(sources_var)
186 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
187 ld1_LDADD = $(ldadd_var)
188 ld1_LDFLAGS = -Bgcctestdir1/
191 test -d gcctestdir2 || mkdir -p gcctestdir2
193 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
195 ld2_SOURCES = $(sources_var)
196 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
197 ld2_LDADD = $(ldadd_var)
198 ld2_LDFLAGS = -Bgcctestdir2/
202 echo "#!/bin/sh" > $@
203 echo "cmp ld1 ld2" > $@
206 libgold-1-r.o: gcctestdir1/ld libgold.a
207 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
209 ld1_r_SOURCES = $(sources_var)
210 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
211 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
212 ld1_r_LDFLAGS = -Bgcctestdir1/
214 gcctestdir2-r/ld: ld1-r
215 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
216 rm -f gcctestdir2-r/ld
217 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
219 libgold-2-r.o: gcctestdir2-r/ld libgold.a
220 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
222 ld2_r_SOURCES = $(sources_var)
223 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
224 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
225 ld2_r_LDFLAGS = -Bgcctestdir2-r/
227 bootstrap-test-r: ld2-r
229 echo "#!/bin/sh" > $@
230 echo "cmp ld1-r ld2-r" > $@
233 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
234 TESTS = bootstrap-test bootstrap-test-r