Fix group signature handling for relocatable link, add bootstrap
[platform/upstream/binutils.git] / gold / Makefile.am
1 # Process this file with automake to generate Makefile.in
2
3 AUTOMAKE_OPTIONS =
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)
12 AM_CXXFLAGS = $(WARN_CXXFLAGS) $(LFS_CFLAGS)
13
14 INCLUDES = \
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 THREADS
23 THREADSLIB = -lpthread
24 endif
25
26 AM_YFLAGS = -d
27
28 noinst_PROGRAMS = ld-new
29 noinst_LIBRARIES = libgold.a
30
31 CCFILES = \
32         archive.cc \
33         common.cc \
34         compressed_output.cc \
35         defstd.cc \
36         dirsearch.cc \
37         dynobj.cc \
38         dwarf_reader.cc \
39         ehframe.cc \
40         errors.cc \
41         expression.cc \
42         fileread.cc \
43         gold.cc \
44         gold-threads.cc \
45         layout.cc \
46         merge.cc \
47         object.cc \
48         options.cc \
49         output.cc \
50         parameters.cc \
51         readsyms.cc \
52         reloc.cc \
53         resolve.cc \
54         script-sections.cc \
55         script.cc \
56         stringpool.cc \
57         symtab.cc \
58         target-select.cc \
59         version.cc \
60         workqueue.cc \
61         workqueue-threads.cc
62
63 HFILES = \
64         archive.h \
65         common.h \
66         compressed_output.h \
67         defstd.h \
68         dirsearch.h \
69         dynobj.h \
70         dwarf_reader.h \
71         ehframe.h \
72         errors.h \
73         fileread.h \
74         gold.h \
75         gold-threads.h \
76         layout.h \
77         merge.h \
78         object.h \
79         options.h \
80         output.h \
81         parameters.h \
82         readsyms.h \
83         reloc.h \
84         reloc-types.h \
85         script-c.h \
86         script-sections.h \
87         script.h \
88         stringpool.h \
89         symtab.h \
90         target.h \
91         target-reloc.h \
92         target-select.h \
93         tls.h \
94         token.h \
95         workqueue.h \
96         workqueue-internal.h
97
98 YFILES = \
99         yyscript.y
100
101 EXTRA_DIST = yyscript.c yyscript.h
102
103 TARGETSOURCES = \
104         i386.cc x86_64.cc
105
106 ALL_TARGETOBJS = \
107         i386.$(OBJEXT) x86_64.$(OBJEXT)
108
109 libgold_a_SOURCES = $(CCFILES) $(HFILES) $(YFILES)
110
111 sources_var = main.cc
112 deps_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL_DEP)
113 ldadd_var = $(TARGETOBJS) libgold.a $(LIBIBERTY) $(LIBINTL) $(THREADSLIB)
114
115 ld_new_SOURCES = $(sources_var)
116 ld_new_DEPENDENCIES = $(deps_var) $(LIBOBJS)
117 ld_new_LDADD = $(ldadd_var) $(LIBOBJS)
118
119 EXTRA_ld_new_SOURCES = $(TARGETSOURCES)
120
121 # Use an explicit dependency for the bison generated header file.
122 expression.$(OBJEXT): yyscript.h
123 script-sections.$(OBJEXT): yyscript.h
124 script.$(OBJEXT): yyscript.h
125
126 # We have to build libgold.a before we run the tests.
127 check: libgold.a
128
129 .PHONY: install-exec-local
130
131 install-exec-local: ld-new$(EXEEXT)
132         $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(tooldir)/bin
133         n=`echo ld | sed '$(transform)'`; \
134         $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(bindir)/$${n}$(EXEEXT); \
135         if test "$(bindir)" != "$(tooldir)/bin"; then \
136           rm -f $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
137           ln $(DESTDIR)$(bindir)/$${n}$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT) >/dev/null 2>/dev/null \
138             || $(INSTALL_PROGRAM) ld-new$(EXEEXT) $(DESTDIR)$(tooldir)/bin/ld$(EXEEXT); \
139         fi
140
141 # We want install to imply install-info as per GNU standards, despite
142 # the cygnus option.
143 install-data-local: install-info
144
145 POTFILES= $(CCFILES) $(HFILES) $(TARGETSOURCES)
146
147 po/POTFILES.in: @MAINT@ Makefile
148         for f in $(POTFILES); do echo $$f; done | LC_COLLATE= sort > tmp \
149           && mv tmp $(srcdir)/po/POTFILES.in
150
151 # Bootstrap test support.  We use ld-new to build ld1, then use ld1 to
152 # build ld2.  ld1 and ld2 should be identical.  ld-new need not be
153 # identical to ld1, since it was linked with the host linker.
154
155 if GCC
156 if NATIVE_LINKER
157
158 gcctestdir1/ld: ld-new
159         test -d gcctestdir1 || mkdir -p gcctestdir1
160         rm -f gcctestdir1/ld
161         (cd gcctestdir1 && $(LN_S) ../ld-new ld)
162
163 ld1_SOURCES = $(sources_var)
164 ld1_DEPENDENCIES = $(deps_var) gcctestdir1/ld
165 ld1_LDADD = $(ldadd_var)
166 ld1_LDFLAGS = -Bgcctestdir1/
167
168 gcctestdir2/ld: ld1
169         test -d gcctestdir2 || mkdir -p gcctestdir2
170         rm -f gcctestdir2/ld
171         (cd gcctestdir2 && $(LN_S) ../ld1 ld)
172
173 ld2_SOURCES = $(sources_var)
174 ld2_DEPENDENCIES = $(deps_var) gcctestdir2/ld
175 ld2_LDADD = $(ldadd_var)
176 ld2_LDFLAGS = -Bgcctestdir2/
177
178 bootstrap-test: ld2
179         rm -f $@
180         echo "#!/bin/sh" > $@
181         echo "cmp ld1 ld2" > $@
182         chmod +x $@
183
184 libgold-1-r.o: gcctestdir1/ld libgold.a
185         gcctestdir1/ld -o $@ -r --whole-archive libgold.a
186
187 ld1_r_SOURCES = $(sources_var)
188 ld1_r_DEPENDENCIES = libgold-1-r.o $(deps_var) gcctestdir1/ld
189 ld1_r_LDADD = libgold-1-r.o $(ldadd_var)
190 ld1_r_LDFLAGS = -Bgcctestdir1/
191
192 gcctestdir2-r/ld: ld1-r
193         test -d gcctestdir2-r || mkdir -p gcctestdir2-r
194         rm -f gcctestdir2-r/ld
195         (cd gcctestdir2-r && $(LN_S) ../ld1-r ld)
196
197 libgold-2-r.o: gcctestdir2-r/ld libgold.a
198         gcctestdir2-r/ld -o $@ -r --whole-archive libgold.a
199
200 ld2_r_SOURCES = $(sources_var)
201 ld2_r_DEPENDENCIES = libgold-2-r.o $(deps_var) gcctestdir2-r/ld
202 ld2_r_LDADD = libgold-2-r.o $(ldadd_var)
203 ld2_r_LDFLAGS = -Bgcctestdir2-r/
204
205 bootstrap-test-r: ld2-r
206         rm -f $@
207         echo "#!/bin/sh" > $@
208         echo "cmp ld1-r ld2-r" > $@
209         chmod +x $@
210
211 check_PROGRAMS = ld1 ld2 ld1-r ld2-r
212 TESTS = bootstrap-test bootstrap-test-r
213
214 endif
215 endif