Script — template for describing interpreted scripts
Contents
Description
The template Script once expanded with a scriptname to creates rules for installing and removing a
single script written in an interpreted programming language.
If the script is a shellscript then it can be automatically checked with shellcheck, if available.
History
The Script template first appeared in zmk 0.1
Implementation Notes
Script uses InstallUninstall to handle installation and removal.
Name
Script — template for describing interpreted scripts
Synopsis
include z.mk
# scriptName is the name of the script file
$(eval $(call ZMK.Expand,Program,scriptName))
Targets
This module provides the following targets.
install
This phony target copies $(scriptName) to $(scriptName.InstallDir), with the name
$(scriptName.InstallName) and mode $(scriptName.InstallMode). The target directory is automatically
created if required.
The variables Configure.ProgramPrefix, Configure.ProgramSuffix and Configure.ProgramTransformName
automatically impact the installed names of all the scripts.
uninstall
This phony target removes $(scriptName) as installed by the install target.
static-check-shellcheck
This phony target uses shellcheck to perform static analysis of compatible scripts.
static-check
This phony target depends on the target static-check-shellcheck.
Variables
This module provides the following variables.
$(scriptName).Interpreter
Name of the script interpreter.
The default value is inferred from the extension of the file name.
$(scriptName).InstallDir
The directory $(scriptName) is installed to.
The default value is $(bindir). The special value noinst disables the rules related to installation and
uninstallation.
$(scriptName).InstallName
The name of the script after installation.
The default value is $(scriptName)$(scriptName).InstallMode
The UNIX mode $(scriptName) is installed with.
The default value is 0755.
DESTDIR
Path added to all installation targets.
This variable is normally set externally, to install a compiled program into a staging area during
construction of a compiled binary package.
