summaryrefslogtreecommitdiff
path: root/Build/source/am
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2013-07-06 09:40:06 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2013-07-06 09:40:06 +0000
commit832b5ce3848de5ca76c493570fc066f450ec8011 (patch)
tree52b629b6cd51b3769658ae55dc1f511c0bcac222 /Build/source/am
parent7d7828afcc587d0e0889fb0a62cdfe25c53cb9d2 (diff)
build system: Move Makefile fragments from libs/am/ and texk/am/ to top-level/am.
git-svn-id: svn://tug.org/texlive/trunk@31117 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/am')
-rw-r--r--Build/source/am/bin_links.am35
-rw-r--r--Build/source/am/hdr_links.am20
-rw-r--r--Build/source/am/man.am52
-rw-r--r--Build/source/am/man1_links.am25
-rw-r--r--Build/source/am/rebuild.am33
-rw-r--r--Build/source/am/script_links.am87
6 files changed, 252 insertions, 0 deletions
diff --git a/Build/source/am/bin_links.am b/Build/source/am/bin_links.am
new file mode 100644
index 00000000000..3cb7406b603
--- /dev/null
+++ b/Build/source/am/bin_links.am
@@ -0,0 +1,35 @@
+## am/bin_links.am: Makefile fragment for bindir links.
+##
+## Copyright (C) 2011-2013 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+## requires conditional WIN32
+## requires $(bin_links)
+## Symlinks within $(bindir): FILE:LINK indicates LINK->FILE
+## for binaries and scripts use, e.g.,
+## binprog$(EXEEXT):foo
+## script:bar
+## respectively, such that the links created on cygwin are
+## 'foo->binprog.exe' and 'bar->script'.
+.PHONY: install-bin-links uninstall-bin-links
+
+install-bin-links:
+if !WIN32
+ @cd $(DESTDIR)$(bindir) && \
+ for s in $(bin_links); do \
+ link=`echo $$s | sed 's,.*:,,'`; \
+ file=`echo $$s | sed 's,:.*,,'`; \
+ rm -f $$link; \
+ echo "creating link '$$link' -> '$$file'"; \
+ $(LN_S) $$file $$link || exit 1; \
+ done
+endif !WIN32
+
+uninstall-bin-links:
+if !WIN32
+ @for s in $(bin_links); do \
+ link=`echo $$s | sed 's,.*:,,'`; \
+ rm -f $(DESTDIR)$(bindir)/$$link; \
+ done
+endif !WIN32
+
diff --git a/Build/source/am/hdr_links.am b/Build/source/am/hdr_links.am
new file mode 100644
index 00000000000..4985c32ca2a
--- /dev/null
+++ b/Build/source/am/hdr_links.am
@@ -0,0 +1,20 @@
+## am/hdr_links.am: Makefile fragment for header links.
+##
+## Copyright (C) 2012-2013 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+## requires $(hdr_links), `install' headers in the build tree.
+all-local:
+ @for file in $(hdr_links); do \
+ test -f $$file || continue; \
+ inst=`echo $$file | sed -e 's/^.*\///'`; \
+ test -f $$inst || { \
+ rm -f $$inst; \
+ if $(AM_V_P); then echo "$(LN_S) $$file $$inst"; \
+ else echo " INST $$inst"; fi; \
+ $(LN_S) $$file $$inst; } || exit 1; \
+ done
+
+distclean-local:
+ rm -f *.h
+
diff --git a/Build/source/am/man.am b/Build/source/am/man.am
new file mode 100644
index 00000000000..61ab0d30ee0
--- /dev/null
+++ b/Build/source/am/man.am
@@ -0,0 +1,52 @@
+## am/man.am: Makefile fragment for kpathsea and web2c manual pages.
+##
+## Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+## requires $(man_sources)
+## requires $(KPATHSEA_PATHS_H) giving the directory of kpathsea/paths.h
+
+SUFFIXES = .1 .man .ps .dvi
+
+.man.1:
+ $(AM_V_GEN)sed -f sedscript $< >$@
+man_files = $(man_sources:.man=.1)
+$(man_files): sedscript
+
+nodist_man1_MANS = $(man_files)
+
+# At present, all but VERSION should be unused.
+sedscript: $(KPATHSEA_PATHS_H)/kpathsea/paths.h
+ $(AM_V_GEN)( \
+ sed -n -e '/^#define/s/#define[ ][ ]*\([A-Z_a-z][A-Z_a-z]*\)[ ][ ]*\(.*\)/s%@\1@%\2%/p' \
+ $< \
+ | sed -e 's/"//g' -e 's/[ ]*\/\*[^*]*\*\///g'; \
+ echo 's%@VER''SION@%$(VERSION)%'; \
+ echo 's%@BINDIR@%$(bindir)%'; \
+ echo 's%@INFODIR@%$(infodir)%'; \
+ echo 's%@TEXINPUTDIR@%$(texinputdir)%'; \
+ echo 's%@MFINPUTDIR@%$(mfinputdir)%'; \
+ echo 's%@MPINPUTDIR@%$(mpinputdir)%'; \
+ echo 's%@FONTDIR@%$(fontdir)%'; \
+ echo 's%@FMTDIR@%$(fmtdir)%'; \
+ echo 's%@BASEDIR@%$(basedir)%'; \
+ echo 's%@MEMDIR@%$(memdir)%'; \
+ echo 's%@TEXPOOLDIR@%$(texpooldir)%'; \
+ echo 's%@MFPOOLDIR@%$(mfpooldir)%'; \
+ echo 's%@MPPOOLDIR@%$(mppooldir)%'; \
+ echo 's%@FONTMAPDIR@%$(dvipsdir)%'; \
+ echo 's%@LOCALMODES@%$(localmodes)%') >sedscript
+
+DITROFF = groff
+
+.1.dvi:
+ $(DITROFF) -Tdvi -man $< >$@
+DVIS = $(man_files:.1=.dvi)
+
+.1.ps:
+ $(DITROFF) -Tps -man $< >$@
+PSS = $(man_files:.1=.ps)
+
+DISTCLEANFILES = sedscript $(man_files) $(DVIS) $(PSS)
+
+## end of texk/am/man.am
diff --git a/Build/source/am/man1_links.am b/Build/source/am/man1_links.am
new file mode 100644
index 00000000000..d08b82591ce
--- /dev/null
+++ b/Build/source/am/man1_links.am
@@ -0,0 +1,25 @@
+## am/man1_links.am: Makefile fragment for manual page links.
+##
+## Copyright (C) 2011-2013 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+## requires $(man1_links)
+## Symlinks within $(man1dir): FILE:LINK indicates LINK.1->FILE.1
+.PHONY: install-man1-links uninstall-man1-links
+
+install-man1-links:
+ @cd $(DESTDIR)$(man1dir) && \
+ for s in $(man1_links); do \
+ link=`echo $$s | sed 's,.*:,,'`; \
+ file=`echo $$s | sed 's,:.*,,'`; \
+ rm -f $$link.1; \
+ echo "creating link '$$link.1' -> '$$file.1'"; \
+ echo ".so man1/$$file.1" >$$link.1; \
+ done
+
+uninstall-man1-links:
+ @for s in $(man1_links); do \
+ link=`echo $$s | sed 's,.*:,,'`; \
+ rm -f $(DESTDIR)$(man1dir)/$$link.1; \
+ done
+
diff --git a/Build/source/am/rebuild.am b/Build/source/am/rebuild.am
new file mode 100644
index 00000000000..9b53015b192
--- /dev/null
+++ b/Build/source/am/rebuild.am
@@ -0,0 +1,33 @@
+## am/rebuild.am: Makefile fragment to rebuild a library.
+##
+## Copyright (C) 2013 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+## requires $(rebuild_prereq), $(rebuild_target), and CLEANFILES.
+##
+## Serialize concurrent rebuild attempts
+## Compare Automake manual (info Automake) 27.9: Multiple Outputs
+##
+rebuild.stamp:
+ echo timestamp >$@
+
+.PHONY: rebuild
+rebuild: $(rebuild_prereq)
+ @dry=; for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=*|--*);; \
+ *n*) dry=:;; \
+ esac; \
+ done; \
+ $$dry rm -f rebuild.stamp; \
+ $$dry trap 'rm -rf rebuild.lock' 1 2 13 15; \
+ if $$dry mkdir rebuild.lock 2>/dev/null; then \
+ $(MAKE) $(AM_MAKEFLAGS) $(rebuild_target) rebuild.stamp; \
+ $$dry rmdir rebuild.lock; \
+ else \
+ while test -d rebuild.lock && test -z "$$dry"; do sleep 1; done; \
+ fi; \
+ $$dry test -f rebuild.stamp
+
+CLEANFILES += rebuild.stamp
+
diff --git a/Build/source/am/script_links.am b/Build/source/am/script_links.am
new file mode 100644
index 00000000000..102d56707d0
--- /dev/null
+++ b/Build/source/am/script_links.am
@@ -0,0 +1,87 @@
+## am/script_links.am: Makefile fragment for lua/perl/shell script links.
+##
+## Copyright (C) 2011-2013 Peter Breitenlohner <tex-live@tug.org>
+## You may freely use, modify and/or distribute this file.
+##
+## Install/uninstall 'linked scripts' or win32 wrappers:
+## Add the prerequisite uninstall-links to uninstall-hook and one or
+## or more of install-{perl,shell,sh}-scripts to install-data-hook
+##
+## The sh_scripts are special because they have no corresponding
+## win32 wrapper, whereas shell_scripts do have such wrappers.
+##
+## requires conditionals WIN32 and WIN32_WRAP
+## requires $(scriptsdir): e.g., texmf/scripts/chktex
+## appends to $(nodist_bin_SCRIPTS) and $(EXTRA_DIST)
+##
+## install-lua-scripts requires $(lua_scripts), e.g., pmx2pdf
+## install-perl-scripts requires $(perl_scripts), e.g., deweb
+## install-shell-scripts requires $(shell_scripts), e.g. htlatex
+## install-sh-scripts requires $(sh_scripts), e.g. getafm
+##
+.PHONY: install-lua-links install-perl-links install-shell-links install-sh-links \
+ install-links uninstall-links
+
+all_scripts = $(lua_scripts) $(perl_scripts) $(shell_scripts)
+
+if WIN32
+if WIN32_WRAP
+## We treat the WIN32 wrappers as SCRIPTS to avoid automatic build rules
+wrappers = $(all_scripts:=.exe)
+nodist_bin_SCRIPTS += $(wrappers)
+runscript = $(top_srcdir)/../../texk/texlive/w32_wrapper/runscript.exe
+$(wrappers): $(runscript)
+ $(AM_V_GEN)$(LN_S) $(runscript) $@
+endif WIN32_WRAP
+endif WIN32
+
+install-lua-links:
+if !WIN32
+ $(MAKE) $(AM_MAKEFLAGS) TYPE=lua EXT=lua install-links
+endif !WIN32
+
+install-perl-links:
+if !WIN32
+ $(MAKE) $(AM_MAKEFLAGS) TYPE=perl EXT=pl install-links
+endif !WIN32
+
+install-shell-links:
+if !WIN32
+ $(MAKE) $(AM_MAKEFLAGS) TYPE=shell EXT=sh install-links
+endif !WIN32
+
+install-sh-links:
+if !WIN32
+ $(MAKE) $(AM_MAKEFLAGS) TYPE=sh EXT=sh install-links
+endif !WIN32
+
+EXTRA_DIST += $(top_builddir)/../../build-aux/relpath
+
+# We support native builds, multiplatform or not, as well as distro builds.
+install-links:
+ @relpath="$(top_srcdir)/../../build-aux/relpath"; \
+ test -r $$relpath || { \
+ echo 'script_links.am:install-links: could not find relpath script'; \
+ exit 1; \
+ }; \
+ REL=`$(SHELL) $$relpath '$(DESTDIR)' '$(bindir)' '$(datarootdir)'`; \
+ if test -z "$$REL"; then \
+ echo 'script_links.am:install_links: unable to compute relative path for linked $(TYPE) scripts' >&2; \
+ exit 1; \
+ fi; \
+ cd $(DESTDIR)$(bindir) && \
+ for f in $($(TYPE)_scripts); do \
+ rm -f $$f; \
+ if $(AM_V_P); then echo "creating link '$$f' -> '$$REL/$(scriptsdir)/$$f.$(EXT)'"; \
+ else echo " LINK $$f"; fi; \
+ $(LN_S) $$REL/$(scriptsdir)/$$f.$(EXT) $$f || exit 1; \
+ done
+
+uninstall-links:
+if !WIN32
+ @for f in $(all_scripts) $(sh_scripts); do \
+ echo "rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+endif !WIN32
+