AArch64: Add optimized Q-register memcpy
[glibc.git] / Makefile
blob6dcfe40c25ebc265115cba0d8c1157b4bb52a57f
1 # Copyright (C) 1991-2020 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
4 # The GNU C Library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
9 # The GNU C Library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with the GNU C Library; if not, see
16 # <https://www.gnu.org/licenses/>.
19 # Master Makefile for the GNU C library
21 ifneq (,)
22 This makefile requires GNU Make.
23 endif
25 include Makeconfig
28 # This is the default target; it makes everything except the tests.
29 .PHONY: all help minihelp
30 all: minihelp lib others
32 help:
33 @sed '0,/^help-starts-here$$/d' Makefile.help
35 minihelp:
36 @echo
37 @echo type \"make help\" for help with common glibc makefile targets
38 @echo
41 ifneq ($(AUTOCONF),no)
43 define autoconf-it
44 @-rm -f $@.new
45 $(AUTOCONF) $(ACFLAGS) $< > $@.new
46 chmod a-w$(patsubst %,$(comma)a+x,$(filter .,$(@D))) $@.new
47 mv -f $@.new $@
48 endef
50 configure: configure.ac aclocal.m4; $(autoconf-it)
51 %/configure: %/configure.ac aclocal.m4; $(autoconf-it)
52 %/preconfigure: %/preconfigure.ac aclocal.m4; $(autoconf-it)
54 endif # $(AUTOCONF) = no
57 # We don't want to run anything here in parallel.
58 .NOTPARALLEL:
60 # These are the targets that are made by making them in each subdirectory.
61 +subdir_targets := subdir_lib objects objs others subdir_mostlyclean \
62 subdir_clean subdir_distclean subdir_realclean \
63 tests xtests \
64 subdir_update-abi subdir_check-abi \
65 subdir_update-all-abi \
66 subdir_echo-headers \
67 subdir_install \
68 subdir_objs subdir_stubs subdir_testclean \
69 $(addprefix install-, no-libc.a bin lib data headers others)
71 headers := limits.h values.h features.h gnu-versions.h \
72 bits/xopen_lim.h gnu/libc-version.h stdc-predef.h \
73 bits/libc-header-start.h
75 echo-headers: subdir_echo-headers
77 # The headers are in the include directory.
78 subdir-dirs = include
79 vpath %.h $(subdir-dirs)
81 # What to install.
82 install-others = $(inst_includedir)/gnu/stubs.h
83 install-bin-script =
85 ifeq (yes,$(build-shared))
86 headers += gnu/lib-names.h
87 endif
89 include Makerules
91 ifeq ($(build-programs),yes)
92 others: $(addprefix $(objpfx),$(install-bin-script))
93 endif
95 # Install from subdirectories too.
96 install: subdir_install
98 # Explicit dependency so that `make install-headers' works
99 install-headers: install-headers-nosubdir
101 # Make sure that the dynamic linker is installed before libc.
102 $(inst_slibdir)/libc-$(version).so: elf/ldso_install
104 .PHONY: elf/ldso_install
105 elf/ldso_install:
106 $(MAKE) -C $(@D) $(@F)
108 # Create links for shared libraries using the `ldconfig' program if possible.
109 # Ignore the error if we cannot update /etc/ld.so.cache.
110 ifeq (no,$(cross-compiling))
111 ifeq (yes,$(build-shared))
112 install: install-symbolic-link
113 .PHONY: install-symbolic-link
114 install-symbolic-link: subdir_install
115 $(symbolic-link-prog) $(symbolic-link-list)
116 rm -f $(symbolic-link-list)
118 install:
119 -test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
120 $(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
121 $(slibdir) $(libdir)
122 ifneq (no,$(PERL))
123 ifeq (/usr,$(prefix))
124 ifeq (,$(install_root))
125 LD_SO=$(ld.so-version) CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
126 endif
127 endif
128 endif
129 endif
130 endif
132 # Build subdirectory lib objects.
133 lib-noranlib: subdir_lib
135 ifeq (yes,$(build-shared))
136 # Build the shared object from the PIC object library.
137 lib: $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so
138 endif # $(build-shared)
140 # Used to build testrun.sh.
141 define testrun-script
142 #!/bin/bash
143 builddir=`dirname "$$0"`
144 GCONV_PATH="$${builddir}/iconvdata"
146 usage () {
147 echo "usage: $$0 [--tool=strace] PROGRAM [ARGUMENTS...]" 2>&1
148 echo " $$0 --tool=valgrind PROGRAM [ARGUMENTS...]" 2>&1
149 exit 1
152 toolname=default
153 while test $$# -gt 0 ; do
154 case "$$1" in
155 --tool=*)
156 toolname="$${1:7}"
157 shift
159 --*)
160 usage
163 break
165 esac
166 done
168 if test $$# -eq 0 ; then
169 usage
172 case "$$toolname" in
173 default)
174 exec $(subst $(common-objdir),"$${builddir}", $(test-program-prefix)) \
175 $${1+"$$@"}
177 strace)
178 exec strace $(patsubst %, -E%, $(run-program-env)) \
179 $(test-via-rtld-prefix) $${1+"$$@"}
181 valgrind)
182 exec env $(run-program-env) valgrind $(test-via-rtld-prefix) $${1+"$$@"}
184 container)
185 exec env $(run-program-env) $(test-via-rtld-prefix) \
186 $(common-objdir)/support/test-container \
187 env $(run-program-env) $(test-via-rtld-prefix) $${1+"$$@"}
190 usage
192 esac
193 endef
195 # This is a handy script for running any dynamically linked program against
196 # the current libc build for testing.
197 $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
198 $(..)Makeconfig $(..)Makefile
199 $(file >$@T,$(testrun-script))
200 chmod a+x $@T
201 mv -f $@T $@
202 postclean-generated += testrun.sh
204 define debugglibc
205 #!/bin/bash
207 SOURCE_DIR="$(CURDIR)"
208 BUILD_DIR="$(common-objpfx)"
209 CMD_FILE="$(common-objpfx)debugglibc.gdb"
210 CONTAINER=false
211 DIRECT=true
212 STATIC=false
213 SYMBOLSFILE=true
214 unset TESTCASE
215 unset BREAKPOINTS
216 unset ENVVARS
218 usage()
220 cat << EOF
221 Usage: $$0 [OPTIONS] <program>
223 Or: $$0 [OPTIONS] -- <program> [<args>]...
225 where <program> is the path to the program being tested,
226 and <args> are the arguments to be passed to it.
228 Options:
230 -h, --help
231 Prints this message and leaves.
233 The following options require one argument:
235 -b, --breakpoint
236 Breakpoints to set at the beginning of the execution
237 (each breakpoint demands its own -b option, e.g. -b foo -b bar)
238 -e, --environment-variable
239 Environment variables to be set with 'exec-wrapper env' in GDB
240 (each environment variable demands its own -e option, e.g.
241 -e FOO=foo -e BAR=bar)
243 The following options do not take arguments:
245 -c, --in-container
246 Run the test case inside a container and automatically attach
247 GDB to it.
248 -i, --no-direct
249 Selects whether to pass the --direct flag to the program.
250 --direct is useful when debugging glibc test cases. It inhibits the
251 tests from forking and executing in a subprocess.
252 Default behaviour is to pass the --direct flag, except when the
253 program is run with user specified arguments using the "--" separator.
254 -s, --no-symbols-file
255 Do not tell GDB to load debug symbols from the program.
259 # Parse input options
260 while [[ $$# > 0 ]]
262 key="$$1"
263 case $$key in
264 -h|--help)
265 usage
266 exit 0
268 -b|--breakpoint)
269 BREAKPOINTS="break $$2\n$$BREAKPOINTS"
270 shift
272 -e|--environment-variable)
273 ENVVARS="$$2 $$ENVVARS"
274 shift
276 -c|--in-container)
277 CONTAINER=true
279 -i|--no-direct)
280 DIRECT=false
282 -s|--no-symbols-file)
283 SYMBOLSFILE=false
286 shift
287 TESTCASE=$$1
288 COMMANDLINE="$$@"
289 # Don't add --direct when user specifies program arguments
290 DIRECT=false
291 break
294 TESTCASE=$$1
295 COMMANDLINE=$$TESTCASE
297 esac
298 shift
299 done
301 # Check for required argument and if the testcase exists
302 if [ ! -v TESTCASE ] || [ ! -f $${TESTCASE} ]
303 then
304 usage
305 exit 1
308 # Expand environment setup command
309 if [ -v ENVVARS ]
310 then
311 ENVVARSCMD="set exec-wrapper env $$ENVVARS"
314 # Expand direct argument
315 if [ "$$DIRECT" == true ]
316 then
317 DIRECT="--direct"
318 else
319 DIRECT=""
322 # Check if the test case is static
323 if file $${TESTCASE} | grep "statically linked" >/dev/null
324 then
325 STATIC=true
326 else
327 STATIC=false
330 # Expand symbols loading command
331 if [ "$$SYMBOLSFILE" == true ]
332 then
333 SYMBOLSFILE="add-symbol-file $${TESTCASE}"
334 else
335 SYMBOLSFILE=""
338 # GDB commands template
339 template ()
341 cat <<EOF
342 set environment C -E -x c-header
343 set auto-load safe-path $${BUILD_DIR}/nptl_db:\$$debugdir:\$$datadir/auto-load
344 set libthread-db-search-path $${BUILD_DIR}/nptl_db
345 __ENVVARS__
346 __SYMBOLSFILE__
347 break _dl_start_user
348 run --library-path $(rpath-link):$${BUILD_DIR}/nptl_db \
349 __COMMANDLINE__ __DIRECT__
350 __BREAKPOINTS__
354 # Generate the commands file for gdb initialization
355 template | sed \
356 -e "s|__ENVVARS__|$$ENVVARSCMD|" \
357 -e "s|__SYMBOLSFILE__|$$SYMBOLSFILE|" \
358 -e "s|__COMMANDLINE__|$$COMMANDLINE|" \
359 -e "s|__DIRECT__|$$DIRECT|" \
360 -e "s|__BREAKPOINTS__|$$BREAKPOINTS|" \
361 > $$CMD_FILE
363 echo
364 echo "Debugging glibc..."
365 echo "Build directory : $$BUILD_DIR"
366 echo "Source directory : $$SOURCE_DIR"
367 echo "GLIBC Testcase : $$TESTCASE"
368 echo "GDB Commands : $$CMD_FILE"
369 echo "Env vars : $$ENVVARS"
370 echo
372 if [ "$$CONTAINER" == true ]
373 then
374 # Use testrun.sh to start the test case with WAIT_FOR_DEBUGGER=1, then
375 # automatically attach GDB to it.
376 WAIT_FOR_DEBUGGER=1 $(common-objpfx)testrun.sh --tool=container $${TESTCASE} &
377 gdb -x $${TESTCASE}.gdb
378 elif [ "$$STATIC" == true ]
379 then
380 gdb $${TESTCASE}
381 else
382 # Start the test case debugging in two steps:
383 # 1. the following command invokes gdb to run the loader;
384 # 2. the commands file tells the loader to run the test case.
385 gdb -q \
386 -x $${CMD_FILE} \
387 -d $${SOURCE_DIR} \
388 $${BUILD_DIR}/elf/ld.so
390 endef
392 # This is another handy script for debugging dynamically linked program
393 # against the current libc build for testing.
394 $(common-objpfx)debugglibc.sh: $(common-objpfx)config.make \
395 $(..)Makeconfig $(..)Makefile
396 $(file >$@T,$(debugglibc))
397 chmod a+x $@T
398 mv -f $@T $@
399 postclean-generated += debugglibc.sh debugglibc.gdb
401 others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
403 # Makerules creates a file `stubs' in each subdirectory, which
404 # contains `#define __stub_FUNCTION' for each function defined in that
405 # directory which is a stub.
406 # Here we paste all of these together into <gnu/stubs.h>.
408 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
410 ifndef abi-variants
411 installed-stubs = $(inst_includedir)/gnu/stubs.h
412 else
413 installed-stubs = $(inst_includedir)/gnu/stubs-$(default-abi).h
415 $(inst_includedir)/gnu/stubs.h: $(+force)
416 $(make-target-directory)
418 echo '/* This file is automatically generated.';\
419 echo " This file selects the right generated file of \`__stub_FUNCTION' macros";\
420 echo ' based on the architecture being compiled for. */'; \
421 echo ''; \
422 $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
423 echo ''; \
424 $(foreach v,$(abi-variants),\
425 $(if $(abi-$(v)-condition),\
426 echo '#if $(abi-$(v)-condition)'; \
427 echo '# include <gnu/stubs-$(v).h>'); \
428 $(if $(abi-$(v)-condition),echo '#endif';) \
429 rm -f $(@:.d=.h).new$(v); \
431 } > $(@:.d=.h).new
432 mv -f $(@:.d=.h).new $(@:.d=.h)
434 install-others-nosubdir: $(installed-stubs)
435 endif
438 # Since stubs.h is never needed when building the library, we simplify the
439 # hairy installation process by producing it in place only as the last part
440 # of the top-level `make install'. It depends on subdir_install, which
441 # iterates over all the subdirs; subdir_install in each subdir depends on
442 # the subdir's stubs file. Having more direct dependencies would result in
443 # extra iterations over the list for subdirs and many recursive makes.
444 $(installed-stubs): include/stubs-prologue.h subdir_install
445 $(make-target-directory)
446 @rm -f $(objpfx)stubs.h
447 (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
448 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
449 then echo 'stubs.h unchanged'; \
450 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
451 rm -f $(objpfx)stubs.h
453 # This makes the Info or DVI file of the documentation from the Texinfo source.
454 .PHONY: info dvi pdf html
455 info dvi pdf html:
456 $(MAKE) $(PARALLELMFLAGS) -C manual $@
458 # This makes all the subdirectory targets.
460 # For each target, make it depend on DIR/target for each subdirectory DIR.
461 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
463 # Compute a list of all those targets.
464 all-subdirs-targets := $(foreach dir,$(subdirs),\
465 $(addprefix $(dir)/,$(+subdir_targets)))
467 # The action for each of those is to cd into the directory and make the
468 # target there.
469 $(all-subdirs-targets):
470 $(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F)
472 define subdir-target-args
473 subdir=$(@D)$(if $($(@D)-srcdir),\
474 -C $($(@D)-srcdir) ..=`pwd`/,\
475 -C $(@D) ..=../)
476 endef
478 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
480 # Targets to clean things up to various degrees.
482 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
483 tests-clean
485 # Subroutines of all cleaning targets.
486 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
487 -rm -f $(foreach o,$(object-suffixes-for-libc),\
488 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
489 $(addprefix $(objpfx),$(install-lib))
490 parent-clean: parent-mostlyclean common-clean
492 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
493 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
494 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
496 clean: parent-clean
497 # This is done this way rather than having `subdir_clean' be a
498 # dependency of this target so that libc.a will be removed before the
499 # subdirectories are dealt with and so they won't try to remove object
500 # files from it when it's going to be removed anyway.
501 @$(MAKE) subdir_clean no_deps=t
502 -rm -f $(postclean)
503 mostlyclean: parent-mostlyclean
504 @$(MAKE) subdir_mostlyclean no_deps=t
505 -rm -f $(postclean)
507 tests-clean:
508 @$(MAKE) subdir_testclean no_deps=t
510 ifneq (,$(CXX))
511 vpath c++-types.data $(+sysdep_dirs)
513 tests-special += $(objpfx)c++-types-check.out
514 $(objpfx)c++-types-check.out: c++-types.data scripts/check-c++-types.sh
515 scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu11 $(+gccwarn-c),$(CFLAGS)) $(CPPFLAGS) > $@; \
516 $(evaluate-test)
517 endif
519 tests-special += $(objpfx)check-local-headers.out
520 $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
521 AWK='$(AWK)' scripts/check-local-headers.sh \
522 "$(includedir)" "$(objpfx)" < /dev/null > $@; \
523 $(evaluate-test)
525 ifneq "$(headers)" ""
526 # Special test of all the installed headers in this directory.
527 tests-special += $(objpfx)check-installed-headers-c.out
528 libof-check-installed-headers-c := testsuite
529 $(objpfx)check-installed-headers-c.out: \
530 scripts/check-installed-headers.sh $(headers)
531 $(SHELL) $(..)scripts/check-installed-headers.sh c \
532 "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
533 $(headers) > $@; \
534 $(evaluate-test)
536 ifneq "$(CXX)" ""
537 tests-special += $(objpfx)check-installed-headers-cxx.out
538 libof-check-installed-headers-cxx := testsuite
539 $(objpfx)check-installed-headers-cxx.out: \
540 scripts/check-installed-headers.sh $(headers)
541 $(SHELL) $(..)scripts/check-installed-headers.sh c++ \
542 "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
543 $(headers) > $@; \
544 $(evaluate-test)
545 endif # $(CXX)
547 tests-special += $(objpfx)check-wrapper-headers.out
548 $(objpfx)check-wrapper-headers.out: scripts/check-wrapper-headers.py $(headers)
549 $(PYTHON) $< --root=. --subdir=. $(headers) \
550 --generated $(common-generated) > $@; $(evaluate-test)
551 endif # $(headers)
553 define summarize-tests
554 @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
555 @echo "Summary of test results$2:"
556 @sed 's/:.*//' < $(objpfx)$1 | sort | uniq -c
557 @! egrep -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(objpfx)$1
558 endef
560 # The intention here is to do ONE install of our build into the
561 # testroot.pristine/ directory, then rsync (internal to
562 # support/test-container) that to testroot.root/ at the start of each
563 # test. That way we can promise each test a "clean" install, without
564 # having to do the install for each test.
566 # In addition, we have to copy some files (which we build) into this
567 # root in addition to what glibc installs. For example, many tests
568 # require additional programs including /bin/sh, /bin/true, and
569 # /bin/echo, all of which we build below to limit library dependencies
570 # to just those things in glibc and language support libraries which
571 # we also copy into the into the rootfs. To determine what language
572 # support libraries we need we build a "test" program in either C or
573 # (if available) C++ just so we can copy in any shared objects
574 # (which we do not build) that GCC-compiled programs depend on.
577 ifeq (,$(CXX))
578 LINKS_DSO_PROGRAM = links-dso-program-c
579 else
580 LINKS_DSO_PROGRAM = links-dso-program
581 endif
583 $(tests-container) $(addsuffix /tests,$(subdirs)) : \
584 $(objpfx)testroot.pristine/install.stamp
585 $(objpfx)testroot.pristine/install.stamp :
586 test -d $(objpfx)testroot.pristine || \
587 mkdir $(objpfx)testroot.pristine
588 # We need a working /bin/sh for some of the tests.
589 test -d $(objpfx)testroot.pristine/bin || \
590 mkdir $(objpfx)testroot.pristine/bin
591 # We need the compiled locale dir for localedef tests.
592 test -d $(objpfx)testroot.pristine/$(complocaledir) || \
593 mkdir -p $(objpfx)testroot.pristine/$(complocaledir)
594 cp $(objpfx)support/shell-container $(objpfx)testroot.pristine/bin/sh
595 cp $(objpfx)support/echo-container $(objpfx)testroot.pristine/bin/echo
596 cp $(objpfx)support/true-container $(objpfx)testroot.pristine/bin/true
597 ifeq ($(run-built-tests),yes)
598 # Copy these DSOs first so we can overwrite them with our own.
599 for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 \
600 $(rtld-prefix) \
601 $(objpfx)testroot.pristine/bin/sh \
602 | sed -n '/\//{s@.*=> /@/@;s/^[^/]*//;s/ .*//p;}'` ;\
603 do \
604 test -d `dirname $(objpfx)testroot.pristine$$dso` || \
605 mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
606 $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
607 done
608 for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 \
609 $(rtld-prefix) \
610 $(objpfx)support/$(LINKS_DSO_PROGRAM) \
611 | sed -n '/\//{s@.*=> /@/@;s/^[^/]*//;s/ .*//p;}'` ;\
612 do \
613 test -d `dirname $(objpfx)testroot.pristine$$dso` || \
614 mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
615 $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
616 done
617 endif
618 # $(symbolic-link-list) is a file that encodes $(DESTDIR) so we
619 # have to purge it
620 rm -f $(symbolic-link-list)
621 # Setting INSTALL_UNCOMPRESSED causes localedata/Makefile to
622 # install the charmaps uncompressed, as the testroot does not
623 # provide a gunzip program.
624 $(MAKE) install DESTDIR=$(objpfx)testroot.pristine \
625 INSTALL_UNCOMPRESSED=yes subdirs='$(sorted-subdirs)'
626 rm -f $(symbolic-link-list)
627 touch $(objpfx)testroot.pristine/install.stamp
629 tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
630 tests: $(tests-special)
631 $(..)scripts/merge-test-results.sh -s $(objpfx) "" \
632 $(sort $(tests-special-notdir:.out=)) \
633 > $(objpfx)subdir-tests.sum
634 $(..)scripts/merge-test-results.sh -t $(objpfx) subdir-tests.sum \
635 $(sort $(subdirs) .) \
636 > $(objpfx)tests.sum
637 $(call summarize-tests,tests.sum)
638 xtests:
639 $(..)scripts/merge-test-results.sh -t $(objpfx) subdir-xtests.sum \
640 $(sort $(subdirs)) \
641 > $(objpfx)xtests.sum
642 $(call summarize-tests,xtests.sum, for extra tests)
644 # The realclean target is just like distclean for the parent, but we want
645 # the subdirs to know the difference in case they care.
646 realclean distclean: parent-clean
647 # This is done this way rather than having `subdir_distclean' be a
648 # dependency of this target so that libc.a will be removed before the
649 # subdirectories are dealt with and so they won't try to remove object
650 # files from it when it's going to be removed anyway.
651 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
652 sysdep-subdirs="$(sysdep-subdirs)"
653 -rm -f $(postclean)
655 # Subroutine of distclean and realclean.
656 distclean-1: subdir_$(distclean-1)
657 -rm -f $(config-generated)
658 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
659 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
660 ifdef objdir
661 -rm -f $(objpfx)Makefile
662 endif
663 -rm -f $(sysdep-$(distclean-1))
665 # Make the TAGS file for Emacs users.
667 .PHONY: TAGS
668 TAGS:
669 scripts/list-sources.sh | sed -n -e '/Makefile/p' \
670 $(foreach S,[chsSyl] cxx sh bash pl,\
671 $(subst .,\.,-e '/.$S\(.in\)*$$/p')) \
672 | $(ETAGS) -o $@ -
674 # Make the distribution tarfile.
675 .PHONY: dist dist-prepare
677 generated := $(generated) stubs.h
679 files-for-dist := README INSTALL configure NEWS
681 # Regenerate stuff, then error if these things are not committed yet.
682 dist-prepare: $(files-for-dist)
683 conf=`find sysdeps -name configure`; \
684 $(MAKE) $$conf && \
685 git diff --stat HEAD -- $^ $$conf \
686 | $(AWK) '{ print; rc=1 } END { exit rc }'
688 %.tar: FORCE
689 git archive --prefix=$*/ $* > $@.new
690 mv -f $@.new $@
692 # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
694 ifneq (,$(strip $(dist-version)))
695 dist: $(foreach Z,.bz2 .gz .xz,$(dist-version).tar$Z)
696 md5sum $^
697 else
698 dist: dist-prepare
699 @if v=`git describe`; then \
700 echo Distribution version $$v; \
701 $(MAKE) dist dist-version=$$v; \
702 else \
703 false; \
705 endif
707 INSTALL: manual/install-plain.texi manual/macros.texi \
708 $(common-objpfx)manual/pkgvers.texi manual/install.texi
709 makeinfo --no-validate --plaintext --no-number-sections \
710 -I$(common-objpfx)manual $< -o $@-tmp
711 $(AWK) 'NF == 0 { ++n; next } \
712 NF != 0 { while (n-- > 0) print ""; n = 0; print }' \
713 < $@-tmp > $@-tmp2
714 rm -f $@-tmp
715 -chmod a-w $@-tmp2
716 mv -f $@-tmp2 $@
717 $(common-objpfx)manual/%: FORCE
718 $(MAKE) $(PARALLELMFLAGS) -C manual $@
719 FORCE:
721 iconvdata/% localedata/% po/%: FORCE
722 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
724 # Convenience target to rerun one test, from the top of the build tree
725 # Example: make test t=wcsmbs/test-wcsnlen
726 .PHONY: test
727 test :
728 @-rm -f $(objpfx)$t.out
729 $(MAKE) subdir=$(patsubst %/,%,$(dir $t)) -C $(dir $t) ..=../ $(objpfx)$t.out
730 @cat $(objpfx)$t.test-result
731 @cat $(objpfx)$t.out