2001-06-16 Roland McGrath <roland@frob.com>
[platform/upstream/glibc.git] / Make-dist
index 01ef9c5..d8e5d94 100644 (file)
--- a/Make-dist
+++ b/Make-dist
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999,2000,01 Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
 # The GNU C Library is free software; you can redistribute it and/or
 # Library General Public License for more details.
 
 # You should have received a copy of the GNU Library General Public
-# License along with the GNU C Library; see the file COPYING.LIB.  If
-# not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-# Cambridge, MA 02139, USA.
+# License along with the GNU C Library; see the file COPYING.LIB.  If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
 
 dist:
 
+# Make the value empty so ifdef fails if it's $(-subdir).
+subdir := $(subdir)
 ifdef subdir
 .. := ../
 else
@@ -27,20 +29,28 @@ endif
 include $(..)Makeconfig
 
 foo:=$(shell echo 'distribute=$(distribute)'>&2)
+foo:=$(shell echo 'dont_distribute=$(dont_distribute)'>&2)
 foo:=$(shell echo 'foobar=$(filter %.c %.S %.s %.h,$(distribute))'>&2)
 
 ifndef sysdep_dirs
 # Find all sysdep directories.
-export sysdep_dirs := $(shell find $(..)sysdeps -type d \
-                                  ! -name CVS ! -name RCS -print)
+export sysdep_dirs := $(shell find $(..)sysdeps -type d ! -name bits \
+                                  ! -name CVS ! -name RCS \
+                                  ! -name SCCS -print)
 else
 # Defined by the parent.
 sysdep_dirs := $(addprefix $(..),$(sysdep_dirs))
 endif
 
+# Don't distribute add-on subdirs.
+subdirs := $(filter-out $(add-ons),$(subdirs))
+
 # Make sure both stdio and libio get in, whichever is in use.
 subdirs += stdio libio
 
