]> git.ipfire.org Git - thirdparty/glibc.git/blob - Makefile
Disable warnings in string/tester.c at top level.
[thirdparty/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] <program>
206
207 Or: $$0 [OPTIONS] -- <program> [<args>]...
208
209 where <program> is the path to the program being tested,
210 and <args> are the arguments to be passed to it.
211
212 Options:
213
214 -h, --help
215 Prints this message and leaves.
216
217 The following options require one argument:
218
219 -b, --breakpoint
220 Breakpoints to set at the beginning of the execution
221 (each breakpoint demands its own -b option, e.g. -b foo -b bar)
222 -e, --environment-variable
223 Environment variables to be set with 'exec-wrapper env' in GDB
224 (each environment variable demands its own -e option, e.g.
225 -e FOO=foo -e BAR=bar)
226
227 The following options do not take arguments:
228
229 -i, --no-direct
230 Selects whether to pass the --direct flag to the program.
231 --direct is useful when debugging glibc test cases. It inhibits the
232 tests from forking and executing in a subprocess.
233 Default behaviour is to pass the --direct flag, except when the
234 program is run with user specified arguments using the "--" separator.
235 -s, --no-symbols-file
236 Do not tell GDB to load debug symbols from the program.
237 EOF
238 }
239
240 # Parse input options
241 while [[ $$# > 0 ]]
242 do
243 key="$$1"
244 case $$key in
245 -h|--help)
246 usage
247 exit 0
248 ;;
249 -b|--breakpoint)
250 BREAKPOINTS="break $$2\n$$BREAKPOINTS"
251 shift
252 ;;
253 -e|--environment-variable)
254 ENVVARS="$$2 $$ENVVARS"
255 shift
256 ;;
257 -i|--no-direct)
258 DIRECT=false
259 ;;
260 -s|--no-symbols-file)
261 SYMBOLSFILE=false
262 ;;
263 --)
264 shift
265 TESTCASE=$$1
266 COMMANDLINE="$$@"
267 # Don't add --direct when user specifies program arguments
268 DIRECT=false
269 break
270 ;;
271 *)
272 TESTCASE=$$1
273 COMMANDLINE=$$TESTCASE
274 ;;
275 esac
276 shift
277 done
278
279 # Check for required argument
280 if [ ! -v TESTCASE ]
281 then
282 usage
283 exit 1
284 fi
285
286 # Expand environment setup command
287 if [ -v ENVVARS ]
288 then
289 ENVVARSCMD="set exec-wrapper env $$ENVVARS"
290 fi
291
292 # Expand direct argument
293 if [ "$$DIRECT" == true ]
294 then
295 DIRECT="--direct"
296 else
297 DIRECT=""
298 fi
299
300 # Expand symbols loading command
301 if [ "$$SYMBOLSFILE" == true ]
302 then
303 SYMBOLSFILE="add-symbol-file $${TESTCASE}"
304 else
305 SYMBOLSFILE=""
306 fi
307
308 # GDB commands template
309 template ()
310 {
311 cat <<EOF
312 set environment C -E -x c-header
313 set auto-load safe-path $${BUILD_DIR}/nptl_db:\$$debugdir:\$$datadir/auto-load
314 set libthread-db-search-path $${BUILD_DIR}/nptl_db
315 __ENVVARS__
316 __SYMBOLSFILE__
317 break _dl_start_user
318 run --library-path $(rpath-link):$${BUILD_DIR}/nptl_db \
319 __COMMANDLINE__ __DIRECT__
320 __BREAKPOINTS__
321 EOF
322 }
323
324 # Generate the commands file for gdb initialization
325 template | sed \
326 -e "s|__ENVVARS__|$$ENVVARSCMD|" \
327 -e "s|__SYMBOLSFILE__|$$SYMBOLSFILE|" \
328 -e "s|__COMMANDLINE__|$$COMMANDLINE|" \
329 -e "s|__DIRECT__|$$DIRECT|" \
330 -e "s|__BREAKPOINTS__|$$BREAKPOINTS|" \
331 > $$CMD_FILE
332
333 echo
334 echo "Debugging glibc..."
335 echo "Build directory : $$BUILD_DIR"
336 echo "Source directory : $$SOURCE_DIR"
337 echo "GLIBC Testcase : $$TESTCASE"
338 echo "GDB Commands : $$CMD_FILE"
339 echo "Env vars : $$ENVVARS"
340 echo
341
342 # Start the test case debugging in two steps:
343 # 1. the following command invokes gdb to run the loader;
344 # 2. the commands file tells the loader to run the test case.
345 gdb -q \
346 -x $${CMD_FILE} \
347 -d $${SOURCE_DIR} \
348 $${BUILD_DIR}/elf/ld.so
349 endef
350
351 # This is another handy script for debugging dynamically linked program
352 # against the current libc build for testing.
353 $(common-objpfx)debugglibc.sh: $(common-objpfx)config.make \
354 $(..)Makeconfig $(..)Makefile
355 $(file >$@T,$(debugglibc))
356 chmod a+x $@T
357 mv -f $@T $@
358 postclean-generated += debugglibc.sh debugglibc.gdb
359
360 others: $(common-objpfx)testrun.sh $(common-objpfx)debugglibc.sh
361 \f
362 # Makerules creates a file `stubs' in each subdirectory, which
363 # contains `#define __stub_FUNCTION' for each function defined in that
364 # directory which is a stub.
365 # Here we paste all of these together into <gnu/stubs.h>.
366
367 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
368
369 ifndef abi-variants
370 installed-stubs = $(inst_includedir)/gnu/stubs.h
371 else
372 installed-stubs = $(inst_includedir)/gnu/stubs-$(default-abi).h
373
374 $(inst_includedir)/gnu/stubs.h: $(+force)
375 $(make-target-directory)
376 { \
377 echo '/* This file is automatically generated.';\
378 echo " This file selects the right generated file of \`__stub_FUNCTION' macros";\
379 echo ' based on the architecture being compiled for. */'; \
380 echo ''; \
381 $(foreach h,$(abi-includes), echo '#include <$(h)>';) \
382 echo ''; \
383 $(foreach v,$(abi-variants),\
384 $(if $(abi-$(v)-condition),\
385 echo '#if $(abi-$(v)-condition)'; \
386 echo '# include <gnu/stubs-$(v).h>'); \
387 $(if $(abi-$(v)-condition),echo '#endif';) \
388 rm -f $(@:.d=.h).new$(v); \
389 ) \
390 } > $(@:.d=.h).new
391 mv -f $(@:.d=.h).new $(@:.d=.h)
392
393 install-others-nosubdir: $(installed-stubs)
394 endif
395
396
397 # Since stubs.h is never needed when building the library, we simplify the
398 # hairy installation process by producing it in place only as the last part
399 # of the top-level `make install'. It depends on subdir_install, which
400 # iterates over all the subdirs; subdir_install in each subdir depends on
401 # the subdir's stubs file. Having more direct dependencies would result in
402 # extra iterations over the list for subdirs and many recursive makes.
403 $(installed-stubs): include/stubs-prologue.h subdir_install
404 $(make-target-directory)
405 @rm -f $(objpfx)stubs.h
406 (sed '/^@/d' $<; LC_ALL=C sort $(subdir-stubs)) > $(objpfx)stubs.h
407 if test -r $@ && cmp -s $(objpfx)stubs.h $@; \
408 then echo 'stubs.h unchanged'; \
409 else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
410 rm -f $(objpfx)stubs.h
411 \f
412 # This makes the Info or DVI file of the documentation from the Texinfo source.
413 .PHONY: info dvi pdf html
414 info dvi pdf html:
415 $(MAKE) $(PARALLELMFLAGS) -C manual $@
416 \f
417 # This makes all the subdirectory targets.
418
419 # For each target, make it depend on DIR/target for each subdirectory DIR.
420 $(+subdir_targets): %: $(addsuffix /%,$(subdirs))
421
422 # Compute a list of all those targets.
423 all-subdirs-targets := $(foreach dir,$(subdirs),\
424 $(addprefix $(dir)/,$(+subdir_targets)))
425
426 # The action for each of those is to cd into the directory and make the
427 # target there.
428 $(all-subdirs-targets):
429 $(MAKE) $(PARALLELMFLAGS) $(subdir-target-args) $(@F)
430
431 define subdir-target-args
432 subdir=$(@D)$(if $($(@D)-srcdir),\
433 -C $($(@D)-srcdir) ..=`pwd`/,\
434 -C $(@D) ..=../)
435 endef
436
437 .PHONY: $(+subdir_targets) $(all-subdirs-targets)
438 \f
439 # Targets to clean things up to various degrees.
440
441 .PHONY: clean realclean distclean distclean-1 parent-clean parent-mostlyclean \
442 tests-clean
443
444 # Subroutines of all cleaning targets.
445 parent-mostlyclean: common-mostlyclean # common-mostlyclean is in Makerules.
446 -rm -f $(foreach o,$(object-suffixes-for-libc),\
447 $(common-objpfx)$(patsubst %,$(libtype$o),c)) \
448 $(addprefix $(objpfx),$(install-lib))
449 parent-clean: parent-mostlyclean common-clean
450
451 postclean = $(addprefix $(common-objpfx),$(postclean-generated)) \
452 $(addprefix $(objpfx),sysd-dirs sysd-rules) \
453 $(addprefix $(objpfx),sysd-sorted soversions.mk soversions.i)
454
455 clean: parent-clean
456 # This is done this way rather than having `subdir_clean' be a
457 # dependency of this target so that libc.a will be removed before the
458 # subdirectories are dealt with and so they won't try to remove object
459 # files from it when it's going to be removed anyway.
460 @$(MAKE) subdir_clean no_deps=t
461 -rm -f $(postclean)
462 mostlyclean: parent-mostlyclean
463 @$(MAKE) subdir_mostlyclean no_deps=t
464 -rm -f $(postclean)
465
466 tests-clean:
467 @$(MAKE) subdir_testclean no_deps=t
468
469 ifneq (,$(CXX))
470 vpath c++-types.data $(+sysdep_dirs)
471
472 tests-special += $(objpfx)c++-types-check.out
473 $(objpfx)c++-types-check.out: c++-types.data scripts/check-c++-types.sh
474 scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu11 $(+gccwarn-c),$(CFLAGS)) $(CPPFLAGS) > $@; \
475 $(evaluate-test)
476 endif
477
478 tests-special += $(objpfx)check-local-headers.out
479 $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
480 AWK='$(AWK)' scripts/check-local-headers.sh \
481 "$(includedir)" "$(objpfx)" < /dev/null > $@; \
482 $(evaluate-test)
483
484 ifneq "$(headers)" ""
485 # Special test of all the installed headers in this directory.
486 tests-special += $(objpfx)check-installed-headers-c.out
487 libof-check-installed-headers-c := testsuite
488 $(objpfx)check-installed-headers-c.out: \
489 scripts/check-installed-headers.sh $(headers)
490 $(SHELL) $(..)scripts/check-installed-headers.sh c \
491 "$(CC) $(filter-out -std=%,$(CFLAGS)) -D_ISOMAC $(+includes)" \
492 $(headers) > $@; \
493 $(evaluate-test)
494
495 ifneq "$(CXX)" ""
496 tests-special += $(objpfx)check-installed-headers-cxx.out
497 libof-check-installed-headers-cxx := testsuite
498 $(objpfx)check-installed-headers-cxx.out: \
499 scripts/check-installed-headers.sh $(headers)
500 $(SHELL) $(..)scripts/check-installed-headers.sh c++ \
501 "$(CXX) $(filter-out -std=%,$(CXXFLAGS)) -D_ISOMAC $(+includes)" \
502 $(headers) > $@; \
503 $(evaluate-test)
504 endif # $(CXX)
505
506 tests-special += $(objpfx)check-wrapper-headers.out
507 $(objpfx)check-wrapper-headers.out: scripts/check-wrapper-headers.py $(headers)
508 $(PYTHON) $< --root=. --subdir=. $(headers) \
509 --generated $(common-generated) > $@; $(evaluate-test)
510 endif # $(headers)
511
512 define summarize-tests
513 @egrep -v '^(PASS|XFAIL):' $(objpfx)$1 || true
514 @echo "Summary of test results$2:"
515 @sed 's/:.*//' < $(objpfx)$1 | sort | uniq -c
516 @! egrep -q -v '^(X?PASS|XFAIL|UNSUPPORTED):' $(objpfx)$1
517 endef
518
519 # The intention here is to do ONE install of our build into the
520 # testroot.pristine/ directory, then rsync (internal to
521 # support/test-container) that to testroot.root/ at the start of each
522 # test. That way we can promise each test a "clean" install, without
523 # having to do the install for each test.
524 #
525 # In addition, we have to copy some files (which we build) into this
526 # root in addition to what glibc installs. For example, many tests
527 # require additional programs including /bin/sh, /bin/true, and
528 # /bin/echo, all of which we build below to limit library dependencies
529 # to just those things in glibc and language support libraries which
530 # we also copy into the into the rootfs. To determine what language
531 # support libraries we need we build a "test" program in either C or
532 # (if available) C++ just so we can copy in any shared objects
533 # (which we do not build) that GCC-compiled programs depend on.
534
535
536 ifeq (,$(CXX))
537 LINKS_DSO_PROGRAM = links-dso-program-c
538 else
539 LINKS_DSO_PROGRAM = links-dso-program
540 endif
541
542 $(tests-container) $(addsuffix /tests,$(subdirs)) : \
543 $(objpfx)testroot.pristine/install.stamp
544 $(objpfx)testroot.pristine/install.stamp :
545 test -d $(objpfx)testroot.pristine || \
546 mkdir $(objpfx)testroot.pristine
547 # We need a working /bin/sh for some of the tests.
548 test -d $(objpfx)testroot.pristine/bin || \
549 mkdir $(objpfx)testroot.pristine/bin
550 cp $(objpfx)support/shell-container $(objpfx)testroot.pristine/bin/sh
551 cp $(objpfx)support/echo-container $(objpfx)testroot.pristine/bin/echo
552 cp $(objpfx)support/true-container $(objpfx)testroot.pristine/bin/true
553 ifeq ($(run-built-tests),yes)
554 # Copy these DSOs first so we can overwrite them with our own.
555 for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 \
556 $(rtld-prefix) \
557 $(objpfx)testroot.pristine/bin/sh \
558 | grep / | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
559 do \
560 test -d `dirname $(objpfx)testroot.pristine$$dso` || \
561 mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
562 $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
563 done
564 for dso in `$(test-wrapper-env) LD_TRACE_LOADED_OBJECTS=1 \
565 $(rtld-prefix) \
566 $(objpfx)support/$(LINKS_DSO_PROGRAM) \
567 | grep / | sed 's/^[^/]*//' | sed 's/ .*//'` ;\
568 do \
569 test -d `dirname $(objpfx)testroot.pristine$$dso` || \
570 mkdir -p `dirname $(objpfx)testroot.pristine$$dso` ;\
571 $(test-wrapper) cp $$dso $(objpfx)testroot.pristine$$dso ;\
572 done
573 endif
574 $(MAKE) install DESTDIR=$(objpfx)testroot.pristine \
575 subdirs='$(sorted-subdirs)'
576 touch $(objpfx)testroot.pristine/install.stamp
577
578 tests-special-notdir = $(patsubst $(objpfx)%, %, $(tests-special))
579 tests: $(tests-special)
580 $(..)scripts/merge-test-results.sh -s $(objpfx) "" \
581 $(sort $(tests-special-notdir:.out=)) \
582 > $(objpfx)subdir-tests.sum
583 $(..)scripts/merge-test-results.sh -t $(objpfx) subdir-tests.sum \
584 $(sort $(subdirs) .) \
585 > $(objpfx)tests.sum
586 $(call summarize-tests,tests.sum)
587 xtests:
588 $(..)scripts/merge-test-results.sh -t $(objpfx) subdir-xtests.sum \
589 $(sort $(subdirs)) \
590 > $(objpfx)xtests.sum
591 $(call summarize-tests,xtests.sum, for extra tests)
592
593 # The realclean target is just like distclean for the parent, but we want
594 # the subdirs to know the difference in case they care.
595 realclean distclean: parent-clean
596 # This is done this way rather than having `subdir_distclean' be a
597 # dependency of this target so that libc.a will be removed before the
598 # subdirectories are dealt with and so they won't try to remove object
599 # files from it when it's going to be removed anyway.
600 @$(MAKE) distclean-1 no_deps=t distclean-1=$@ avoid-generated=yes \
601 sysdep-subdirs="$(sysdep-subdirs)"
602 -rm -f $(postclean)
603
604 # Subroutine of distclean and realclean.
605 distclean-1: subdir_$(distclean-1)
606 -rm -f $(config-generated)
607 -rm -f $(addprefix $(objpfx),config.status config.cache config.log)
608 -rm -f $(addprefix $(objpfx),config.make config-name.h config.h)
609 ifdef objdir
610 -rm -f $(objpfx)Makefile
611 endif
612 -rm -f $(sysdep-$(distclean-1))
613 \f
614 # Make the TAGS file for Emacs users.
615
616 .PHONY: TAGS
617 TAGS:
618 scripts/list-sources.sh | sed -n -e '/Makefile/p' \
619 $(foreach S,[chsSyl] cxx sh bash pl,\
620 $(subst .,\.,-e '/.$S\(.in\)*$$/p')) \
621 | $(ETAGS) -o $@ -
622 \f
623 # Make the distribution tarfile.
624 .PHONY: dist dist-prepare
625
626 generated := $(generated) stubs.h
627
628 files-for-dist := README INSTALL configure ChangeLog NEWS
629
630 # Regenerate stuff, then error if these things are not committed yet.
631 dist-prepare: $(files-for-dist)
632 conf=`find sysdeps -name configure`; \
633 $(MAKE) $$conf && \
634 git diff --stat HEAD -- $^ $$conf \
635 | $(AWK) '{ print; rc=1 } END { exit rc }'
636
637 %.tar: FORCE
638 git archive --prefix=$*/ $* > $@.new
639 mv -f $@.new $@
640
641 # Do `make dist dist-version=X.Y.Z' to make tar files of an older version.
642
643 ifneq (,$(strip $(dist-version)))
644 dist: $(foreach Z,.bz2 .gz .xz,$(dist-version).tar$Z)
645 md5sum $^
646 else
647 dist: dist-prepare
648 @if v=`git describe`; then \
649 echo Distribution version $$v; \
650 $(MAKE) dist dist-version=$$v; \
651 else \
652 false; \
653 fi
654 endif
655
656 INSTALL: manual/install-plain.texi manual/macros.texi \
657 $(common-objpfx)manual/pkgvers.texi manual/install.texi
658 makeinfo --no-validate --plaintext --no-number-sections \
659 -I$(common-objpfx)manual $< -o $@-tmp
660 $(AWK) 'NF == 0 { ++n; next } \
661 NF != 0 { while (n-- > 0) print ""; n = 0; print }' \
662 < $@-tmp > $@-tmp2
663 rm -f $@-tmp
664 -chmod a-w $@-tmp2
665 mv -f $@-tmp2 $@
666 $(common-objpfx)manual/%: FORCE
667 $(MAKE) $(PARALLELMFLAGS) -C manual $@
668 FORCE:
669
670 iconvdata/% localedata/% po/%: FORCE
671 $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)