Add helper script for glibc debugging
[platform/upstream/glibc.git] / Makefile
1 # Copyright (C) 1991-2019 Free Software Foundation, Inc.
2 # This file is part of the GNU C Library.
3
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.
8
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.
13
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/>.
17
18 #
19 #       Master Makefile for the GNU C library
20 #
21 ifneq (,)
22 This makefile requires GNU Make.
23 endif
24
25 include Makeconfig
26
27
28 # This is the default target; it makes everything except the tests.
29 .PHONY: all
30 all: lib others
31 \f
32 ifneq ($(AUTOCONF),no)
33
34 define autoconf-it
35 @-rm -f $@.new
36 $(AUTOCONF) $(ACFLAGS) $< > $@.new
37 chmod a-w$(patsubst %,$(comma)a+x,$(filter .,$(@D))) $@.new
38 mv -f $@.new $@
39 endef
40
41 configure: configure.ac aclocal.m4; $(autoconf-it)
42 %/configure: %/configure.ac aclocal.m4; $(autoconf-it)
43 %/preconfigure: %/preconfigure.ac aclocal.m4; $(autoconf-it)
44
45 endif # $(AUTOCONF) = no
46
47
48 # We don't want to run anything here in parallel.
49 .NOTPARALLEL:
50
51 # These are the targets that are made by making them in each subdirectory.
52 +subdir_targets := subdir_lib objects objs others subdir_mostlyclean    \
53                    subdir_clean subdir_distclean subdir_realclean       \
54                    tests xtests                                         \
55                    subdir_update-abi subdir_check-abi                   \
56                    subdir_update-all-abi                                \
57                    subdir_echo-headers                                  \
58                    subdir_install                                       \
59                    subdir_objs subdir_stubs subdir_testclean            \
60                    $(addprefix install-, no-libc.a bin lib data headers others)
61 \f
62 headers := limits.h values.h features.h gnu-versions.h \
63            bits/xopen_lim.h gnu/libc-version.h stdc-predef.h \
64            bits/libc-header-start.h
65
66 echo-headers: subdir_echo-headers
67
68 # The headers are in the include directory.
69 subdir-dirs = include
70 vpath %.h $(subdir-dirs)
71
72 # What to install.
73 install-others = $(inst_includedir)/gnu/stubs.h
74 install-bin-script =
75
76 ifeq (yes,$(build-shared))
77 headers += gnu/lib-names.h
78 endif
79
80 include Makerules
81
82 ifeq ($(build-programs),yes)
83 others: $(addprefix $(objpfx),$(install-bin-script))
84 endif
85
86 # Install from subdirectories too.
87 install: subdir_install
88
89 # Explicit dependency so that `make install-headers' works
90 install-headers: install-headers-nosubdir
91
92 # Make sure that the dynamic linker is installed before libc.
93 $(inst_slibdir)/libc-$(version).so: elf/ldso_install
94
95 .PHONY: elf/ldso_install
96 elf/ldso_install:
97         $(MAKE) -C $(@D) $(@F)
98
99 # Create links for shared libraries using the `ldconfig' program if possible.
100 # Ignore the error if we cannot update /etc/ld.so.cache.
101 ifeq (no,$(cross-compiling))
102 ifeq (yes,$(build-shared))
103 install: install-symbolic-link
104 .PHONY: install-symbolic-link
105 install-symbolic-link: subdir_install
106         $(symbolic-link-prog) $(symbolic-link-list)
107         rm -f $(symbolic-link-list)
108
109 install:
110         -test ! -x $(elf-objpfx)ldconfig || LC_ALL=C \
111           $(elf-objpfx)ldconfig $(addprefix -r ,$(install_root)) \
112                                 $(slibdir) $(libdir)
113 ifneq (no,$(PERL))
114 ifeq (/usr,$(prefix))
115 ifeq (,$(install_root))
116         LD_SO=$(ld.so-version) CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)
117 endif
118 endif
119 endif
120 endif
121 endif
122
123 # Build subdirectory lib objects.
124 lib-noranlib: subdir_lib
125
126 ifeq (yes,$(build-shared))
127 # Build the shared object from the PIC object library.
128 lib: $(common-objpfx)libc.so $(common-objpfx)linkobj/libc.so
129 endif # $(build-shared)
130
131 # Used to build testrun.sh.
132 define testrun-script
133 #!/bin/bash
134 builddir=`dirname "$$0"`
135 GCONV_PATH="$${builddir}/iconvdata"
136
137 usage () {
138   echo "usage: $$0 [--tool=strace] PROGRAM [ARGUMENTS...]" 2>&1
139   echo "       $$0 --tool=valgrind PROGRAM [ARGUMENTS...]" 2>&1
140   exit 1
141 }
142
143 toolname=default
144 while test $$# -gt 0 ; do
145   case "$$1" in
146     --tool=*)
147       toolname="$${1:7}"
148       shift
149       ;;
150     --*)
151       usage
152       ;;
153     *)
154       break
155       ;;
156   esac
157 done
158
159 if test $$# -eq 0 ; then
160   usage
161 fi
162
163 case "$$toolname" in
164   default)
165     exec $(subst $(common-objdir),"$${builddir}", $(test-program-prefix)) \
166       $${1+"$$@"}
167     ;;
168   strace)
169     exec strace $(patsubst %, -E%, $(run-program-env)) \
170       $(test-via-rtld-prefix) $${1+"$$@"}
171     ;;
172   valgrind)
173     exec env $(run-program-env) valgrind $(test-via-rtld-prefix) $${1+"$$@"}
174     ;;
175   *)
176     usage
177     ;;
178 esac
179 endef
180
181 # This is a handy script for running any dynamically linked program against
182 # the current libc build for testing.
183 $(common-objpfx)testrun.sh: $(common-objpfx)config.make \
184                             $(..)Makeconfig $(..)Makefile
185         $(file >$@T,$(testrun-script))
186         chmod a+x $@T
187         mv -f $@T $@
188 postclean-generated += testrun.sh
189
190 define debugglibc
191 #!/bin/bash
192
193 SOURCE_DIR="$(CURDIR)"
194 BUILD_DIR="$(common-objpfx)"
195 CMD_FILE="$(common-objpfx)debugglibc.gdb"
196 DIRECT=true
197 SYMBOLSFILE=true
198 unset TESTCASE
199 unset BREAKPOINTS
200 unset ENVVARS
201
202 usage()
203 {
204 cat << EOF
205 Usage: $$0 [OPTIONS] <testcase>
206
207   where <testcase> is the path to the program being tested.
208
209 Options:
210
211   -h, --help
212         Prints this message and leaves.
213
214   The following options require one argument:
215
216   -b, --breakpoint
217         Breakpoints to set at the beginning of the execution
218         (each breakpoint demands its own -b option, e.g. -b foo -b bar)
219   -e, --environment-variable
220         Environment variables to be set with 'exec-wrapper env' in GDB
221         (each environment variable demands its own -e option, e.g.
222         -e FOO=foo -e BAR=bar)
223
224   The following options do not take arguments:
225
226   -i, --no-direct
227         Selects whether to pass the flag --direct to gdb.
228         Required for glibc test cases and not allowed for non-glibc tests.
229         Default behaviour is to pass the flag --direct to gdb.
230   -s, --no-symbols-file
231         Do not tell GDB to load debug symbols from the testcase.
232 EOF
233 }
234
235 # Parse input options
236 while [[ $$# > 0 ]]
237 do
238   key="$$1"
239   case $$key in
240     -h|--help)
241       usage
242       exit 0
243       ;;
244     -b|--breakpoint)
245       BREAKPOINTS="break $$2\n$$BREAKPOINTS"
246       shift
247       ;;
248     -e|--environment-variable)
249       ENVVARS="$$2 $$ENVVARS"
250       shift
251       ;;
252     -i|--no-direct)
253       DIRECT=false
254       ;;
255     -s|--no-symbols-file)
256       SYMBOLSFILE=false
257       ;;
258     *)
259       TESTCASE=$$1
260       ;;
261   esac
262   shift
263 done
264
265 # Check for required argument
266 if [ ! -v TESTCASE ]
267 then
268   usage
269   exit 1
270 fi
271
272 # Expand environment setup command
273 if [ -v ENVVARS ]
274 then
275   ENVVARSCMD="set exec-wrapper env $$ENVVARS"
276 fi
277
278 # Expand direct argument
279 if [ "$$DIRECT" == true ]
280 then
281   DIRECT="--direct"
282 else
283   DIRECT=""
284 fi
285
286 # Expand symbols loading command
287 if [ "$$SYMBOLSFILE" == true ]
288 then
289   SYMBOLSFILE="add-symbol-file $${TESTCASE}"
290 else
291   SYMBOLSFILE=""
292 fi
293
294 # GDB commands template
295 template ()
296 {
297 cat <<EOF
298 set environment C -E -x c-header
299 set auto-load safe-path $${BUILD_DIR}/nptl_db:\$$debugdir:\$$datadir/auto-load
300 set libthread-db-search-path $${BUILD_DIR}/nptl_db
301 __ENVVARS__
302 __SYMBOLSFILE__
303 break _dl_start_user
304 run --library-path $(rpath-link):$${BUILD_DIR}/nptl_db \
305 __TESTCASE__ __DIRECT__
306 __BREAKPOINTS__
307 EOF
308 }
309
310 # Generate the commands file for gdb initialization
311 template | sed \
312   -e "s|__ENVVARS__|$$ENVVARSCMD|" \
313   -e "s|__SYMBOLSFILE__|$$SYMBOLSFILE|" \
314   -e "s|__TESTCASE__|$$TESTCASE|" \
315   -e "s|__DIRECT__|$$DIRECT|" \
316   -e "s|__BREAKPOINTS__|$$BREAKPOINTS|" \
317   > $$CMD_FILE
318
319 echo
320 echo "Debugging glibc..."
321 echo "Build directory  : $$BUILD_DIR"
322 echo "Source directory : $$SOURCE_DIR"
323 echo "GLIBC Testcase   : $$TESTCASE"
324 echo "GDB Commands     : $$CMD_FILE"
325 echo "Env vars         : $$ENVVARS"
326 echo
327
328 # Start the test case debugging in two steps:
329 #   1. the following command invokes gdb to run the loader;
330 #   2. the commands file tells the loader to run the test case.
331 gdb -q \
332   -x $${CMD_FILE} \
333   -d $${SOURCE_DIR} \
334   $${BUILD_DIR}/elf/ld.so
335 endef
336
337 # This is another handy script for debugging dynamically linked program
338 # against the current libc build for testing.
339 $(common-objpfx)debugglibc.sh: $(common-objpfx)config.make \
340                             $(..)Makeconfig $(..)Makefile
341         $(file >$@T,$(debugglibc))
342         chmod a+x $@T
343         mv -f $@T $@
344 postclean-generated += debugglibc.sh debugglibc.gdb
345
346 others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
347 \f
348 # Makerules creates a file `stubs' in each subdirectory, which
349 # contains `#define __stub_FUNCTION' for each function defined in that
350 # directory which is a stub.
351 # Here we paste all of these together into <gnu/stubs.h>.
352
353 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
354
355 ifndef abi-variants
356 installed-stubs = $(inst_includedir)/gnu/stubs.h
357 else
358 installed-stubs = $(inst_includedir)/gnu/stubs-$(default-abi).h
359
360 $(inst_includedir)/gnu/stubs.h: $(+force)
361         $(make-target-directory)
362         { \
363          echo '/* This file is automatically generated.';\
364          echo "   This file selects the right generated file of \`__stub_FUNCTION' macros";\
365          echo '   based on the architecture being compiled for.  */'; \
366          echo ''; \
367          $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
368          echo ''; \
369          $(foreach v,$(abi-variants),\
370          $(if $(abi-$(v)-condition),\
371          echo '#if $(abi-$(v)-condition)'; \
372          echo '# include <gnu/stubs-$(v).h>'); \
373          $(if $(abi-$(v)-condition),echo '#endif';) \
374          rm -f $(@:.d=.h).new$(v); \
375          ) \
376         } > $(@:.d=.h).new
377         mv -f $(@:.d=.h).new $(@:.d=.h)
378
379 install-others-nosubdir: $(installed-stubs)
380 endif
381
382
383 # Since stubs.h is never needed when building the library, we simplify the
384 # hairy installation process by producing it in place only as the last part
385 # of the top-level `make install'.  It depends on subdir_install, which
386 # iterates over all the subdirs; subdir_install in each subdir depends on
387 # the subdir's stubs file.  Having more direct dependencies would result in
388 # extra iterations over the list for subdirs and many recursive makes.
389 $(installed-stubs): include/stubs-prologue.h subdir_install
390         $(make-target-directory)
391         @rm -f $(objpfx)stubs.h
392         (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
393         if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
394         then echo 'stubs.h unchanged'; \
395         else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
396         rm -f $(objpfx)stubs.h
397 \f
398 # This makes the Info or DVI file of the documentation from the Texinfo source.
399 .PHONY: info dvi pdf html
400 info dvi pdf html:
401         $(MAKE) $(PARALLELMFLAGS) -C manual $@
402 \f
403 # This makes all the subdirectory targets.
404
405 # For each target, make it depend on DIR/target for each subdirectory DIR.
406 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
407
408 # Compute a list of all those targets.
409 all-subdirs-targets := $(foreach dir,$(subdirs),\
410                                  $(addprefix $(dir)/,$(+subdir_targets)))
411
412 # The action for each of those is to cd into the directory and make the
413 # target there.
414 $(all-subdirs-targets):
415         $(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F)
416
417 define subdir-target-args
418 subdir=$(@D)$(if $($(@D)-srcdir),\
419 -C $($(@D)-srcdir) ..=`pwd`/,\
420 -C $(@D) ..=../)
421 endef
422
423 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
424 \f
425 # Targets to clean things up to various degrees.
426
427 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
428         tests-clean
429
430 # Subroutines of all cleaning targets.
431 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
432         -rm -f $(foreach o,$(object-suffixes-for-libc),\
433                    $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
434                $(addprefix $(objpfx),$(install-lib))
435 parent-clean: parent-mostlyclean common-clean
436
437 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
438             $(addprefix $(objpfx),sysd-dirs sysd-rules) \
439             $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
440
441 clean: parent-clean
442 # This is done this way rather than having `subdir_clean' be a
443 # dependency of this target so that libc.a will be removed before the
444 # subdirectories are dealt with and so they won't try to remove object
445 # files from it when it's going to be removed anyway.
446         @$(MAKE) subdir_clean no_deps=t
447         -rm -f $(postclean)
448 mostlyclean: parent-mostlyclean
449         @$(MAKE) subdir_mostlyclean no_deps=t
450         -rm -f $(postclean)
451
452 tests-clean:
453         @$(MAKE) subdir_testclean no_deps=t
454
455 ifneq (,$(CXX))
456 vpath c++-types.data $(+sysdep_dirs)
457
458 tests-special += $(objpfx)c++-types-check.out
459 $(objpfx)c++-types-check.out: c++-types.data scripts/check-c++-types.sh
460         scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu11 $(+gccwarn-c),$(CFLAGS)) $(CPPFLAGS) > $@; \
461         $(evaluate-test)
462 endif
463
464 tests-special += $(objpfx)check-local-headers.out
465 $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
466         AWK='$(AWK)' scripts/check-local-headers.sh \
467           "$(includedir)" "$(objpfx)" < /dev/null > $@; \
468         $(evaluate-test)
469
470 ifneq "$(headers)" ""
471 # Special test of all the installed headers in this directory.
472 tests-special += $(objpfx)check-installed-headers-c.out
473 libof-check-installed-headers-c := testsuite
474 $(objpfx)check-installed-headers-c.out: \
475     scripts/check-installed-headers.sh $(headers)
476         $(SHELL) $(..)scripts/check-installed-headers.sh c \
477           "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
478           $(headers) > $@; \
479         $(evaluate-test)
480
481 ifneq "$(CXX)" ""
482 tests-special += $(objpfx)check-installed-headers-cxx.out
483 libof-check-installed-headers-cxx := testsuite
484 $(objpfx)check-installed-headers-cxx.out: \
485     scripts/check-installed-headers.sh $(headers)
486         $(SHELL) $(..)scripts/check-installed-headers.sh c++ \
487           "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
488           $(headers) > $@; \
489         $(evaluate-test)
490 endif # $(CXX)
491
492 tests-special += $(objpfx)check-wrapper-headers.out
493 $(objpfx)check-wrapper-headers.out: scripts/check-wrapper-headers.py $(headers)
494         $(PYTHON) $< --root=. --subdir=. $(headers) \
495           --generated $(common-generated) > $@; $(evaluate-test)
496 endif # $(headers)
497
498 define summarize-tests
499 @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
500 @echo "Summary of test results$2:"
501 @sed 's/:.*//' < $(objpfx)$1 | sort | uniq -c
502 @! egrep -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(objpfx)$1
503 endef
504
505 # The intention here is to do ONE install of our build into the
506 # testroot.pristine/ directory, then rsync (internal to
507 # support/test-container) that to testroot.root/ at the start of each
508 # test.  That way we can promise each test a "clean" install, without
509 # having to do the install for each test.
510 #
511 # In addition, we have to copy some files (which we build) into this
512 # root in addition to what glibc installs.  For example, many tests
513 # require additional programs including /bin/sh, /bin/true, and
514 # /bin/echo, all of which we build below to limit library dependencies
515 # to just those things in glibc and language support libraries which
516 # we also copy into the into the rootfs.  To determine what language
517 # support libraries we need we build a "test" program in either C or
518 # (if available) C++ just so we can copy in any shared objects
519 # (which we do not build) that GCC-compiled programs depend on.
520
521
522 ifeq (,$(CXX))
523 LINKS_DSO_PROGRAM = links-dso-program-c
524 else
525 LINKS_DSO_PROGRAM = links-dso-program
526 endif
527
528 $(tests-container) $(addsuffix /tests,$(subdirs)) : \
529                 $(objpfx)testroot.pristine/install.stamp
530 $(objpfx)testroot.pristine/install.stamp :
531         test -d $(objpfx)testroot.pristine || \
532           mkdir $(objpfx)testroot.pristine
533         # We need a working /bin/sh for some of the tests.
534         test -d $(objpfx)testroot.pristine/bin || \
535           mkdir $(objpfx)testroot.pristine/bin
536         cp $(objpfx)support/shell-container $(objpfx)testroot.pristine/bin/sh
537         cp $(objpfx)support/echo-container $(objpfx)testroot.pristine/bin/echo
538         cp $(objpfx)support/true-container $(objpfx)testroot.pristine/bin/true
539 ifeq ($(run-built-tests),yes)
540         # Copy these DSOs first so we can overwrite them with our own.
541         for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1  \
542                 $(rtld-prefix) \
543                 $(objpfx)testroot.pristine/bin/sh \
544                 | grep / | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
545           do \
546             test -d `dirname $(objpfx)testroot.pristine$$dso` || \
547               mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
548             $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
549           done
550         for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1  \
551                 $(rtld-prefix) \
552                 $(objpfx)support/$(LINKS_DSO_PROGRAM) \
553                 | grep / | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
554           do \
555             test -d `dirname $(objpfx)testroot.pristine$$dso` || \
556               mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
557             $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
558           done
559 endif
560         $(MAKE) install DESTDIR=$(objpfx)testroot.pristine \
561           subdirs='$(sorted-subdirs)'
562         touch $(objpfx)testroot.pristine/install.stamp
563
564 tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
565 tests: $(tests-special)
566         $(..)scripts/merge-test-results.sh -s $(objpfx) "" \
567           $(sort $(tests-special-notdir:.out=)) \
568           > $(objpfx)subdir-tests.sum
569         $(..)scripts/merge-test-results.sh -t $(objpfx) subdir-tests.sum \
570           $(sort $(subdirs) .) \
571           > $(objpfx)tests.sum
572         $(call summarize-tests,tests.sum)
573 xtests:
574         $(..)scripts/merge-test-results.sh -t $(objpfx) subdir-xtests.sum \
575           $(sort $(subdirs)) \
576           > $(objpfx)xtests.sum
577         $(call summarize-tests,xtests.sum, for extra tests)
578
579 # The realclean target is just like distclean for the parent, but we want
580 # the subdirs to know the difference in case they care.
581 realclean distclean: parent-clean
582 # This is done this way rather than having `subdir_distclean' be a
583 # dependency of this target so that libc.a will be removed before the
584 # subdirectories are dealt with and so they won't try to remove object
585 # files from it when it's going to be removed anyway.
586         @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
587                  sysdep-subdirs="$(sysdep-subdirs)"
588         -rm -f $(postclean)
589
590 # Subroutine of distclean and realclean.
591 distclean-1: subdir_$(distclean-1)
592         -rm -f $(config-generated)
593         -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
594         -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
595 ifdef objdir
596         -rm -f $(objpfx)Makefile
597 endif
598         -rm -f $(sysdep-$(distclean-1))
599 \f
600 # Make the TAGS file for Emacs users.
601
602 .PHONY: TAGS
603 TAGS:
604         scripts/list-sources.sh | sed -n -e '/Makefile/p' \
605           $(foreach S,[chsSyl] cxx sh bash pl,\
606                     $(subst .,\.,-e '/.$S\(.in\)*$$/p')) \
607         | $(ETAGS) -o $@ -
608 \f
609 # Make the distribution tarfile.
610 .PHONY: dist dist-prepare
611
612 generated := $(generated) stubs.h
613
614 files-for-dist := README INSTALL configure ChangeLog NEWS
615
616 # Regenerate stuff, then error if these things are not committed yet.
617 dist-prepare: $(files-for-dist)
618         conf=`find sysdeps -name configure`; \
619         $(MAKE) $$conf && \
620         git diff --stat HEAD -- $^ $$conf \
621         | $(AWK) '{ print; rc=1 } END { exit rc }'
622
623 %.tar: FORCE
624         git archive --prefix=$*/ $* > $@.new
625         mv -f $@.new $@
626
627 # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
628
629 ifneq (,$(strip $(dist-version)))
630 dist: $(foreach Z,.bz2 .gz .xz,$(dist-version).tar$Z)
631         md5sum $^
632 else
633 dist: dist-prepare
634         @if v=`git describe`; then \
635           echo Distribution version $$v; \
636           $(MAKE) dist dist-version=$$v; \
637         else \
638           false; \
639         fi
640 endif
641
642 INSTALL: manual/install-plain.texi manual/macros.texi \
643          $(common-objpfx)manual/pkgvers.texi manual/install.texi
644         makeinfo --no-validate --plaintext --no-number-sections \
645                  -I$(common-objpfx)manual $< -o $@-tmp
646         $(AWK) 'NF == 0 { ++n; next } \
647                 NF != 0 { while (n-- > 0) print ""; n = 0; print }' \
648           < $@-tmp > $@-tmp2
649         rm -f $@-tmp
650         -chmod a-w $@-tmp2
651         mv -f $@-tmp2 $@
652 $(common-objpfx)manual/%: FORCE
653         $(MAKE) $(PARALLELMFLAGS) -C manual $@
654 FORCE:
655
656 iconvdata/% localedata/% po/%: FORCE
657         $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)