+# Make sure both aout and elf get in, whichever is in use.
+subdirs += aout elf
+
 sysdep-Subdir-files := $(wildcard $(addsuffix /Subdirs,$(sysdep_dirs)))
 ifdef sysdep-Subdir-files
 subdirs := $(sort $(subdirs) \
@@ -56,34 +66,43 @@ all-headers = $(filter-out $(sysdep_headers),$(headers))
 else
 +distinfo := $(shell MAKEFLAGS= MFLAGS= $(MAKE) -s no_deps=t \
                     inhibit_interface_rules=t inhibit_mach_syscalls=t \
+                    inhibit_timezone_rules=t \
                     subdirs='$(subdirs)' echo-distinfo | grep -v '^make')
 foo:=$(shell echo>&2 '+distinfo=$(+distinfo)')
 all-headers := $(patsubst +header+%,%,$(filter +header+%,$(+distinfo)))
 # Ignore subdir headers without top-level indirections.
-all-headers := $(sort $(headers) $(wildcard $(all-headers)))
+all-headers := $(sort $(headers) \
+                     $(patsubst include/%,%,\
+                                $(wildcard $(addprefix include/,\
+                                                       $(all-headers)))))
+# Filter out names like ../conf/portability.h that would point outside
+# the source directory.
+all-headers := $(filter-out ../%,$(all-headers))
 +subdir-nodist := $(patsubst +nodist+%,%,$(filter +nodist+%,$(+distinfo)))
-+subdir-headers := $(filter-out $(headers),$(all-headers))
 endif
 foo:=$(shell echo 'IS THIS WORKING??? all-headers=$(all-headers)' >&2)
 
 sources += $(addsuffix .c,$(elided-routines) \
                          $(foreach l,$(extra-libs),$($l-routines)))
 
+sources += $(addsuffix .c, $(filter-out $(elided-routines), $(tests)))
+
 # Find all sysdep sources and headers.
 +maybe-sysdeps := $(sources) $(sources:.c=.s) $(sources:.c=.S) $(all-headers) \
                  $(filter %.c %.S %.s %.h %.sub,$(distribute))
 foo:=$(shell echo '+maybe-sysdeps=$(+maybe-sysdeps)'>&2)
-# Find all the files that have a stub or generic version.
-try-sysdeps := $(foreach dir,$(..)sysdeps/stub $(..)sysdeps/generic \
-                            $(..)sysdeps/libm-ieee754,\
+# Find all the files that have a generic version.
+generic-dirs = $(..)sysdeps/generic $(..)sysdeps/ieee754 \
+              $(..)sysdeps/ieee754/flt-32 $(..)sysdeps/ieee754/dbl-64 \
+              $(..)sysdeps/ieee754/ldbl-96 $(..)sysdeps/ieee754/ldbl-128
+try-sysdeps := $(foreach dir,$(generic-dirs),\
                             $(addprefix $(dir)/,$(+maybe-sysdeps)))
 foo:=$(shell echo 'try-sysdeps=$(try-sysdeps)'>&2)
 +sysdeps := $(wildcard $(try-sysdeps))
-foo:=$(shell echo 'stub/generic +sysdeps=$(+sysdeps)'>&2)
-+sysdep-names := $(sort $(patsubst $(..)sysdeps/generic/%,%,\
-                                  $(patsubst $(..)sysdeps/stub/%,%,\
-                                  $(patsubst $(..)sysdeps/libm-ieee754/%,%,\
-                                             $(+sysdeps)))))
+foo:=$(shell echo 'generic +sysdeps=$(+sysdeps)'>&2)
++sysdep-names := $(sort $(foreach dir, $(generic-dirs),\
+                                 $(patsubst $(dir)/%,%,\
+                                            $(filter $(dir)/%,$(+sysdeps)))))
 foo:=$(shell echo '+sysdep-names=$(+sysdep-names)' >&2)
 
 ifdef subdir-dirs
@@ -91,8 +110,8 @@ vpath % $(subdir-dirs)
 endif
 
 # Now find all the sysdep versions of those files.
-+sysdeps := $(wildcard $(foreach dir,$(sysdep_dirs) $(source_dirs),\
-                                $(addprefix $(dir)/, \
++sysdeps := $(foreach dir,$(sysdep_dirs) $(source_dirs),\
+                     $(wildcard $(addprefix $(dir)/, \
                                             $(+sysdep-names) \
                                             $(+sysdep-names:.c=.s) \
                                             $(+sysdep-names:.c=.S) \
@@ -106,29 +125,27 @@ sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
 
 +out := $(patsubst %.S,%.c,$(+sysdep-names:.s=.c)) \
        $(addsuffix .c,$(sysdep_routines)) \
-       $(+subdir-nodist)
-#foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
-+tsrcs := $(filter-out $(+out) $(addprefix %/,$(+out)), \
-                       $(sources) $(all-headers) $(distribute)) \
-          $(+sysdeps)
-foo:=$(shell echo made +tsrcs >&2)
+       $(+subdir-nodist) $(dont_distribute)
+foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
++tsrcs := $(filter-out $(+out), $(sources) $(all-headers)) $(+sysdeps)
+foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
 foo:=$(shell echo generated='$(generated)' >&2)
-generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
-foo:=$(shell echo now generated='$(generated)' >&2)
-+tsrcs := $(sort $(filter-out $(generated),$(+tsrcs)))
+#generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))
+#foo:=$(shell echo now generated='$(generated)' >&2)
++tsrcs := $(filter-out $(generated),$(+tsrcs))
++tsrcs := $(sort $(filter-out $(+out),$(+tsrcs) $(distribute)))
 foo:=$(shell echo '+tsrcs=$(+tsrcs)'>&2)
 foo:=$(shell echo foobie, dammit! >&2)
 
 ifndef tardir
--include $(common-objpfx)version.mk
 export tardir := glibc-$(version)
 endif
 
 $(..)glibc-$(version):
        ln -s . $@
 
-+tsrcs := $(+tsrcs) \
-         TAGS
+#+tsrcs := $(+tsrcs) \
+#        TAGS
 .PHONY: TAGS
 TAGS: $(..)MakeTAGS
        $(MAKE) -f $< $@ -o subdir_TAGS
@@ -137,10 +154,9 @@ ifdef         subdir
 
 foo:=$(shell echo subdir foo >&2)
 
-+tsrcs := Makefile $(+tsrcs)                           \
-         $(addsuffix .c,$(others) $(tests))            \
-         $(wildcard $(addsuffix .input,$(tests))       \
-         $(addsuffix .args,$(tests)))
++tsrcs := Makefile $(wildcard Versions) $(wildcard Depend) $(+tsrcs) \
+         $(addsuffix .c,$(others) $(test-srcs)) \
+         $(wildcard $(addsuffix .input,$(tests) $(test-srcs)))
 +tardeps := $(strip $(+tsrcs))
 
 verbose = v
@@ -150,7 +166,9 @@ dist: $(..)$(tardir) $(+tardeps)
        @cd ..; if test -f dist.tar; then c=u; else c=c; fi;    \
        $(+cmdecho) "cd ..; tar $${c}h$(verbose)f dist.tar ...";        \
        tar $${c}h$(verbose)f dist.tar \
-           $(addprefix $(tardir)/$(subdir)/,$(filter-out $<,$^))
+           $(addprefix $(tardir)/$(subdir)/,$(filter-out $< ../%,$^))  \
+           $(addprefix $(tardir)/,\
+                       $(patsubst ../%,%,$(filter-out $<,$(filter ../%,$^))))
 
 else   # Parent makefile.
 
@@ -166,42 +184,41 @@ foo:=$(shell echo +sysdep-distfiles='$(+sysdep-distfiles)'>&2)
                $(sysdep-Subdir-files)
 foo:=$(shell echo '+sysdep-dist=$(+sysdep-dist)' >&2)
 
-subdirs := $(filter-out crypt,$(subdirs))
-
-+sysdep-tsrcs := $(wildcard $(foreach file,Makefile Implies syscalls.list\
-                                          configure configure.in,\
++sysdep-tsrcs := $(wildcard $(foreach file,Makefile Makeconfig Implies \
+                                          configure configure.in Versions\
+                                          syscalls.list libm-test-ulps,\
                                      $(addsuffix /$(file),$(sysdep_dirs)))) \
                 $(+sysdep-dist)
 
-+tsrcs := $(+tsrcs) $(+sysdep-tsrcs)
++tsrcs := $(+tsrcs) $(+sysdep-tsrcs) $(wildcard $(+sysdep-names:%=include/%))
 
+ifeq ($(with-cvs),yes)
 define autoconf-it
 autoconf $(ACFLAGS) $< > $@.new
 mv -f $@.new $@
-test ! -d CVS || cvs commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
+test ! -d CVS || cvs $(CVSOPTS) commit -m'Regenerated: autoconf $(ACFLAGS) $<' $@
 endef
+else
+define autoconf-it
+autoconf $(ACFLAGS) $< > $@.new
+mv -f $@.new $@
+endef
+endif
 
 configure: configure.in aclocal.m4; $(autoconf-it)
 %/configure: %/configure.in aclocal.m4; $(autoconf-it)
 
-.PHONY: dist
-dist: $(tardir).tar.gz $(tardir)-crypt.tar.gz
-
-$(tardir)-crypt.tar.gz: crypt/crypt.tar.gz
-       ln $< $@
-crypt/%: FORCE
-       $(MAKE) -C $(@D) $(@F)
-FORCE:
+dist: $(tardir).tar.gz
 
 subdir_dist: dist.tar
-dist.tar: $(tardir) $(+tsrcs)
+dist.tar: README $(tardir) $(+tsrcs)
        tar chvf $@ $(addprefix $(tardir)/,$(filter-out $(tardir),$^))
 
 $(tardir).tar: dist.tar subdir_dist
        @echo Files listed here have names exceeding 14 chars.
-       tar xfv $< -C /tmp | sed -n '/[^/]\{15,\}/p'
-       tar covf $@ -C /tmp $(tardir)
-       -rm -fr /tmp/$(tardir) &
+       tar xfv $< -C $${TMPDIR-/tmp} | sed -n '/[^/]\{15,\}/p'
+       tar covf $@ -C $${TMPDIR-/tmp} $(tardir)
+       -rm -fr $${TMPDIR-/tmp}/$(tardir) dist.tar &
 
 %.Z: %
        compress -c $< > $@
@@ -217,12 +234,14 @@ $(dist-subdirs):
        $(MAKE) -C $(patsubst dist-%,%,$@) dist
 
 # This is here instead of in Makefile so it can use $(release) and $(version).
-README: README.template version.c
+README: README.template version.h
        -rm -f $@
        sed -e 's/RELEASE/$(release)/' -e 's/VERSION/$(version)/' < $< > $@
 # Make it unwritable so I won't change it by mistake.
        chmod 444 $@
-       test ! -d CVS || cvs commit -m'Remade for $(release)-$(version)' $@
+ifeq ($(with-cvs),yes)
+       test ! -d CVS || cvs $(CVSOPTS) commit -m'Remade for $(release)-$(version)' $@
+endif
 
 
 endif  # Subdirectory vs. parent makefile