Edit

kc3-lang/automake/distdir.am

Branch :

  • Show log

    Commit

  • Author : Akim Demaille
    Date : 2001-02-27 09:12:42
    Hash : e8133bcf
    Message : Distinguish automake substitutions from config.status substitutions. * automake.in (&add_depend2): Transform AMDEP. (&handle_clean): Transform MCFILES and MFILES. (&file_contents): Transform MAINTAINER_MODE. (&transform, &am_install_var): Use `%', not `@'. Adjust all the *.am files. * clean.am: Use ?MFILES? instead of ad hoc MAINTAINERCLEAN. * depend2.am: Display the double dependency on both ?AMDEP? and @AMDEP@.

  • distdir.am
  • ## automake - create Makefile.in from Makefile.am
    ## Copyright 2001 Free Software Foundation, Inc.
    
    ## This program is free software; you can redistribute it and/or modify
    ## it under the terms of the GNU General Public License as published by
    ## the Free Software Foundation; either version 2, or (at your option)
    ## any later version.
    
    ## This program is distributed in the hope that it will be useful,
    ## but WITHOUT ANY WARRANTY; without even the implied warranty of
    ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ## GNU General Public License for more details.
    
    ## You should have received a copy of the GNU General Public License
    ## along with this program; if not, write to the Free Software
    ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
    ## 02111-1307, USA.
    
    .PHONY: distdir
    
    PACKAGE = @PACKAGE@
    VERSION = @VERSION@
    
    ## DIST_COMMON comes first so that README can be the very first file.
    DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
    
    top_distdir = %TOP_DISTDIR%
    ?DISTDIR?distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
    
    distdir: $(DISTFILES)
    ##
    ## For Gnits users, this is pretty handy.  Look at 15 lines
    ## in case some explanatory text is desirable.
    ##
    ?TOPDIR??CK-NEWS?	@if sed 15q $(srcdir)/NEWS | fgrep -e "$(VERSION)" >/dev/null; then :; else \
    ?TOPDIR??CK-NEWS?	  echo "NEWS not updated; not releasing" 1>&2; \
    ?TOPDIR??CK-NEWS?	  exit 1; \
    ?TOPDIR??CK-NEWS?	fi
    ##
    ## Only for the top dir.
    ##
    ?TOPDIR?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
    ?TOPDIR?	mkdir $(distdir)
    ##
    ##
    ?DISTDIRS?	$(mkinstalldirs) %DISTDIRS%
    ##
    ##
    	@for file in $(DISTFILES); do \
    ##
    ## In loop, test for file existence because sometimes a file gets
    ## included in DISTFILES twice.  For example this happens when a single
    ## source file is used in building more than one program.  Also, there
    ## are situations in which "ln" can fail.  For instance a file to
    ## distribute could actually be a cross-filesystem symlink -- this can
    ## easily happen if "gettextize" was run on the distribution.
    ##
    ?CYGNUS?	  if test -f $$file; then d=.; else d=$(srcdir); fi; \
    ?!CYGNUS?	  d=$(srcdir); \
    ##
    	  if test -d $$d/$$file; then \
    ## Don't mention $$file in destination argument, since this fails if
    ## destination directory already exists.  Also, use `-R' and not `-r'.
    ## `-r' is almost always incorrect.
    	    cp -pR $$d/$$file $(distdir) \
    	    || exit 1; \
    	  else \
    	    test -f $(distdir)/$$file \
    	    || cp -p $$d/$$file $(distdir)/$$file \
    	    || exit 1; \
    	  fi; \
    	done
    ##
    ## Test for directory existence here because previous automake
    ## invocation might have created some directories.  Note that we
    ## explicitly set distdir for the subdir make; that lets us mix-n-match
    ## many automake-using packages into one large package, and have "dist"
    ## at the top level do the right thing.  If we're in the topmost
    ## directory, then we use `distdir' instead of `top_distdir'; this lets
    ## us work correctly with an enclosing package.
    ##
    ?SUBDIRS?	for subdir in $(%DIST_SUBDIR_NAME%); do \
    ?SUBDIRS?	  if test "$$subdir" = .; then :; else \
    ?SUBDIRS?	    test -d $(distdir)/$$subdir \
    ?SUBDIRS?	    || mkdir $(distdir)/$$subdir \
    ?SUBDIRS?	    || exit 1; \
    ?SUBDIRS?	    (cd $$subdir && \
    ?SUBDIRS?	      $(MAKE) $(AM_MAKEFLAGS) \
    ?SUBDIRS?	        top_distdir="$(top_distdir)" \
    ?SUBDIRS?	        distdir=../$(distdir)/$$subdir \
    ?SUBDIRS?	        distdir) \
    ?SUBDIRS?	      || exit 1; \
    ?SUBDIRS?	  fi; \
    ?SUBDIRS?	done
    ##
    ## We might have to perform some last second updates, such as updating
    ## info files.
    ## We must explicitly set distdir and top_distdir for these sub-makes.
    ##
    ?DIST-TARGETS?	$(MAKE) $(AM_MAKEFLAGS) \
    ?DIST-TARGETS?	  top_distdir="${top_distdir}" distdir="$(distdir)" \
    ?DIST-TARGETS?	  %DIST-TARGETS%
    ##
    ## This complex find command will try to avoid changing the modes of
    ## links into the source tree, in case they're hard-linked.  It will
    ## also make directories writable by everybody, because some
    ## brain-dead tar implementations change ownership and permissions of
    ## a directory before extracting the files, thus becoming unable to
    ## extract them.
    ##
    ## Ignore return result from chmod, because it might give an error
    ## if we chmod a symlink.
    ##
    ## Another nastiness: if the file is unreadable by us, we make it
    ## readable regardless of the number of links to it.  This only
    ## happens in perverse cases.
    ##
    ## We use $(install_sh) because that is a known-portable way to modify
    ## the file in place in the source tree.
    ##
    ?TOPDIR?	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
    ?TOPDIR?	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
    ?TOPDIR?	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
    ?TOPDIR?	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
    ?TOPDIR?	|| chmod -R a+r $(distdir)
    
    
    
    
    ## --------------------------------------- ##
    ## Building various distribution flavors.  ##
    ## --------------------------------------- ##
    
    ## Note that we don't use GNU tar's `-z' option.  One reason (but not
    ## the only reason) is that some versions of tar (e.g., OSF1)
    ## interpret `-z' differently.
    
    ?TOPDIR?GZIP_ENV = --best
    ?TOPDIR?.PHONY: dist-all dist
    ?TOPDIR?dist-all: dist
    ?TOPDIR?dist: distdir
    ?TOPDIR?	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
    ?TOPDIR?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
    
    
    ?TOPDIR??BZIP2?.PHONY dist-all: dist-bzip2
    ?TOPDIR??BZIP2?dist-bzip2: distdir
    ?TOPDIR??BZIP2?	$(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
    ?TOPDIR??BZIP2?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
    
    
    ?TOPDIR??COMPRESS?.PHONY dist-all: dist-tarZ
    ?TOPDIR??COMPRESS?dist-tarZ: distdir
    ?TOPDIR??COMPRESS?	$(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z
    ?TOPDIR??COMPRESS?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
    
    
    ?TOPDIR??SHAR?.PHONY dist-all: dist-shar
    ?TOPDIR??SHAR?dist-shar: distdir
    ?TOPDIR??SHAR?	shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
    ?TOPDIR??SHAR?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
    
    
    ?TOPDIR??ZIP?.PHONY dist-all: dist-zip
    ?TOPDIR??ZIP?dist-zip: distdir
    ?TOPDIR??ZIP?	-rm -f $(distdir).zip
    ?TOPDIR??ZIP?	zip -rq $(distdir).zip $(distdir)
    ?TOPDIR??ZIP?	-chmod -R a+w $(distdir) >/dev/null 2>&1; rm -rf $(distdir)
    
    
    
    ## ------------------------- ##
    ## Checking a distribution.  ##
    ## ------------------------- ##
    
    
    ?TOPDIR?# This target untars the dist file and tries a VPATH configuration.  Then
    ?TOPDIR?# it guarantees that the distribution is self-contained by making another
    ?TOPDIR?# tarfile.
    ?TOPDIR?.PHONY: distcheck
    ?TOPDIR?distcheck: dist
    ## Make sure we can remove distdir before trying to remove it.
    ?TOPDIR?	-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
    ?TOPDIR?	GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
    ## Make the new source tree read-only.  Distributions ought to work in
    ## this case.  However, make the top-level directory writable so we
    ## can make our new subdirs.
    ?TOPDIR?	chmod -R a-w $(distdir); chmod a+w $(distdir)
    ?TOPDIR?	mkdir $(distdir)/=build
    ?TOPDIR?	mkdir $(distdir)/=inst
    ## Undo the write access.
    ?TOPDIR?	chmod a-w $(distdir)
    ?TOPDIR?	dc_install_base=`CDPATH=: && cd $(distdir)/=inst && pwd` \
    ?TOPDIR??DISTCHECK-HOOK?	  && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
    ?TOPDIR?	  && cd $(distdir)/=build \
    ?TOPDIR?	  && ../configure --srcdir=.. --prefix=$$dc_install_base \
    ?TOPDIR??GETTEXT?	    --with-included-gettext \
    ?TOPDIR?	  && $(MAKE) $(AM_MAKEFLAGS) \
    ?TOPDIR?	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
    ?TOPDIR?	  && $(MAKE) $(AM_MAKEFLAGS) check \
    ?TOPDIR?	  && $(MAKE) $(AM_MAKEFLAGS) install \
    ?TOPDIR?	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
    ?TOPDIR?	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
    ## We use -le 1 because the `dir' file might still exist after uninstall.
    ?TOPDIR?	  && test `find $$dc_install_base -type f -print | wc -l` -le 1 \
    ?TOPDIR?	  && $(MAKE) $(AM_MAKEFLAGS) dist \
    ?TOPDIR?	  && $(MAKE) $(AM_MAKEFLAGS) distclean \
    ## Make sure to remove the dist file we created in the test build
    ## directory.
    ?TOPDIR?	  && rm -f $(distdir).tar.gz \
    ?TOPDIR?	  && (test `find . -type f -print | wc -l` -eq 0 \
    ?TOPDIR?	     || (echo "Error: files left after distclean" 1>&2; \
    ?TOPDIR?	         exit 1) )
    ?TOPDIR?	-chmod -R a+w $(distdir) > /dev/null 2>&1; rm -rf $(distdir)
    ?TOPDIR?	@echo "$(distdir).tar.gz is ready for distribution" | \
    ?TOPDIR?	  sed 'h;s/./=/g;p;x;p;x'