1 ## Process this file with automake to generate Makefile.in
3 AUTOMAKE_OPTIONS = dejagnu
4 ACLOCAL_AMFLAGS = -I . -I .. -I ../config
6 # Variables that will accumulate in subdirs.
17 # The newlib hardware floating-point routines have been disabled due to
18 # inaccuracy. If you wish to work on them, you will need to edit the
19 # configure.in file to re-enable the configuration option. By default,
20 # the NEWLIB_HW_FP variable will always be false.
27 # Work around what appears to be a GNU make bug handling MAKEFLAGS
28 # values defined in terms of make variables, as is the case for CC and
29 # friends when we are called from the top level Makefile.
31 "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
33 "CCASFLAGS=$(CCASFLAGS)" \
34 "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
35 "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
36 "INSTALL=$(INSTALL)" \
37 "LDFLAGS=$(LDFLAGS)" \
38 "LIBCFLAGS=$(LIBCFLAGS)" \
39 "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
41 "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
42 "PICFLAG=$(PICFLAG)" \
43 "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
46 "RUNTEST=$(RUNTEST)" \
47 "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
48 "exec_prefix=$(exec_prefix)" \
49 "infodir=$(infodir)" \
52 "tooldir=$(tooldir)" \
53 "top_toollibdir=$(toollibdir)" \
56 "CC=$(CC_FOR_NEWLIB)" \
58 "LIBCFLAGS=$(LIBCFLAGS)" \
60 "PICFLAG=$(PICFLAG)" \
64 FLAGS_TO_PASS=$(AM_MAKEFLAGS)
66 srcroot = $(top_srcdir)/..
67 tooldir = $(exec_prefix)/$(host_alias)
68 toollibdir = $(tooldir)/lib$(MULTISUBDIR)
70 # These are useful for standalone object files like crt0.o.
71 AM_CFLAGS = $(AM_CFLAGS_$(subst /,_,$(@D))) $(AM_CFLAGS_$(subst /,_,$(@D)_$(<F)))
72 AM_CCASFLAGS = $(AM_CCASFLAGS_$(subst /,_,$(@D))) $(AM_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
73 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS) $(AM_CPPFLAGS_$(subst /,_,$(@D))) $(AM_CPPFLAGS_$(subst /,_,$(@D)_$(<F))) -idirafter $(srcroot)/include
75 toollib_LIBRARIES = libm.a \
79 BUILD_MULTISUBDIR = $(builddir)$(MULTISUBDIR)
81 noinst_DATA += $(BUILD_MULTISUBDIR)/$(CRT0)
83 noinst_DATA += $(BUILD_MULTISUBDIR)/libc.a $(BUILD_MULTISUBDIR)/libm.a
86 toollib_DATA = $(CRT0) $(CRT1)
90 ## GNU ar has undocumented behavior when specifying the same name multiple times
91 ## in a single invocation, so we have to dedupe ourselves. The algorithm here:
92 ## - Generates the set of unique objects based on the basename.
93 ## - Favors objects later in the list (since machine objects come last).
94 ## - Outputs object list in same order as input for reproducibility.
95 ## https://sourceware.org/PR28917
96 AWK_UNIQUE_OBJS = $(AWK) '{ \
97 for (i = NF; i > 0; --i) { \
98 count = split($$i, parts, "/"); \
99 name = parts[count]; \
100 if (!(name in seen)) { \
109 # Recursive Wildcard function
110 rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2)$(filter $(subst *,%,$2),$d))
112 # The functions ldexp, frexp and modf are traditionally supplied in
113 # both libc.a and libm.a. We build them in libm.a and copy them over,
114 # along with some required supporting routines.
116 libm_a-s_fpclassify.o libm_a-sf_fpclassify.o \
117 libm_a-s_isinf.o libm_a-sf_isinf.o \
118 libm_a-s_isnan.o libm_a-sf_isnan.o \
119 libm_a-s_isinfd.o libm_a-sf_isinff.o \
120 libm_a-s_isnand.o libm_a-sf_isnanf.o \
121 libm_a-s_nan.o libm_a-sf_nan.o \
122 libm_a-s_ldexp.o libm_a-sf_ldexp.o \
123 libm_a-s_frexp.o libm_a-sf_frexp.o libm_a-frexpl.o \
125 libm_a-sf_modf.o libm_a-s_scalbn.o \
127 libm_a-s_finite.o libm_a-sf_finite.o \
128 libm_a-s_copysign.o libm_a-sf_copysign.o
130 ## Place the libm_a objects in libc/ to keep the top dir tidy.
131 stamp-libc-math-objects: libm.a
132 $(AM_V_GEN)cd libc && $(AR) x ../$< $(MATHOBJS_IN_LIBC)
135 CLEANFILES += $(MATHOBJS_IN_LIBC)
138 libc_a_CFLAGS = $(AM_CFLAGS) $(libc_a_CFLAGS_$(subst /,_,$(@D))) $(libc_a_CFLAGS_$(subst /,_,$(@D)_$(<F)))
139 libc_a_CCASFLAGS = $(AM_CCASFLAGS) $(libc_a_CCASFLAGS_$(subst /,_,$(@D))) $(libc_a_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
140 libc_a_CPPFLAGS = $(AM_CPPFLAGS) $(libc_a_CPPFLAGS_$(subst /,_,$(@D))) $(libc_a_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
141 libc_a_DEPENDENCIES = stamp-libc-math-objects
142 ## Best to avoid libc_a_LIBADD entirely to avoid having 2 independent lists
143 ## with separate overriding behavior (libc_a_OBJECTS is the other). See the
144 ## AWK_UNIQUE_OBJS comment aove for more details.
145 $(libc_a_OBJECTS) $(libc_a_LIBADD): stmp-targ-include
147 libc.a: $(libc_a_OBJECTS) $(libc_a_DEPENDENCIES)
149 $(AM_V_AR)objs=`echo $(libc_a_OBJECTS) | $(AWK_UNIQUE_OBJS)` || exit $$?; \
150 $(AR) $(ARFLAGS) $@ $$objs $(MATHOBJS_IN_LIBC:%=libc/%)
151 $(AM_V_at)$(RANLIB) $@
154 $(AM_V_GEN)ln libc.a libg.a >/dev/null 2>/dev/null || cp libc.a libg.a
157 libm_a_CFLAGS = $(AM_CFLAGS) $(libm_a_CFLAGS_$(subst /,_,$(@D))) $(libm_a_CFLAGS_$(subst /,_,$(@D)_$(<F)))
158 libm_a_CCASFLAGS = $(AM_CCASFLAGS) $(libm_a_CCASFLAGS_$(subst /,_,$(@D))) $(libm_a_CCASFLAGS_$(subst /,_,$(@D)_$(<F)))
159 libm_a_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libm/common $(libm_a_CPPFLAGS_$(subst /,_,$(@D))) $(libm_a_CPPFLAGS_$(subst /,_,$(@D)_$(<F)))
160 ## Best to avoid libm_a_LIBADD entirely to avoid having 2 independent lists
161 ## with separate overriding behavior (libm_a_OBJECTS is the other). See the
162 ## AWK_UNIQUE_OBJS comment aove for more details.
163 $(libm_a_OBJECTS): stmp-targ-include
165 libm.a: $(libm_a_OBJECTS) $(libm_a_DEPENDENCIES)
167 $(AM_V_AR)objs=`echo $(libm_a_OBJECTS) | $(AWK_UNIQUE_OBJS)` || exit $$?; \
168 $(AR) $(ARFLAGS) $@ $$objs
169 $(AM_V_at)$(RANLIB) $@
172 $(BUILD_MULTISUBDIR):
173 $(AM_V_at)$(MKDIR_P) $@
175 $(BUILD_MULTISUBDIR)/crt0.o: $(CRT0_DIR)$(CRT0) $(BUILD_MULTISUBDIR)
177 $(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
179 $(BUILD_MULTISUBDIR)/libc.a: libc.a $(BUILD_MULTISUBDIR)
181 $(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
183 $(BUILD_MULTISUBDIR)/libg.a: libg.a ${BUILD_MULTISUBDIR}
185 $(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
187 $(BUILD_MULTISUBDIR)/libm.a: libm.a $(BUILD_MULTISUBDIR)
189 $(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
192 crt0.o: $(CRT0_DIR)$(CRT0)
194 $(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
196 $(CRT0_DIR)$(CRT0): stmp-targ-include
198 crt1.o: $(CRT1_DIR)$(CRT1)
200 $(AM_V_GEN)ln $< $@ >/dev/null 2>/dev/null || cp $< $@
202 $(CRT1_DIR)$(CRT1): stmp-targ-include
205 $(AM_V_GEN)$(MKDIR_P) $@
207 targ-include/newlib.h: targ-include/_newlib_version.h
209 targ-include/sys targ-include/machine targ-include/bits: targ-include/_newlib_version.h targ-include/newlib.h
210 $(AM_V_GEN)$(MKDIR_P) $@
212 targ-include/newlib.h: newlib.h targ-include
213 $(AM_V_GEN)cp newlib.h $@
215 targ-include/_newlib_version.h: _newlib_version.h targ-include
216 $(AM_V_GEN)cp _newlib_version.h $@
218 # The targ-include directory just holds the includes files for the
219 # particular system and machine we have been configured for. It is
220 # used while building.
221 TARG_INCLUDE_CP_DIR = \
222 ; srcdir="$(srcdir)/libc/$$s"; dstdir="targ-include/$$d"; \
223 if (cd $$srcdir 2>/dev/null && [ "`echo *.h`" != "*.h" ]); then cp $$srcdir/*.h $$dstdir/; fi
224 stmp-targ-include: config.status
225 $(AM_V_GEN)rm -rf targ-include stmp-targ-include
226 $(AM_V_at)$(MAKE) targ-include/sys \
227 targ-include/machine \
229 $(AM_V_at)if [ -n "$(shared_machine_dir)" ]; then \
230 s=machine/$(shared_machine_dir)/machine d=machine $(TARG_INCLUDE_CP_DIR) || exit $$?; \
231 s=machine/$(shared_machine_dir)/sys d=sys $(TARG_INCLUDE_CP_DIR) || exit $$?; \
232 s=machine/$(shared_machine_dir)/include d= $(TARG_INCLUDE_CP_DIR) || exit $$?; \
234 $(AM_V_at)s=machine/$(machine_dir)/machine d=machine $(TARG_INCLUDE_CP_DIR)
235 $(AM_V_at)s=machine/$(machine_dir)/sys d=sys $(TARG_INCLUDE_CP_DIR)
236 $(AM_V_at)s=machine/$(machine_dir)/include d= $(TARG_INCLUDE_CP_DIR)
237 $(AM_V_at)s=sys/$(sys_dir)/include d= $(TARG_INCLUDE_CP_DIR)
238 $(AM_V_at)for i in $(call rwildcard,$(srcdir)/libc/sys/$(sys_dir)/include/,*.h); do \
239 f=`echo $$i | sed s:^$(srcdir)/libc/sys/$(sys_dir)/include/::`; \
240 $(MKDIR_P) targ-include/`dirname $$f`; \
241 cp $$i targ-include/$$f; \
243 $(AM_V_at)s=sys/$(sys_dir)/sys d=sys $(TARG_INCLUDE_CP_DIR)
244 $(AM_V_at)s=sys/$(sys_dir)/bits d=bits $(TARG_INCLUDE_CP_DIR)
245 $(AM_V_at)s=sys/$(sys_dir)/machine d=machine $(TARG_INCLUDE_CP_DIR)
246 $(AM_V_at)s=sys/$(sys_dir)/machine/$(machine_dir) d=machine $(TARG_INCLUDE_CP_DIR)
247 $(AM_V_at)s=sys/$(sys_dir)/machine/$(machine_dir)/include d=machine $(TARG_INCLUDE_CP_DIR)
248 $(AM_V_at)$(MAKE) targ-include/newlib.h
251 CLEANFILES += stmp-targ-include
253 ## We hook install-multi because this Makefile doesn't have any exec targets,
254 ## only data targets. If that ever changes, this should be removed and the
255 ## install-exec-local in ../multilib.am will kick in.
256 install-data-local: install-toollibLIBRARIES install-multi $(INSTALL_DATA_LOCAL)
257 rm -f $(DESTDIR)$(toollibdir)/libg.a
258 ln $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a >/dev/null 2>/dev/null || cp $(DESTDIR)$(toollibdir)/libc.a $(DESTDIR)$(toollibdir)/libg.a
259 -if [ -z "$(MULTISUBDIR)" ]; then \
260 $(mkinstalldirs) $(DESTDIR)$(tooldir)/include; \
261 for i in $(srcdir)/libc/include/*.h; do \
262 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \
264 $(INSTALL_DATA) newlib.h $(DESTDIR)$(tooldir)/include/newlib.h; \
265 $(INSTALL_DATA) _newlib_version.h $(DESTDIR)$(tooldir)/include/_newlib_version.h; \
266 $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/machine; \
267 for i in $(srcdir)/libc/include/machine/*.h; do \
268 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
270 if [ -n "$(shared_machine_dir)" ]; then \
271 for i in $(srcdir)/libc/machine/$(shared_machine_dir)/machine/*.h; do \
272 if [ -f $$i ]; then \
273 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
277 for i in $(srcdir)/libc/machine/$(machine_dir)/machine/*.h; do \
278 if [ -f $$i ]; then \
279 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
282 $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/rpc; \
283 for i in $(srcdir)/libc/include/rpc/*.h; do \
284 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \
286 $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/ssp; \
287 for i in $(srcdir)/libc/include/ssp/*.h; do \
288 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/ssp/`basename $$i`; \
290 $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/sys; \
291 for i in $(srcdir)/libc/include/sys/*.h; do \
292 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
294 if [ -n "$(shared_machine_dir)" ]; then \
295 for i in $(srcdir)/libc/machine/$(shared_machine_dir)/sys/*.h; do \
296 if [ -f $$i ]; then \
297 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
300 for i in $(srcdir)/libc/machine/$(shared_machine_dir)/include/*.h; do \
301 if [ -f $$i ]; then \
302 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \
306 for i in $(srcdir)/libc/machine/$(machine_dir)/sys/*.h; do \
307 if [ -f $$i ]; then \
308 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
311 for i in $(srcdir)/libc/machine/$(machine_dir)/include/*.h; do \
312 if [ -f $$i ]; then \
313 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/`basename $$i`; \
316 for i in $(srcdir)/libc/sys/$(sys_dir)/sys/*.h; do \
317 if [ -f $$i ]; then \
318 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \
321 $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/bits; \
322 for i in $(srcdir)/libc/sys/$(sys_dir)/bits/*.h; do \
323 if [ -f $$i ]; then \
324 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/bits/`basename $$i`; \
327 for i in $(srcdir)/libc/sys/$(sys_dir)/machine/*.h; do \
328 if [ -f $$i ]; then \
329 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
332 for i in $(call rwildcard,$(srcdir)/libc/sys/$(sys_dir)/include/,*.h); do \
333 f=`echo $$i | sed s:^$(srcdir)/libc/sys/$(sys_dir)/::`; \
334 $(MKDIR_P) $(DESTDIR)$(tooldir)/`dirname $$f`; \
335 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/`dirname $$f`; \
337 for i in $(srcdir)/libc/sys/$(sys_dir)/machine/$(machine_dir)/include/*.h; do \
338 if [ -f $$i ]; then \
339 $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/machine/`basename $$i`; \
342 for i in $(NO_INCLUDE_LIST); do \
343 if [ -f $(DESTDIR)$(tooldir)/include/$$i ]; then \
344 rm $(DESTDIR)$(tooldir)/include/$$i; \
349 # Generate Unicode data tables for libc/string/wcwidth and libc/ctype/??w*
351 cd $(srcdir)/libc/string; ./mkunidata -u
352 cd $(srcdir)/libc/ctype; ./mkunidata -u
354 # Force makedoc to be built before building info files.
355 info-recursive dvi-recursive: doc/makedoc$(EXEEXT_FOR_BUILD)
357 CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host
359 include ../multilib.am
362 $(MULTIDO) $(AM_MAKEFLAGS) DO=check multi-do # $(MAKE)
371 @echo 'Making a new site.exp file...'
372 @test ! -f site.bak || rm -f site.bak
373 @echo '## these variables are automatically generated by make ##' > $@-t
374 @echo '# Do not edit here. If you wish to override these values' >> $@-t
375 @echo '# edit the last section' >> $@-t
376 @echo 'set tool $(DEJATOOL)' >> $@-t
377 @echo 'set tool_version $(VERSION)' >> $@-t
378 @echo 'set srcdir $(srcdir)/testsuite' >> $@-t
379 @echo 'set objdir' `pwd` >> $@-t
380 @echo 'set tmpdir' `pwd`/testsuite >> $@-t
381 @echo 'set multibuildtop ./$(MULTIBUILDTOP)' >> $@-t
382 @echo 'set host_alias $(build_alias)' >> $@-t
383 @echo 'set host_triplet $(build_triplet)' >> $@-t
384 @echo 'set target_alias $(host_alias)' >> $@-t
385 @echo 'set target_triplet $(host_triplet)' >> $@-t
386 @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
387 @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
388 @test ! -f site.exp || mv site.exp site.bak
391 check-DEJAGNU: site.exp
392 @if [ -d testsuite ] ; then \
397 @rm -f testsuite/site.exp
398 @cp site.exp testsuite/site.exp
401 srcdir=`cd ${srcdir}; pwd` ; \
403 EXPECT=`if [ -f $${rootme}/${MULTIBUILDTOP}../../expect/expect ] ; then \
404 echo $${rootme}/${MULTIBUILDTOP}../../expect/expect ; \
409 echo "Found expect: $${EXPECT}" ; \
410 if [ -f $(top_builddir)/$(MULTIBUILDTOP)../../expect/expect ] ; then \
411 TCL_LIBRARY=`cd $(top_srcdir)/../tcl/library && pwd` ; \
412 export TCL_LIBRARY ; \
413 echo "Found TCL library directory: $${TCL_LIBRARY}" ; \
415 RUNTEST=`if [ -f $${srcdir}/../dejagnu/runtest ] ; then \
416 echo $${srcdir}/../dejagnu/runtest ; \
421 echo "Found runtest: $${RUNTEST}" ; \
423 if $(SHELL) -c "$$RUNTEST --version" > /dev/null 2>&1 ; then \
424 $$RUNTEST --tool $(DEJATOOL) --srcdir $${srcdir}/testsuite $(RUNTESTFLAGS) ; \
427 echo "WARNING: could not find \`runtest'" 1>&2 ; \
431 -rm -rf targ-include newlib.h _newlib_version.h stamp-*
433 # Workaround bad automake/texinfo interactions.
434 # https://bugs.gnu.org/23599
435 TEXI2DVI = texi2dvi -E
437 TEXINFO_TEX = ../texinfo/texinfo.tex
439 XMLTO_MAN_QUIET_=--stringparam man.output.quietly=1
440 XMLTO_MAN_QUIET=$(XMLTO_MAN_QUIET_$(V))
443 include doc/Makefile.inc
445 include libc/Makefile.inc
446 include libm/Makefile.inc