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)
12 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_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
23 THREADSLIB = -lpthread
28 noinst_PROGRAMS = ld-new
29 noinst_LIBRARIES = libgold.a
35 compressed_output.cc \
103 EXTRA_DIST = yyscript.c yyscript.h
109 i386.$(OBJEXT) x86_64.$(OBJEXT)
111 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
113 sources_var = main.cc
114 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
115 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) $(THREADSLIB)
117 ld_new_SOURCES = $(sources_var)
118 ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS)
119 ld_new_LDADD = $(ldadd_var) $(LIBOBJS)
121 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
123 # Use an explicit dependency for the bison generated header file.
124 expression.$(OBJEXT): yyscript.h
125 script-sections.$(OBJEXT): yyscript.h
126 script.$(OBJEXT): yyscript.h
128 # We have to build libgold.a before we run the tests.
131 .PHONY: install-exec-local
133 install-exec-local: ld-new$(EXEEXT)
134 $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
135 n=`echo ld | sed '$(transform)'`; \
136 $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
137 if test "$(bindir)" != "$(tooldir)/bin"; then \
138 rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
139 ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
140 || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
143 # We want install to imply install-info as per GNU standards, despite
145 install-data-local: install-info
147 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
149 po/POTFILES.in: @MAINT@ Makefile
150 for f in $(POTFILES); do echo $$f; done | LC_COLLATE= sort > tmp \
151 && mv tmp $(srcdir)/po/POTFILES.in
153 # Bootstrap test support. We use ld-new to build ld1, then use ld1 to
154 # build ld2. ld1 and ld2 should be identical. ld-new need not be
155 # identical to ld1, since it was linked with the host linker.
160 gcctestdir1/ld: ld-new
161 test -d gcctestdir1 || mkdir -p gcctestdir1
163 (cd gcctestdir1 && $(LN_S) ../ld-new ld)
165 ld1_SOURCES = $(sources_var)
166 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
167 ld1_LDADD = $(ldadd_var)
168 ld1_LDFLAGS = -Bgcctestdir1/
171 test -d gcctestdir2 || mkdir -p gcctestdir2
173 (cd gcctestdir2 && $(LN_S) ../ld1 ld)
175 ld2_SOURCES = $(sources_var)
176 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
177 ld2_LDADD = $(ldadd_var)
178 ld2_LDFLAGS = -Bgcctestdir2/
182 echo "#!/bin/sh" > $@
183 echo "cmp ld1 ld2" > $@
186 libgold-1-r.o: gcctestdir1/ld libgold.a
187 gcctestdir1/ld -o $@ -r --whole-archive libgold.a
189 ld1_r_SOURCES = $(sources_var)
190 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
191 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
192 ld1_r_LDFLAGS = -Bgcctestdir1/
194 gcctestdir2-r/ld: ld1-r
195 test -d gcctestdir2-r || mkdir -p gcctestdir2-r
196 rm -f gcctestdir2-r/ld
197 (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
199 libgold-2-r.o: gcctestdir2-r/ld libgold.a
200 gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
202 ld2_r_SOURCES = $(sources_var)
203 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
204 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
205 ld2_r_LDFLAGS = -Bgcctestdir2-r/
207 bootstrap-test-r: ld2-r
209 echo "#!/bin/sh" > $@
210 echo "cmp ld1-r ld2-r" > $@
213 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
214 TESTS = bootstrap-test bootstrap-test-r