## automake - create Makefile.in from Makefile.am ## Copyright (C) 2001-2012 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, see . am.dist.common-files += %DIST-COMMON% ## Use 'sort', not 'am.util.uniq', for performance reasons. Luckily, we ## don't care in which order the distributed files are. am.dist.all-files = $(call am__memoize,am.dist.all-files,$(strip $(sort \ $(am.dist.common-files) $(am.dist.sources) $(TEXINFOS) $(EXTRA_DIST)))) ## Try to avoid repeated slashes in the entries, to make the filtering ## in the 'am.dist.files-tmp2' definition below more reliable. ## This idiom should compress up to four consecutive '/' characters ## in each $(am.dist.all-files) entry. am.dist.files-tmp1 = $(call am__memoize,am.dist.files-tmp1, \ $(subst //,/,$(subst //,/,$(am.dist.all-files)))) am.dist.files-tmp2 = $(call am__memoize,am.dist.files-tmp2, \ ## Files filtered out here require an ad-hoc "munging"; see the two ## following 'patsubst's. $(filter-out $(srcdir)/% $(top_srcdir)/%, $(am.dist.files-tmp1)) \ ## Let's strip leading $(srcdir) (which might appears in EXTRA_DIST, ## especially if one want to use the $(wildcard) built-in in there), ## so that in our 'distdir' recipe below we can loop on the list of ## distributed files and copy them in the distribution directory with ## a simple "cp $file $(distdir)/$file" -- which would break if $file ## contained a leading $(srcdir) component. ## However, it should be noted that this filtering has the undesirable ## side effect of triggering a VPATH search also for files specified ## *explicitly* with a $(srcdir) prefix; but this limitation is also ## present in mainstream Automake, and concerns only such corner-case ## situations that it's probably not worth worrying about. $(patsubst $(srcdir)/%, %, \ $(filter $(srcdir)/%, $(am.dist.files-tmp1))) \ ## Also rewrite $(top_srcdir) -- which can sometimes appear in ## $(am.dist.common-files), and can be absolute -- by $(top_builddir) ## (which is always relative). If needed, $(srcdir) will be ## prepended later by our VPATH-aware rules. ## The same caveats reported above apply. $(patsubst $(top_srcdir)/%, $(top_builddir)/%, \ $(filter $(top_srcdir)/%, $(am.dist.files-tmp1)))) ## Strip extra whitespaces, for more safety. am.dist.files-cooked = \ $(call am__memoize,am.dist.files-cooked,$(strip $(am.dist.files-tmp2))) ## Given the pre-processing done above to the list of distributed files, ## this definition ensures that we won't try to create the wrong ## directories when $(top_srcdir) or $(srcdir) appears in some entry of ## the list of all distributed files. ## For example, with EXTRA_DIST containing "$(srcdir)/subdir/file", this ## will allow our rules to correctly create "$(distdir)/subdir", and not ## "$(distdir)/$(srcdir)/subdir" -- which, in a VPATH build where ## "$(subdir) = ..", would be the build directory! am.dist.parent-dirs = \ $(call am__memoize,am.dist.parent-dirs,$(strip $(sort \ $(filter-out ., $(patsubst ./%,%,$(dir $(am.dist.files-cooked))))))) am.mkdir-for-dist = \ @$(MKDIR_P) $(patsubst %,"$(distdir)"/%,$1)$(am.chars.newline) am.write-list-of-distfiles = \ @lst='$1'; for x in $$lst; do echo $$x; done \ >> $(am__dir)/$@-list$(am.chars.newline) if %?TOPDIR_P% distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ ## On MSYS (1.0.17) it is not possible to remove a directory that is in ## use; so, if the first rm fails, we sleep some seconds and retry, to ## give pending processes some time to exit and "release" the directory ## before we remove it. The value of "some seconds" is 5 for the moment, ## which is mostly an arbitrary value, but seems high enough in practice. ## See automake bug#10470. || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) endif %?TOPDIR_P% if %?SUBDIRS% ## computes a relative pathname RELDIR such that DIR1/RELDIR = DIR2. ## Input: ## - DIR1 relative pathname, relative to the current directory ## - DIR2 relative pathname, relative to the current directory ## Output: ## - reldir relative pathname of DIR2, relative to DIR1 am.dist.relativize-path = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" endif %?SUBDIRS% .PHONY: distdir if %?SUBDIRS% AM_RECURSIVE_TARGETS += distdir endif %?SUBDIRS% distdir: $(am.dist.all-files) | $(am__dir) ## ## For Gnits users, this is pretty handy. Look at 15 lines ## in case some explanatory text is desirable. ## if %?TOPDIR_P% if %?CK-NEWS% @case `sed 15q $(srcdir)/NEWS` in \ *"$(VERSION)"*) : ;; \ *) \ echo "NEWS not updated; not releasing" 1>&2; \ exit 1;; \ esac endif %?CK-NEWS% endif %?TOPDIR_P% ## ## Only for the top dir. ## if %?TOPDIR_P% $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" endif %?TOPDIR_P% ## Make the subdirectories for the files, avoiding to exceed command ## line length limitations. $(call am.xargs-map,am.mkdir-for-dist,$(am.dist.parent-dirs)) ## Install the files and directories, applying a "VPATH rewrite" ## by hand where needed. ## To get the files in the distribution directory, use 'cp', not 'ln'. ## 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. @rm -f $(am__dir)/$@-list $(call am.xargs-map,am.write-list-of-distfiles, \ $(am.dist.files-cooked)) @while read file; do \ ## Always look for the file or directory to distribute in the build ## directory first, in VPATH spirit. if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ ## Don't mention $$file in the destination argument, since this fails if ## the destination directory already exists. Also, use '-R' and not '-r'. ## '-r' is almost always incorrect. ## If a directory exists both in '.' and $(srcdir), then we copy the ## files from $(srcdir) first and then install those from '.'. This ## can help people who distribute directories made of source files ## *and* generated files. dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ ## If the destination directory already exists, it may contain read-only ## files, e.g., during "make distcheck". if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ ## Test for file existence because sometimes a single auxiliary file ## is distributed from several Makefiles at once (see automake bug#9546 ## and bug#9651, and the follow-up commits 'v1.11-1219-g326ecba', ## 'v1.11-1220-g851b1ae' and 'v1.11-1221-gdccae6a'). See also test ## 't/dist-repeated.sh'. test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done < $(am__dir)/$@-list ## ## 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. if %?SUBDIRS% @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am.make.dry-run) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am.dist.relativize-path); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am.dist.relativize-path); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ (cd $$subdir && \ $(MAKE) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ ## Disable am__remove_distdir so that sub-packages do not clear a ## directory we have already cleared and might even have populated ## (e.g. shared AUX dir in the sub-package). am__remove_distdir=: \ ## Disable filename length check: am__skip_length_check=: \ ## No need to fix modes more than once: am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done endif %?SUBDIRS% ## ## 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. ## if %?DIST-TARGETS% $(MAKE) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ %DIST-TARGETS% endif %?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. ## ## 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. ## ## If we are being invoked recursively, then there is no need to walk ## the whole subtree again. This is a complexity reduction for a deep ## hierarchy of subpackages. ## if %?TOPDIR_P% -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" if %?FILENAME_FILTER% @if test -z "$(am__skip_length_check)" && find "$(distdir)" -type f -print | \ grep '^%FILENAME_FILTER%' 1>&2; then \ echo 'error: the above filenames are too long' 1>&2; \ exit 1; \ else :; fi endif %?FILENAME_FILTER% endif %?TOPDIR_P% ## --------------------------------------- ## ## 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. ## ## The -o option of GNU tar used to exclude empty directories. This ## behavior was fixed in tar 1.12 (released on 1997-04-25). But older ## versions of tar are still used (for instance NetBSD 1.6.1 ships ## with tar 1.11.2). We do not do anything specific w.r.t. this ## incompatibility since packages where empty directories need to be ## present in the archive are really unusual. ## ## We order DIST_TARGETS by expected duration of the compressors, ## slowest first, for better parallelism in "make dist". Do not ## reorder DIST_ARCHIVES, users may expect gzip to be first. if %?TOPDIR_P% ?GZIP?DIST_ARCHIVES += $(distdir).tar.gz GZIP_ENV = --best .PHONY: dist-gzip dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__post_remove_distdir) ?BZIP2?DIST_ARCHIVES += $(distdir).tar.bz2 .PHONY: dist-bzip2 dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) ?LZIP?DIST_ARCHIVES += $(distdir).tar.lz .PHONY: dist-lzip dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) ?XZ?DIST_ARCHIVES += $(distdir).tar.xz .PHONY: dist-xz dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) ?COMPRESS?DIST_ARCHIVES += $(distdir).tar.Z .PHONY: dist-tarZ dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) ?SHAR?DIST_ARCHIVES += $(distdir).shar.gz .PHONY: dist-shar dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__post_remove_distdir) ?ZIP?DIST_ARCHIVES += $(distdir).zip .PHONY: dist-zip dist-zip: distdir rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) ?LZIP?DIST_TARGETS += dist-lzip ?XZ?DIST_TARGETS += dist-xz ?SHAR?DIST_TARGETS += dist-shar ?BZIP2?DIST_TARGETS += dist-bzip2 ?GZIP?DIST_TARGETS += dist-gzip ?ZIP?DIST_TARGETS += dist-zip ?COMPRESS?DIST_TARGETS += dist-tarZ endif %?TOPDIR_P% ## ------------------------------------------------- ## ## Building all the requested distribution flavors. ## ## ------------------------------------------------- ## ## Currently we cannot use if/endif inside a rule. The file_contents ## parser needs work. if %?TOPDIR_P% .PHONY: dist dist-all if %?SUBDIRS% AM_RECURSIVE_TARGETS += dist dist-all endif %?SUBDIRS% dist dist-all: $(MAKE) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) endif %?TOPDIR_P% ## ------------------------- ## ## Checking a distribution. ## ## ------------------------- ## if %?TOPDIR_P% if %?SUBDIRS% AM_RECURSIVE_TARGETS += distcheck endif %?SUBDIRS% # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. .PHONY: distcheck distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac ## 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. chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst ## Undo the write access. chmod a-w $(distdir) ## With GNU make, the following command will be executed even with "make -n", ## due to the presence of '$(MAKE)'. That is normally all well (and '$(MAKE)' ## is necessary for things like parallel distcheck), but here we don't want ## execution. To avoid MAKEFLAGS parsing hassles, use a witness file that a ## non-'-n' run would have just created. test -d $(distdir)/_build || exit 0; \ ## Compute the absolute path of '_inst'. Strip any leading DOS drive ## to allow DESTDIR installations. Otherwise "$(DESTDIR)$(prefix)" would ## expand to "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst". dc_install_base=`cd $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ ## We will attempt a DESTDIR install in $dc_destdir. We don't ## create this directory under $dc_install_base, because it would ## create very long directory names. && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ ?DISTCHECK-HOOK? && $(MAKE) distcheck-hook \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ ?GETTEXT? --with-included-gettext \ ## Additional flags for configure. Keep this last in the configure ## invocation so the developer and user can override previous options, ## and let the user's flags take precedence over the developer's ones. $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) \ && $(MAKE) dvi \ && $(MAKE) check \ && $(MAKE) install \ && $(MAKE) installcheck \ && $(MAKE) uninstall \ && $(MAKE) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ ## Make sure the package has proper DESTDIR support (we could not test this ## in the previous install/installcheck/uninstall test, because it's reasonable ## for installcheck to fail in a DESTDIR install). ## We make the '$dc_install_base' read-only because this is where files ## with missing DESTDIR support are likely to be installed. && chmod -R a-w "$$dc_install_base" \ ## The logic here is quite convoluted because we must clean $dc_destdir ## whatever happens (it won't be erased by the next run of distcheck like ## $(distdir) is). && ({ \ ## Build the directory, so we can cd into it even if "make install" ## didn't create it. Use mkdir, not $(MKDIR_P) because we want to ## fail if the directory already exists (PR/413). (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) DESTDIR="$$dc_destdir" install \ && $(MAKE) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) dist \ ## Make sure to remove the dists we created in the test build directory. && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) distcleancheck $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' ## Define distuninstallcheck_listfiles and distuninstallcheck separately ## from distcheck, so that they can be overridden by the user. .PHONY: distuninstallcheck distuninstallcheck_listfiles = find . -type f -print ## The 'dir' file (created by install-info) might still exist after ## uninstall, so we must be prepared to account for it. The following ## check is not 100% strict, but is definitely good enough, and even ## accounts for overridden $(infodir). am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ cd '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 ## Define distcleancheck_listfiles and distcleancheck separately ## from distcheck, so that they can be overridden by the user. .PHONY: distcleancheck distcleancheck_listfiles = find . -type f -print distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 endif %?TOPDIR_P%