1 ## am/script_links.am: Makefile fragment for lua/perl/shell script links.
3 ## Copyright (C) 2011-2014 Peter Breitenlohner <tex-live@tug.org>
4 ## You may freely use, modify and/or distribute this file.
6 ## Install/uninstall 'linked scripts' or win32 wrappers:
7 ## Add the prerequisite uninstall-links to uninstall-hook and one or
8 ## or more of install-{perl,shell,sh}-scripts to install-data-hook
10 ## The sh_scripts are special because they have no corresponding
11 ## win32 wrapper, whereas shell_scripts do have such wrappers.
13 ## requires conditionals WIN32 and WIN32_WRAP
14 ## requires $(scriptsdir): e.g., texmf/scripts/chktex
15 ## appends to $(nodist_bin_SCRIPTS) and $(EXTRA_DIST)
17 ## install-lua-scripts requires $(lua_scripts), e.g., pmx2pdf
18 ## install-perl-scripts requires $(perl_scripts), e.g., deweb
19 ## install-shell-scripts requires $(shell_scripts), e.g. htlatex
20 ## install-sh-scripts requires $(sh_scripts), e.g. getafm
22 .PHONY: install-lua-links install-perl-links install-shell-links install-sh-links \
23 install-links uninstall-links
25 all_scripts = $(lua_scripts) $(perl_scripts) $(shell_scripts)
29 ## We treat the WIN32 wrappers as SCRIPTS to avoid automatic build rules
30 wrappers = $(all_scripts:=.exe)
31 nodist_bin_SCRIPTS += $(wrappers)
32 runscript = $(top_srcdir)/../../texk/texlive/$(WIN_WRAPPER)/runscript.exe
33 $(wrappers): $(runscript)
34 $(AM_V_GEN)$(LN_S) $(runscript) $@
40 $(MAKE) $(AM_MAKEFLAGS) TYPE=lua EXT=lua install-links
45 $(MAKE) $(AM_MAKEFLAGS) TYPE=perl EXT=pl install-links
50 $(MAKE) $(AM_MAKEFLAGS) TYPE=shell EXT=sh install-links
55 $(MAKE) $(AM_MAKEFLAGS) TYPE=sh EXT=sh install-links
58 EXTRA_DIST += $(top_builddir)/../../build-aux/relpath
60 # We support native builds, multiplatform or not, as well as distro builds.
62 @relpath="$(top_srcdir)/../../build-aux/relpath"; \
63 test -r $$relpath || { \
64 echo 'script_links.am:install-links: could not find relpath script'; \
67 REL=`$(SHELL) $$relpath '$(DESTDIR)' '$(bindir)' '$(datarootdir)'`; \
68 if test -z "$$REL"; then \
69 echo 'script_links.am:install_links: unable to compute relative path for linked $(TYPE) scripts' >&2; \
72 cd $(DESTDIR)$(bindir) && \
73 for f in $($(TYPE)_scripts); do \
75 if $(AM_V_P); then echo "creating link '$$f' -> '$$REL/$(scriptsdir)/$$f.$(EXT)'"; \
76 else echo " LINK $$f"; fi; \
77 $(LN_S) $$REL/$(scriptsdir)/$$f.$(EXT) $$f || exit 1; \
82 @for f in $(all_scripts) $(sh_scripts); do \
83 echo "rm -f '$(DESTDIR)$(bindir)/$$f'"; \
84 rm -f "$(DESTDIR)$(bindir)/$$f"; \