Update ChangeLog.old/ChangeLog.23.
[glibc.git] / Makefile
blobf98d5a9e6737897aa649511dd3ecfbd6da7772d0
1 # Copyright (C) 1991-2021 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 features-time64.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:
113 -test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
114 $(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
115 $(slibdir) $(libdir)
116 ifneq (no,$(PERL))
117 ifeq (/usr,$(prefix))
118 ifeq (,$(install_root))
119 LD_SO=$(ld.so-version) CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
120 endif
121 endif
122 endif
123 endif
124 endif
126 # Build subdirectory lib objects.
127 lib-noranlib: subdir_lib
129 ifeq (yes,$(build-shared))
130 # Build the shared object from the PIC object library.
131 lib: $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so
132 endif # $(build-shared)
134 # Used to build testrun.sh.
135 define testrun-script
136 #!/bin/bash
137 builddir=`dirname "$$0"`
138 GCONV_PATH="$${builddir}/iconvdata"
140 usage () {
141 cat << EOF
142 Usage: $$0 [OPTIONS] <program> [ARGUMENTS...]
144 --tool=TOOL Run with the specified TOOL. It can be strace, valgrind or
145 container. The container will run within support/test-container.
148 exit 1
151 toolname=default
152 while test $$# -gt 0 ; do
153 case "$$1" in
154 --tool=*)
155 toolname="$${1:7}"
156 shift
158 --*)
159 usage
162 break
164 esac
165 done
167 if test $$# -eq 0 ; then
168 usage
171 case "$$toolname" in
172 default)
173 exec $(subst $(common-objdir),"$${builddir}", $(test-program-prefix)) \
174 $${1+"$$@"}
176 strace)
177 exec strace $(patsubst %, -E%, $(run-program-env)) \
178 $(test-via-rtld-prefix) $${1+"$$@"}
180 valgrind)
181 exec env $(run-program-env) valgrind $(test-via-rtld-prefix) $${1+"$$@"}
183 container)
184 exec env $(run-program-env) $(test-via-rtld-prefix) \
185 $(common-objdir)/support/test-container \
186 env $(run-program-env) $(test-via-rtld-prefix) $${1+"$$@"}
189 usage
191 esac
192 endef
194 # This is a handy script for running any dynamically linked program against
195 # the current libc build for testing.
196 $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
197 $(..)Makeconfig $(..)Makefile
198 $(file >$@T,$(testrun-script))
199 chmod a+x $@T
200 mv -f $@T $@
201 postclean-generated += testrun.sh
203 define debugglibc
204 #!/bin/bash
206 SOURCE_DIR="$(CURDIR)"
207 BUILD_DIR="$(common-objpfx)"
208 CMD_FILE="$(common-objpfx)debugglibc.gdb"
209 CONTAINER=false
210 DIRECT=true
211 STATIC=false
212 SYMBOLSFILE=true
213 unset TESTCASE
214 unset BREAKPOINTS
215 unset ENVVARS
217 usage()
219 cat << EOF
220 Usage: $$0 [OPTIONS] <program>
222 Or: $$0 [OPTIONS] -- <program> [<args>]...
224 where <program> is the path to the program being tested,
225 and <args> are the arguments to be passed to it.
227 Options:
229 -h, --help
230 Prints this message and leaves.
232 The following options require one argument:
234 -b, --breakpoint
235 Breakpoints to set at the beginning of the execution
236 (each breakpoint demands its own -b option, e.g. -b foo -b bar)
237 -e, --environment-variable
238 Environment variables to be set with 'exec-wrapper env' in GDB
239 (each environment variable demands its own -e option, e.g.
240 -e FOO=foo -e BAR=bar)
242 The following options do not take arguments:
244 -c, --in-container
245 Run the test case inside a container and automatically attach
246 GDB to it.
247 -i, --no-direct
248 Selects whether to pass the --direct flag to the program.
249 --direct is useful when debugging glibc test cases. It inhibits the
250 tests from forking and executing in a subprocess.
251 Default behaviour is to pass the --direct flag, except when the
252 program is run with user specified arguments using the "--" separator.
253 -s, --no-symbols-file
254 Do not tell GDB to load debug symbols from the program.
258 # Parse input options
259 while [[ $$# > 0 ]]
261 key="$$1"
262 case $$key in
263 -h|--help)
264 usage
265 exit 0
267 -b|--breakpoint)
268 BREAKPOINTS="break $$2\n$$BREAKPOINTS"
269 shift
271 -e|--environment-variable)
272 ENVVARS="$$2 $$ENVVARS"
273 shift
275 -c|--in-container)
276 CONTAINER=true
278 -i|--no-direct)
279 DIRECT=false
281 -s|--no-symbols-file)
282 SYMBOLSFILE=false
285 shift
286 TESTCASE=$$1
287 COMMANDLINE="$$@"
288 # Don't add --direct when user specifies program arguments
289 DIRECT=false
290 break
293 TESTCASE=$$1
294 COMMANDLINE=$$TESTCASE
296 esac
297 shift
298 done
300 # Check for required argument and if the testcase exists
301 if [ ! -v TESTCASE ] || [ ! -f $${TESTCASE} ]
302 then
303 usage
304 exit 1
307 # Container tests needing locale data should install them in-container.
308 # Other tests/binaries need to use locale data from the build tree.
309 if [ "$$CONTAINER" = false ]
310 then
311 ENVVARS="GCONV_PATH=$${BUILD_DIR}/iconvdata $$ENVVARS"
312 ENVVARS="LOCPATH=$${BUILD_DIR}/localedata $$ENVVARS"
313 ENVVARS="LC_ALL=C $$ENVVARS"
316 # Expand environment setup command
317 if [ -v ENVVARS ]
318 then
319 ENVVARSCMD="set exec-wrapper env $$ENVVARS"
322 # Expand direct argument
323 if [ "$$DIRECT" == true ]
324 then
325 DIRECT="--direct"
326 else
327 DIRECT=""
330 # Check if the test case is static
331 if file $${TESTCASE} | grep "statically linked" >/dev/null
332 then
333 STATIC=true
334 else
335 STATIC=false
338 # Expand symbols loading command
339 if [ "$$SYMBOLSFILE" == true ]
340 then
341 SYMBOLSFILE="add-symbol-file $${TESTCASE}"
342 else
343 SYMBOLSFILE=""
346 # GDB commands template
347 template ()
349 cat <<EOF
350 set environment C -E -x c-header
351 set auto-load safe-path $${BUILD_DIR}/nptl_db:\$$debugdir:\$$datadir/auto-load
352 set libthread-db-search-path $${BUILD_DIR}/nptl_db
353 __ENVVARS__
354 __SYMBOLSFILE__
355 break _dl_start_user
356 run --library-path $(rpath-link):$${BUILD_DIR}/nptl_db \
357 __COMMANDLINE__ __DIRECT__
358 __BREAKPOINTS__
362 # Generate the commands file for gdb initialization
363 template | sed \
364 -e "s|__ENVVARS__|$$ENVVARSCMD|" \
365 -e "s|__SYMBOLSFILE__|$$SYMBOLSFILE|" \
366 -e "s|__COMMANDLINE__|$$COMMANDLINE|" \
367 -e "s|__DIRECT__|$$DIRECT|" \
368 -e "s|__BREAKPOINTS__|$$BREAKPOINTS|" \
369 > $$CMD_FILE
371 echo
372 echo "Debugging glibc..."
373 echo "Build directory : $$BUILD_DIR"
374 echo "Source directory : $$SOURCE_DIR"
375 echo "GLIBC Testcase : $$TESTCASE"
376 echo "GDB Commands : $$CMD_FILE"
377 echo "Env vars : $$ENVVARS"
378 echo
380 if [ "$$CONTAINER" == true ]
381 then
382 # Use testrun.sh to start the test case with WAIT_FOR_DEBUGGER=1, then
383 # automatically attach GDB to it.
384 WAIT_FOR_DEBUGGER=1 $(common-objpfx)testrun.sh --tool=container $${TESTCASE} &
385 gdb -x $${TESTCASE}.gdb
386 elif [ "$$STATIC" == true ]
387 then
388 gdb $${TESTCASE}
389 else
390 # Start the test case debugging in two steps:
391 # 1. the following command invokes gdb to run the loader;
392 # 2. the commands file tells the loader to run the test case.
393 gdb -q \
394 -x $${CMD_FILE} \
395 -d $${SOURCE_DIR} \
396 $${BUILD_DIR}/elf/ld.so
398 endef
400 # This is another handy script for debugging dynamically linked program
401 # against the current libc build for testing.
402 $(common-objpfx)debugglibc.sh: $(common-objpfx)config.make \
403 $(..)Makeconfig $(..)Makefile
404 $(file >$@T,$(debugglibc))
405 chmod a+x $@T
406 mv -f $@T $@
407 postclean-generated += debugglibc.sh debugglibc.gdb
409 others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
411 # Makerules creates a file `stubs' in each subdirectory, which
412 # contains `#define __stub_FUNCTION' for each function defined in that
413 # directory which is a stub.
414 # Here we paste all of these together into <gnu/stubs.h>.
416 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
418 ifndef abi-variants
419 installed-stubs = $(inst_includedir)/gnu/stubs.h
420 else
421 installed-stubs = $(inst_includedir)/gnu/stubs-$(default-abi).h
423 $(inst_includedir)/gnu/stubs.h: $(+force)
424 $(make-target-directory)
426 echo '/* This file is automatically generated.';\
427 echo " This file selects the right generated file of \`__stub_FUNCTION' macros";\
428 echo ' based on the architecture being compiled for. */'; \
429 echo ''; \
430 $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
431 echo ''; \
432 $(foreach v,$(abi-variants),\
433 $(if $(abi-$(v)-condition),\
434 echo '#if $(abi-$(v)-condition)'; \
435 echo '# include <gnu/stubs-$(v).h>'); \
436 $(if $(abi-$(v)-condition),echo '#endif';) \
437 rm -f $(@:.d=.h).new$(v); \
439 } > $(@:.d=.h).new
440 mv -f $(@:.d=.h).new $(@:.d=.h)
442 install-others-nosubdir: $(installed-stubs)
443 endif
446 # Since stubs.h is never needed when building the library, we simplify the
447 # hairy installation process by producing it in place only as the last part
448 # of the top-level `make install'. It depends on subdir_install, which
449 # iterates over all the subdirs; subdir_install in each subdir depends on
450 # the subdir's stubs file. Having more direct dependencies would result in
451 # extra iterations over the list for subdirs and many recursive makes.
452 $(installed-stubs): include/stubs-prologue.h subdir_install
453 $(make-target-directory)
454 @rm -f $(objpfx)stubs.h
455 (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
456 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
457 then echo 'stubs.h unchanged'; \
458 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
459 rm -f $(objpfx)stubs.h
461 # This makes the Info or DVI file of the documentation from the Texinfo source.
462 .PHONY: info dvi pdf html
463 info dvi pdf html:
464 $(MAKE) $(PARALLELMFLAGS) -C manual $@
466 # This makes all the subdirectory targets.
468 # For each target, make it depend on DIR/target for each subdirectory DIR.
469 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
471 # Compute a list of all those targets.
472 all-subdirs-targets := $(foreach dir,$(subdirs),\
473 $(addprefix $(dir)/,$(+subdir_targets)))
475 # The action for each of those is to cd into the directory and make the
476 # target there.
477 $(all-subdirs-targets):
478 $(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F)
480 define subdir-target-args
481 subdir=$(@D)$(if $($(@D)-srcdir),\
482 -C $($(@D)-srcdir) ..=`pwd`/,\
483 -C $(@D) ..=../)
484 endef
486 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
488 # Targets to clean things up to various degrees.
490 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
491 tests-clean
493 # Subroutines of all cleaning targets.
494 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
495 -rm -f $(foreach o,$(object-suffixes-for-libc),\
496 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
497 $(addprefix $(objpfx),$(install-lib))
498 parent-clean: parent-mostlyclean common-clean
500 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
501 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
502 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
504 clean: parent-clean
505 # This is done this way rather than having `subdir_clean' be a
506 # dependency of this target so that libc.a will be removed before the
507 # subdirectories are dealt with and so they won't try to remove object
508 # files from it when it's going to be removed anyway.
509 @$(MAKE) subdir_clean no_deps=t
510 -rm -f $(postclean)
511 mostlyclean: parent-mostlyclean
512 @$(MAKE) subdir_mostlyclean no_deps=t
513 -rm -f $(postclean)
515 tests-clean:
516 @$(MAKE) subdir_testclean no_deps=t
518 ifneq (,$(CXX))
519 vpath c++-types.data $(+sysdep_dirs)
521 tests-special += $(objpfx)c++-types-check.out
522 $(objpfx)c++-types-check.out: c++-types.data scripts/check-c++-types.sh
523 scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu11 $(+gccwarn-c),$(CFLAGS)) $(CPPFLAGS) > $@; \
524 $(evaluate-test)
525 endif
527 tests-special += $(objpfx)check-local-headers.out
528 $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
529 AWK='$(AWK)' scripts/check-local-headers.sh \
530 "$(includedir)" "$(objpfx)" < /dev/null > $@; \
531 $(evaluate-test)
533 ifneq "$(headers)" ""
534 # Special test of all the installed headers in this directory.
535 tests-special += $(objpfx)check-installed-headers-c.out
536 libof-check-installed-headers-c := testsuite
537 $(objpfx)check-installed-headers-c.out: \
538 scripts/check-installed-headers.sh $(headers)
539 $(SHELL) $(..)scripts/check-installed-headers.sh c \
540 "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
541 $(headers) > $@; \
542 $(evaluate-test)
544 ifneq "$(CXX)" ""
545 tests-special += $(objpfx)check-installed-headers-cxx.out
546 libof-check-installed-headers-cxx := testsuite
547 $(objpfx)check-installed-headers-cxx.out: \
548 scripts/check-installed-headers.sh $(headers)
549 $(SHELL) $(..)scripts/check-installed-headers.sh c++ \
550 "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
551 $(headers) > $@; \
552 $(evaluate-test)
553 endif # $(CXX)
555 tests-special += $(objpfx)check-wrapper-headers.out
556 $(objpfx)check-wrapper-headers.out: scripts/check-wrapper-headers.py $(headers)
557 $(PYTHON) $< --root=. --subdir=. $(headers) \
558 --generated $(common-generated) > $@; $(evaluate-test)
559 endif # $(headers)
561 define summarize-tests
562 @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
563 @echo "Summary of test results$2:"
564 @sed 's/:.*//' < $(objpfx)$1 | sort | uniq -c
565 @! egrep -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(objpfx)$1
566 endef
568 # The intention here is to do ONE install of our build into the
569 # testroot.pristine/ directory, then rsync (internal to
570 # support/test-container) that to testroot.root/ at the start of each
571 # test. That way we can promise each test a "clean" install, without
572 # having to do the install for each test.
574 # In addition, we have to copy some files (which we build) into this
575 # root in addition to what glibc installs. For example, many tests
576 # require additional programs including /bin/sh, /bin/true, and
577 # /bin/echo, all of which we build below to limit library dependencies
578 # to just those things in glibc and language support libraries which
579 # we also copy into the into the rootfs. To determine what language
580 # support libraries we need we build a "test" program in either C or
581 # (if available) C++ just so we can copy in any shared objects
582 # (which we do not build) that GCC-compiled programs depend on.
585 ifeq (,$(CXX))
586 LINKS_DSO_PROGRAM = links-dso-program-c
587 else
588 LINKS_DSO_PROGRAM = links-dso-program
589 endif
591 $(tests-container) $(addsuffix /tests,$(subdirs)) : \
592 $(objpfx)testroot.pristine/install.stamp
593 $(objpfx)testroot.pristine/install.stamp :
594 test -d $(objpfx)testroot.pristine || \
595 mkdir $(objpfx)testroot.pristine
596 # We need a working /bin/sh for some of the tests.
597 test -d $(objpfx)testroot.pristine/bin || \
598 mkdir $(objpfx)testroot.pristine/bin
599 # We need the compiled locale dir for localedef tests.
600 test -d $(objpfx)testroot.pristine/$(complocaledir) || \
601 mkdir -p $(objpfx)testroot.pristine/$(complocaledir)
602 cp $(objpfx)support/shell-container $(objpfx)testroot.pristine/bin/sh
603 cp $(objpfx)support/echo-container $(objpfx)testroot.pristine/bin/echo
604 cp $(objpfx)support/true-container $(objpfx)testroot.pristine/bin/true
605 ifeq ($(run-built-tests),yes)
606 # Copy these DSOs first so we can overwrite them with our own.
607 for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 \
608 $(rtld-prefix) \
609 $(objpfx)testroot.pristine/bin/sh \
610 | sed -n '/\//{s@.*=> /@/@;s/^[^/]*//;s/ .*//p;}'` ;\
611 do \
612 test -d `dirname $(objpfx)testroot.pristine$$dso` || \
613 mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
614 $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
615 done
616 for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 \
617 $(rtld-prefix) \
618 $(objpfx)support/$(LINKS_DSO_PROGRAM) \
619 | sed -n '/\//{s@.*=> /@/@;s/^[^/]*//;s/ .*//p;}'` ;\
620 do \
621 test -d `dirname $(objpfx)testroot.pristine$$dso` || \
622 mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
623 $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
624 done
625 endif
626 # $(symbolic-link-list) is a file that encodes $(DESTDIR) so we
627 # have to purge it
628 rm -f $(symbolic-link-list)
629 # Setting INSTALL_UNCOMPRESSED causes localedata/Makefile to
630 # install the charmaps uncompressed, as the testroot does not
631 # provide a gunzip program.
632 $(MAKE) install DESTDIR=$(objpfx)testroot.pristine \
633 INSTALL_UNCOMPRESSED=yes subdirs='$(sorted-subdirs)'
634 rm -f $(symbolic-link-list)
635 touch $(objpfx)testroot.pristine/install.stamp
637 tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
638 tests: $(tests-special)
639 $(..)scripts/merge-test-results.sh -s $(objpfx) "" \
640 $(sort $(tests-special-notdir:.out=)) \
641 > $(objpfx)subdir-tests.sum
642 $(..)scripts/merge-test-results.sh -t $(objpfx) subdir-tests.sum \
643 $(sort $(subdirs) .) \
644 > $(objpfx)tests.sum
645 $(call summarize-tests,tests.sum)
646 xtests:
647 $(..)scripts/merge-test-results.sh -t $(objpfx) subdir-xtests.sum \
648 $(sort $(subdirs)) \
649 > $(objpfx)xtests.sum
650 $(call summarize-tests,xtests.sum, for extra tests)
652 # The realclean target is just like distclean for the parent, but we want
653 # the subdirs to know the difference in case they care.
654 realclean distclean: parent-clean
655 # This is done this way rather than having `subdir_distclean' be a
656 # dependency of this target so that libc.a will be removed before the
657 # subdirectories are dealt with and so they won't try to remove object
658 # files from it when it's going to be removed anyway.
659 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
660 sysdep-subdirs="$(sysdep-subdirs)"
661 -rm -f $(postclean)
663 # Subroutine of distclean and realclean.
664 distclean-1: subdir_$(distclean-1)
665 -rm -f $(config-generated)
666 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
667 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
668 ifdef objdir
669 -rm -f $(objpfx)Makefile
670 endif
671 -rm -f $(sysdep-$(distclean-1))
673 # Make the TAGS file for Emacs users.
675 .PHONY: TAGS
676 TAGS:
677 scripts/list-sources.sh | sed -n -e '/Makefile/p' \
678 $(foreach S,[chsSyl] cxx sh bash pl,\
679 $(subst .,\.,-e '/.$S\(.in\)*$$/p')) \
680 | $(ETAGS) -o $@ -
682 # Make the distribution tarfile.
683 .PHONY: dist dist-prepare
685 generated := $(generated) stubs.h
687 files-for-dist := README INSTALL configure NEWS
689 # Regenerate stuff, then error if these things are not committed yet.
690 dist-prepare: $(files-for-dist)
691 conf=`find sysdeps -name configure`; \
692 $(MAKE) $$conf && \
693 git diff --stat HEAD -- $^ $$conf \
694 | $(AWK) '{ print; rc=1 } END { exit rc }'
696 %.tar: FORCE
697 git archive --prefix=$*/ $* > $@.new
698 mv -f $@.new $@
700 # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
702 ifneq (,$(strip $(dist-version)))
703 dist: $(foreach Z,.bz2 .gz .xz,$(dist-version).tar$Z)
704 md5sum $^
705 else
706 dist: dist-prepare
707 @if v=`git describe`; then \
708 echo Distribution version $$v; \
709 $(MAKE) dist dist-version=$$v; \
710 else \
711 false; \
713 endif
715 INSTALL: manual/install-plain.texi manual/macros.texi \
716 $(common-objpfx)manual/pkgvers.texi manual/install.texi
717 makeinfo --no-validate --plaintext --no-number-sections \
718 -I$(common-objpfx)manual $< -o $@-tmp
719 $(AWK) 'NF == 0 { ++n; next } \
720 NF != 0 { while (n-- > 0) print ""; n = 0; print }' \
721 < $@-tmp > $@-tmp2
722 rm -f $@-tmp
723 -chmod a-w $@-tmp2
724 mv -f $@-tmp2 $@
725 $(common-objpfx)manual/%: FORCE
726 $(MAKE) $(PARALLELMFLAGS) -C manual $@
727 FORCE:
729 iconvdata/% localedata/% po/%: FORCE
730 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
732 # Convenience target to rerun one test, from the top of the build tree
733 # Example: make test t=wcsmbs/test-wcsnlen
734 .PHONY: test
735 test :
736 @-rm -f $(objpfx)$t.out
737 $(MAKE) subdir=$(patsubst %/,%,$(dir $t)) -C $(dir $t) ..=../ $(objpfx)$t.out
738 @cat $(objpfx)$t.test-result
739 @cat $(objpfx)$t.out