aboutsummaryrefslogtreecommitdiffstats
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/README28
-rw-r--r--mk/all.mk27
-rw-r--r--mk/clean.mk21
-rw-r--r--mk/configure719
-rw-r--r--mk/copy.mk8
-rw-r--r--mk/dist.mk35
-rw-r--r--mk/empty.mk8
-rw-r--r--mk/i18n.mk17
-rw-r--r--mk/lang-c.mk32
-rw-r--r--mk/lowerpath.mk279
-rw-r--r--mk/man.mk23
-rw-r--r--mk/path.mk66
-rw-r--r--mk/prologue.mk16
-rw-r--r--mk/texinfo.mk100
-rw-r--r--mk/tools.mk91
15 files changed, 1334 insertions, 136 deletions
diff --git a/mk/README b/mk/README
index fd27fd0..e79926d 100644
--- a/mk/README
+++ b/mk/README
@@ -4,9 +4,6 @@ Please feel free to use them in your project.
Usage:
Include all.mk from your makefile.
- It is a good idea to include path.mk before you define
- path variables.
-
Read the top of each file for details.
Define the variables:
@@ -47,3 +44,28 @@ Usage:
Variables that do not begin with _ are configurable
by the user of the package.
+ Do no use single character variables in your Makefile.
+
+ To suppress pre-install, post-install, pre-uninstall,
+ and post-uninstall instructions, set N=true.
+ PRE_INSTALL, POST_INSTALL, PRE_UNINSTALL, and
+ POST_UNINSTALL are supportered as specified by the
+ GNU coding standardars.
+
+ To figure out what pre-install commands to run in your package, run:
+ make -n a=% install | sed -e 's/\\$//' -e 's/^ *//' | sed -n '/^% /s/^..//p'
+
+ To figure out what post-install commands to run in your package, run:
+ make -n z=% uninstall | sed -e 's/\\$//' -e 's/^ *//' | sed -n '/^% /s/^..//p'
+
+ To figure out what pre-uninstall commands to run in your package, run:
+ make -n a=% uninstall | sed -e 's/\\$//' -e 's/^ *//' | sed -n '/^% /s/^..//p'
+
+ To figure out what post-uninstall commands to run in your package, run:
+ make -n z=% uninstall | sed -e 's/\\$//' -e 's/^ *//' | sed -n '/^% /s/^..//p'
+
+ To suppress verbatim which commands Make runs,
+ set Q=@. (Excluding the period.)
+
+Developers should use DEBUG=1 when running make, when possible.
+
diff --git a/mk/all.mk b/mk/all.mk
index 7b00995..f6cad42 100644
--- a/mk/all.mk
+++ b/mk/all.mk
@@ -8,20 +8,25 @@
#=== This file includes all the other files in appropriate order. ===#
+
ifndef Q
A = \e[35m
Z = 
endif
-include mk/path.mk
-include mk/empty.mk
-include mk/tools.mk
-include mk/copy.mk
-include mk/lang-c.mk
-include mk/texinfo.mk
-include mk/man.mk
-include mk/i18n.mk
-include mk/clean.mk
-include mk/dist.mk
-include mk/tags.mk
+include $(v)mk/path.mk
+include .config.mk
+include $(v)mk/path.mk
+include $(v)mk/lowerpath.mk
+include $(v)mk/empty.mk
+include $(v)mk/tools.mk
+include $(v)mk/copy.mk
+include $(v)mk/lang-c.mk
+include $(v)mk/texinfo.mk
+include $(v)mk/man.mk
+include $(v)mk/i18n.mk
+include $(v)mk/clean.mk
+include $(v)mk/dist.mk
+include $(v)mk/tags.mk
+include $(v)mk/prologue.mk
diff --git a/mk/clean.mk b/mk/clean.mk
index 4d6d1a4..d0a97c4 100644
--- a/mk/clean.mk
+++ b/mk/clean.mk
@@ -11,15 +11,17 @@
# Delete all files are normally created during a build.
.PHONY: clean
-clean:
- @$(PRINTF_INFO) '\e[00;01;31mCLEANING\e[34m\e[00m\n'
- -$(Q)$(RM) -r bin obj $(PKGNAME)-*.tar* $(PKGNAME)-*.checksums*
+clean: clean-dist
+ @$(PRINTF_INFO) '\e[00;01;31mCLEANING BUILT FILES\e[34m\e[00m\n'
+ -$(Q)$(RM) -r -- bin aux
@$(ECHO)
-# Delete all files that are created during configuration.
-# Note, this, for some reason, should not imply `make clean`.
+# Delete all files that are created during configuration or building.
.PHONY: distclean
-distclean:
+distclean: clean
+ @$(PRINTF_INFO) '\e[00;01;31mCLEANING CONFIGURATIONS\e[34m\e[00m\n'
+ -$(Q)$(RM) -- .config.mk config.status Makefile
+ @$(ECHO)
# Like `make clean` but do not remove massive binaries
# that are seldom recompiled.
@@ -34,3 +36,10 @@ maintainer-clean: clean distclean
@$(ECHO) 'deletes files that may need special tools to rebuild.'
@$(ECHO)
+# Delete all files generated by `make dist`
+.PHONY: clean-dist
+clean-dist:
+ @$(PRINTF_INFO) '\e[00;01;31mCLEANING RELEASES\e[34m\e[00m\n'
+ -$(Q)$(RM) -r -- $(_PROJECT)-*.tar* $(_PROJECT)-*.checksums* $(_PROJECT)-*
+ @$(ECHO)
+
diff --git a/mk/configure b/mk/configure
new file mode 100644
index 0000000..61f73e6
--- /dev/null
+++ b/mk/configure
@@ -0,0 +1,719 @@
+# -*- shell-script -*-
+
+# Copyright (C) 2015 Mattias Andrée <maandree@member.fsf.org>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+
+
+# Run './configure --help' for usage information.
+
+
+# FOR DEVELOPERS USING THIS SCRIPT:
+# This file is used by include this file, via the . builtin,
+# in your ./configure. Before doing so, you must declare
+# PKGNAME=the_name_of_your_package
+# MAN_SECTION_SUFFIX=default_suffix_to_append_to_man_page_section # (usually empty)
+# MAN_SECTION=the_section_your_man_page_is_in # (do no declare if you do not use exacly one section)
+# Define the function list_optional_features_help, see the help output.
+# Define the function unrecognised_argument to deal with any unrecognised argument.
+
+
+
+# Store command for rebuilding Makefile to config.status.
+exec 10>config.status
+
+# Store configurations to .config.mk.
+exec 20>.config.mk
+
+
+# Parse command line.
+incomplete=
+dashed=
+f_help=
+f_gnulinux=
+f_bin_merger=
+for option; do
+ if test -n "${incomplete}"; then
+ option="${incomplete}=${option}"
+ incomplete=
+ fi
+
+ # For --{with{,out},{en,dis}able}-*.
+ feature="${option#--*}"
+ feature="${feature#*-}"
+ feature="$(echo "${feature}" | tr qwertyuiopasdfghjklzxcvbnm- QWERTYUIOPASDFGHJKLZXCVBNM_)"
+
+ # For directories and filename tweaks.
+ nodash=_novar
+
+ case "${dashed}${option}" in
+# general
+ (--)
+ dashed=yes ;;
+ (--help)
+ f_help=yes ;;
+ (--destdir | --destdir=* | --pkgdir | --pkgdir=*)
+ nodash=destdir ;;
+ (--srcdir | --srcdir)
+ nodash=srcdir ;;
+
+# directory automation
+ (--gnu-linux)
+ f_gnulinux=yes ;;
+ (--bin-merger)
+ f_bin_merger=yes ;;
+
+# directories and filenames
+ (--prefix | --prefix=*)
+ nodash=prefix ;;
+ (--exec-prefix | --exec-prefix=* | --exec_prefix | --exec_prefix=*)
+ nodash=exec_prefix ;;
+ (--bindir | --bindir=*)
+ nodash=bindir ;;
+ (--sbindir | --sbindir=*)
+ nodash=sbindir ;;
+ (--libexecdir | --libexecdir=*)
+ nodash=libexecdir ;;
+ (--libdir | --libdir=*)
+ nodash=libdir ;;
+ (--includedir | --includedir=*)
+ nodash=includedir ;;
+ (--oldincludedir | --oldincludedir=*)
+ nodash=oldincludedir ;;
+ (--datarootdir | --datarootdir=*)
+ nodash=datarootdir ;;
+ (--datadir | --datadir=*)
+ nodash=datadir ;;
+ (--libdatarootdir | --libdatarootdir=*)
+ nodash=libdatarootdir ;;
+ (--libdatadir | --libdatadir=*)
+ nodash=libdatadir ;;
+ (--sysconfdir | --sysconfdir=*)
+ nodash=sysconfdir ;;
+ (--sharedstatedir | --=sharedstatedir*)
+ nodash=sharedstatedir ;;
+ (--localstatedir | --localstatedir=*)
+ nodash=localstatedir ;;
+ (--runstatedir | --runstatedir=*)
+ nodash=runstatedir ;;
+ (--lispdir | --lispdir=*)
+ nodash=lispdir ;;
+ (--localedir | --localedir=*)
+ nodash=localedir ;;
+ (--licensedir | --licensedir=*)
+ nodash=licensedir ;;
+ (--emptydir | --emptydir=*)
+ nodash=emptydir ;;
+ (--cachedir | --cachedir=*)
+ nodash=cachedir ;;
+ (--spooldir | --spooldir=*)
+ nodash=spooldir ;;
+ (--logdir | --logdir=*)
+ nodash=logdir ;;
+ (--statedir | --statedir=*)
+ nodash=statedir ;;
+ (--gamedir | --gamedir=*)
+ nodash=gamedir ;;
+ (--sharedcachedir | --sharedcachedir=*)
+ nodash=sharedcachedir ;;
+ (--sharedspooldir | --sharedspooldir=*)
+ nodash=sharedspooldir ;;
+ (--sharedlogdir | --sharedlogdir=*)
+ nodash=sharedlogdir ;;
+ (--sharedstatedir | --sharedstatedir=*)
+ nodash=sharedstatedir ;;
+ (--sharedgamedir | --sharedgamedir=*)
+ nodash=sharedgamedir ;;
+ (--tmpdir | --tmpdir=*)
+ nodash=tmpdir ;;
+ (--localtmpdir | --localtmpdir=*)
+ nodash=localtmpdir ;;
+ (--sharedtmpdir | --sharedtmpdir=*)
+ nodash=sharedtmpdir ;;
+ (--lockdir | --lockdir=*)
+ nodash=lockdir ;;
+ (--skeldir | --skeldir=*)
+ nodash=skeldir ;;
+ (--devdir | --devdir=*)
+ nodash=devdir ;;
+ (--sysdir | --sysdir=*)
+ nodash=sysdir ;;
+ (--procdir | --procdir=*)
+ nodash=procdir ;;
+ (--selfprocdir | --selfprocdir=*)
+ nodash=selfprocdir ;;
+ (--docdir | --docdir=*)
+ nodash=docdir ;;
+ (--infodir | --infodir=*)
+ nodash=infodir ;;
+ (--dvidir | --dvidir=*)
+ nodash=dvidir ;;
+ (--pdfdir | --pdfdir=*)
+ nodash=pdfdir ;;
+ (--psdir | --psdir=*)
+ nodash=psdir ;;
+ (--htmldir | --htmldir=*)
+ nodash=htmldir ;;
+ (--mandir | --mandir=*)
+ nodash=mandir ;;
+ (--man0 | --man0=*)
+ nodash=man0 ;;
+ (--man1 | --man1=*)
+ nodash=man1 ;;
+ (--man2 | --man2=*)
+ nodash=man2 ;;
+ (--man3 | --man3=*)
+ nodash=man3 ;;
+ (--man4 | --man4=*)
+ nodash=man4 ;;
+ (--man5 | --man5=*)
+ nodash=man5 ;;
+ (--man6 | --man6=*)
+ nodash=man6 ;;
+ (--man7 | --man7=*)
+ nodash=man7 ;;
+ (--man8 | --man8=*)
+ nodash=man8 ;;
+ (--man9 | --man9=*)
+ nodash=man9 ;;
+ (--man0ext | --man0ext=*)
+ nodash=man0ext ;;
+ (--man1ext | --man1ext=*)
+ nodash=man1ext ;;
+ (--man2ext | --man2ext=*)
+ nodash=man2ext ;;
+ (--man3ext | --man3ext=*)
+ nodash=man3ext ;;
+ (--man4ext | --man4ext=*)
+ nodash=man4ext ;;
+ (--man5ext | --man5ext=*)
+ nodash=man5ext ;;
+ (--man6ext | --man6ext=*)
+ nodash=man6ext ;;
+ (--man7ext | --man7ext=*)
+ nodash=man7ext ;;
+ (--man8ext | --man8ext=*)
+ nodash=man8ext ;;
+ (--man9ext | --man9ext=*)
+ nodash=man9ext ;;
+ (--manext | --manext=*)
+ if test -n "${MAN_SECTION}"; then
+ nodash=manext
+ else
+ printf "\e[01;31m%s: warning: ignoring: %s\e[00m\n" "${0}" "${option}" >&2
+ sleep 1
+ fi
+ ;;
+
+# ignored
+ # Unrecognised directories, and settings that cannot be used with internationalisation.
+ (--*dir=* | --*dir | --man?dir | --man?dir=*)
+ printf "\e[01;31m%s: warning: ignoring: %s\e[00m\n" "${0}" "${option}" >&2
+ sleep 1
+ ;;
+
+# feature tweaking
+ (--with-*)
+ feature="WITH_${feature}"
+ echo "${feature}" = yes >&20
+ export "${feature}"=yes
+ ;;
+
+ (--without-*)
+ feature="WITHOUT_${feature}"
+ echo "${feature}" = yes >&20
+ export "${feature}"=yes
+ ;;
+
+ (--enable-*=*)
+ param="${feature#*=}"
+ feature="${feature%%=*}"
+ if ! test "${param}" = "no"; then
+ feature="ENABLE_${feature}"
+ else
+ feature="DISABLE_${feature}"
+ param=yes
+ fi
+ echo "${feature}" = "${param}" >&20
+ export "${feature}"="${param}"
+ ;;
+
+ (--enable-*)
+ feature="DISABLE_${feature}"
+ echo "${feature}" = yes >&20
+ export "${feature}"=yes
+ ;;
+
+ (--disable-*)
+ feature="DISABLE_${feature}"
+ echo "${feature}" = yes >&20
+ export "${feature}"=yes
+ ;;
+
+# unrecognised
+ (${dashed}--*)
+ unrecognised_argument "${option}"
+ ;;
+
+# variables
+ (${dashed}*=*)
+ var="${option%%=*}"
+ val="${option#*=}"
+ if test -n "$(echo "${var}" | tr -d '[_a-zA-Z0-9-]')"; then
+ # Variable is not used and is potentially not
+ # formatted in a compatible way.
+ printf "\e[01;31m%s: warning: ignoring because of bad format: %s\e[00m\n" "${0}" "${option}" >&2
+ sleep 1
+ fi
+ echo "${var}" = "${val}" >&20
+ ;;
+
+# unrecognised
+ (*)
+ unrecognised_argument "${option}"
+ ;;
+ esac
+
+ if test "${option%%=*}" = "${option}"; then
+ incomplete="${option}"
+ else
+ eval "${nodash}=${option#*=}"
+ eval "have_${nodash}=yes"
+ fi
+done
+
+
+# Print usage information. This is parsed by
+# the auto-completion script for ./configure.
+if test -n "${f_help}"; then
+ cat <<EOF
+Configure the package (${PKGNAME}) before building and installing.
+
+OPTIONS
+
+general
+ --help Print usage information.
+ --destdir=DIR Output directory for staged install.
+ --srcdir=DIR The directory for the sources being compiled.
+ VARIABLE=VALUE Override a variable in the Makefile.
+
+directory automation
+ --gnu-linux Use default configurations for GNU/Linux.
+ --bin-merger The OS distribution has symlinked sbin to bin for the select exec-prefix.
+
+tweaking of features
+EOF
+ list_optional_features_help
+ cat <<EOF
+
+tweaking of directories and filenames
+ --prefix=DIR Prefix used for other directories than.
+ --exec-prefix=DIR Prefix used for /bin, /sbin, /libexec, and /lib.
+ --bindir=DIR Executable programs that users can run.
+ --sbindir=DIR Executable administrative programs.
+ --libexecdir=DIR Executable programs run by other programs and not be users.
+ --libdir=DIR Object files and libraries of object code.
+ --includedir=DIR Header files.
+ --oldincludedir=DIR Header files. Should have the prefix /usr if the canonical prefix is /usr/local.
+ --datarootdir=DIR Architecture-independent data files.
+ --datadir=DIR Architecture-independent resource files.
+ --libdatarootdir=DIR Architecture-dependent data files.
+ --libdatadir=DIR Architecture-dependent resource files.
+ --sysconfdir=DIR Machine-local configuration files.
+ --sharedstatedir=DIR Network-shared architecture-independent state files.
+ --localstatedir=DIR Machine-local architecture-independent state files.
+ --runstatedir=DIR Machine-local runtime state files.
+ --lispdir=DIR Emacs LISP files.
+ --localedir=DIR Locale-specific message catalogues.
+ --licensedir=DIR License files.
+ --emptydir=DIR An always empty directory.
+ --cachedir=DIR Machine-local cached files.
+ --spooldir=DIR Machine-local spooled files.
+ --logdir=DIR Machine-local log files
+ --statedir=DIR Machine-local persistent state files
+ --gamedir=DIR Machine-local highscore files.
+ --sharedcachedir=DIR Network-shared cached files.
+ --sharedspooldir=DIR Network-shared spooled files.
+ --sharedlogdir=DIR Network-shared log files
+ --sharedstatedir=DIR Network-shared persistent state files
+ --sharedgamedir=DIR Network-shared highscore files.
+ --tmpdir=DIR Machine-local volatile temporary files.
+ --localtmpdir=DIR Machine-local persistent temporary files.
+ --sharedtmpdir=DIR Network-shared temporary files.
+ --lockdir=DIR Lock files.
+ --skeldir=DIR User skeleton.
+ --devdir=DIR Devices and pseudo-devices.
+ --sysdir=DIR System-information logical file.
+ --procdir=DIR Process-information logical file.
+ --selfprocdir=DIR Process-information logical file for the process itself.
+ --docdir=DIR Documentation files, other then info manuals and man pages.
+ --infodir=DIR Info manuals.
+ --dvidir=DIR DVI manuals.
+ --pdfdir=DIR PDF manuals.
+ --psdir=DIR PostScript manuals.
+ --htmldir=DIR HTML manuals.
+ --mandir=DIR Top-level directory for man pages.
+ --man0=DIR Basename of the directory for section 0 man pages.
+ --man1=DIR Basename of the directory for section 1 man pages.
+ --man2=DIR Basename of the directory for section 2 man pages.
+ --man3=DIR Basename of the directory for section 3 man pages.
+ --man4=DIR Basename of the directory for section 4 man pages.
+ --man5=DIR Basename of the directory for section 5 man pages.
+ --man6=DIR Basename of the directory for section 6 man pages.
+ --man7=DIR Basename of the directory for section 7 man pages.
+ --man8=DIR Basename of the directory for section 8 man pages.
+ --man9=DIR Basename of the directory for section 9 man pages.
+EOF
+ if test -n "${MAN_SECTION}"; then
+ cat <<EOF
+ --manext=EXT Filename suffix for the man page.
+EOF
+ fi
+ cat <<EOF
+ --man0ext=EXT Filename suffix for section 0 man pages.
+ --man1ext=EXT Filename suffix for section 1 man pages.
+ --man2ext=EXT Filename suffix for section 2 man pages.
+ --man3ext=EXT Filename suffix for section 3 man pages.
+ --man4ext=EXT Filename suffix for section 4 man pages.
+ --man5ext=EXT Filename suffix for section 5 man pages.
+ --man6ext=EXT Filename suffix for section 6 man pages.
+ --man7ext=EXT Filename suffix for section 7 man pages.
+ --man8ext=EXT Filename suffix for section 8 man pages.
+ --man9ext=EXT Filename suffix for section 9 man pages.
+EOF
+ exit 0
+fi
+
+
+# Set unset directories to their default.
+defdir ()
+{
+ p="${2}"
+ if ! test "${p%%\'*}" = "${p}"; then
+ p="$(echo "${p}" | sed "s/'/'\\\\''/g")"
+ p="'${p}'"
+ p="$(echo "${p}" | sed "s/'/'\\\\''/g")"
+ elif ! test "$(printf '%s' ${p})" = "${p}"; then
+ p="'${p}'"
+ p="$(echo "${p}" | sed "s/'/'\\\\''/g")"
+ fi
+ if ! test -n "$(eval echo '${have_'"${1}"'}')"; then
+ eval "${1}='${p}'"
+ fi
+}
+if test -n "${f_gnulinux}"; then
+ defdir prefix "/usr"
+ _prefix=
+ case ${prefix} in
+ ('' | / | /usr | /usr/ | /games | /games | /usr/games | /usr/games/)
+ _infix=
+ ;;
+ (/usr/local | /usr/local/ | /usr/local/games | /usr/local/games/)
+ _infix=/local
+ ;;
+ (/opt/*)
+ _infix=${prefix}
+ ;;
+ (*)
+ # This probably means somewhere in /home, we do not
+ # checked because we do not know what else to do.
+ _infix=
+ _prefix="${prefix}"
+ ;;
+ esac
+ defdir sysconfdir "${_prefix}/etc${_infix}"
+ defdir sharedstatedir "${_prefix}/com${_infix}"
+ defdir localstatedir "${_prefix}/var${_infix}"
+ defdir runstatedir "${_prefix}/run${_infix}"
+ defdir tmpdir "${_prefix}/tmp${_infix}"
+else
+ defdir prefix "/usr/local"
+ defdir sysconfdir "${prefix}/etc"
+ defdir sharedstatedir "${prefix}/com"
+ defdir localstatedir "${prefix}/var"
+ defdir runstatedir "${localstatedir}/run"
+ defdir tmpdir "${prefix}/tmp"
+fi
+defdir exec_prefix "${prefix}"
+defdir bindir "${exec_prefix}/bin"
+if test -n "${f_bin_merger}"; then
+ defdir sbindir "${bindir}"
+else
+ defdir sbindir "${exec_prefix}/sbin"
+fi
+defdir libexecdir "${exec_prefix}/libexec"
+defdir libdir "${exec_prefix}/lib"
+defdir includedir "${prefix}/include"
+defdir oldincludedir "${includedir}"
+defdir datarootdir "${prefix}/share"
+defdir datadir "${datarootdir}"
+defdir libdatarootdir "${libdir}"
+defdir libdatadir "${libdir}"
+defdir lispdir "${datarootdir}/emacs/site-lisp"
+defdir localedir "${datarootdir}/locale"
+defdir licensedir "${datarootdir}/licenses"
+defdir cachedir "${localstatedir}/cache"
+defdir spooldir "${localstatedir}/spool"
+defdir emptydir "${localstatedir}/empty"
+defdir logdir "${localstatedir}/log"
+defdir statedir "${localstatedir}/lib"
+defdir gamedir "${localstatedir}/games"
+defdir sharedcachedir "${sharedstatedir}/cache"
+defdir sharedpooldir "${sharedstatedir}/spool"
+defdir sharedlogdir "${sharedstatedir}/log"
+defdir sharedstatedir "${sharedstatedir}/lib"
+defdir sharedgamedir "${sharedstatedir}/games"
+defdir localtmpdir "${localstatedir}/tmp"
+defdir sharedtmpdir "${sharedstatedir}/tmp"
+defdir lockdir "${runstatedir}/lock"
+defdir skeldir "${sysconfdir}/skel"
+defdir devdir "/dev"
+defdir sysdir "/sys"
+defdir procdir "/proc"
+defdir selfprocdir "${procdir}/self"
+defdir docdir "${datarootdir}/doc/${PKGNAME}"
+defdir infodir "${datarootdir}/info"
+defdir dvidir "${docdir}"
+defdir pdfdir "${docdir}"
+defdir psdir "${docdir}"
+defdir htmldir "${docdir}"
+defdir mandir "${datarootdir}/man"
+defdir man0 "man0${MAN_SECTION_SUFFIX}"
+defdir man1 "man1${MAN_SECTION_SUFFIX}"
+defdir man2 "man2${MAN_SECTION_SUFFIX}"
+defdir man3 "man3${MAN_SECTION_SUFFIX}"
+defdir man4 "man4${MAN_SECTION_SUFFIX}"
+defdir man5 "man5${MAN_SECTION_SUFFIX}"
+defdir man6 "man6${MAN_SECTION_SUFFIX}"
+defdir man7 "man7${MAN_SECTION_SUFFIX}"
+defdir man8 "man8${MAN_SECTION_SUFFIX}"
+defdir man9 "man9${MAN_SECTION_SUFFIX}"
+if test -n "${MAN_SECTION}" && ! test -n "$(eval echo '${man'"${MAN_SECTION}"'ext}')"; then
+ defdir man${MAN_SECTION}ext "$(eval echo '${man'"${MAN_SECTION}"'ext}')"
+fi
+defdir man0ext ".0"
+defdir man1ext ".1"
+defdir man2ext ".2"
+defdir man3ext ".3"
+defdir man4ext ".4"
+defdir man5ext ".5"
+defdir man6ext ".6"
+defdir man7ext ".7"
+defdir man8ext ".8"
+defdir man9ext ".9"
+
+# Found source directory.
+if ! test -n "${srcdir}"; then
+ if test -f "Makefile.in"; then
+ :
+ elif test -f "${PWD}/Makefile.in"; then
+ srcdir="${PWD}"
+ elif test -f "${PWD}/../Makefile.in"; then
+ srcdir="${PWD}/.."
+ fi
+fi
+if test -n "${srcdir}"; then
+ srcdir="$(realpath "${srcdir}")/"
+ srcdir_proper="${srcdir}"
+ if ! test "${srcdir%%\'*}" = "${srcdir}"; then
+ srcdir="$(echo "${srcdir}" | sed "s/'/'\\\\''/g")"
+ srcdir="'${srcdir}'"
+ elif ! test "$(printf '%s' ${srcdir})" = "${srcdir}"; then
+ srcdir="'${srcdir}'"
+ fi
+fi
+if ! test -f "${srcdir_proper}Makefile.in"; then
+ echo "${0}: error: cannot found source directory."
+ exit 1
+fi
+
+
+# Add shebang and "generated"-comment to config.status.
+echo '#!/bin/sh' >&10
+echo >&10
+echo '# This file was generated by ./configure, its purpose is two-fold:' >&10
+echo '# 1) It lets you rebuild Makefile with the same configurations you' >&10
+echo '# used last time you run ./configure.' >&10
+echo '# 2) It lets Makefile rebuild itself transparently when out of date.' >&10
+echo >&10
+
+# config.status should adjust CWD.
+echo 'cd "$(dirname "${0}")"' >&10
+
+# config.status calls ./configure with all arguments you called ./configure.
+echo "exec ${0}" "$@" >&10
+
+# Close config.status.
+exec 10>&-
+
+
+# Store environment (with restrictions).
+env | while read line; do
+ var="${line%%=*}"
+ val="${line#*=}"
+ if test "${var}" = "${line}"; then
+ # Malformated variables. (Can happen!, sigh...)
+ continue
+ elif test -n "$(echo "${var}" | tr -d '[_a-zA-Z0-9-]')"; then
+ # Variable is not used and is potentially not
+ # formatted in a compatible way.
+ continue
+ fi
+ case "${var}" in
+ (_ | PWD | SHELL | SHLVL | TERM | COLORTERM | MAKEFLAGS)
+ # We do not want to propagate these.
+ ;;
+ (*)
+ echo "${var}" = "${val}" >&20
+ ;;
+ esac
+done
+
+# Store directories and filenames.
+if test -n "${destdir}"; then
+ echo DESTDIR = "${destdir}" >&20
+fi
+echo PREFIX = "${prefix}" >&20
+echo SYSCONFDIR = "${sysconfdir}" >&20
+echo COMDIR = "${sharedstatedir}" >&20
+echo VARDIR = "${localstatedir}" >&20
+echo RUNDIR = "${runstatedir}" >&20
+echo TMPDIR = "${tmpdir}" >&20
+echo DEVDIR = "${devdir}" >&20
+echo SYSDIR = "${sysdir}" >&20
+echo PROCDIR = "${procdir}" >&20
+echo EXEC_PREFIX = "${exec_prefix}" >&20
+echo BINDIR = "${bindir}" >&20
+echo SBINDIR = "${sbindir}" >&20
+echo LIBEXECDIR = "${libexecdir}" >&20
+echo LIBDIR = "${libdir}" >&20
+echo INCLUDEDIR = "${includedir}" >&20
+echo OLDINCLUDEDIR = "${oldincludedir}" >&20
+echo DATADIR = "${datarootdir}" >&20
+echo RESDIR = "${datadir}" >&20
+echo SYSDEPDATADIR = "${libdatarootdir}" >&20
+echo SYSDEPRESDIR = "${libdatadir}" >&20
+echo LISPDIR = "${lispdir}" >&20
+echo LOCALEDIR = "${localedir}" >&20
+echo LICENSEDIR = "${licensedir}" >&20
+echo CACHEDIR = "${cachedir}" >&20
+echo SPOOLDIR = "${spooldir}" >&20
+echo EMPTYDIR = "${emptydir}" >&20
+echo LOGDIR = "${logdir}" >&20
+echo STATEDIR = "${statedir}" >&20
+echo GAMEDIR = "${gamedir}" >&20
+echo COMCACHEDIR = "${sharedcachedir}" >&20
+echo COMPOOLDIR = "${sharedpooldir}" >&20
+echo COMLOGDIR = "${sharedlogdir}" >&20
+echo COMSTATEDIR = "${sharedstatedir}" >&20
+echo COMGAMEDIR = "${sharedgamedir}" >&20
+echo LOCALTMPDIR = "${localtmpdir}" >&20
+echo SHAREDTMPDIR = "${sharedtmpdir}" >&20
+echo LOCKDIR = "${lockdir}" >&20
+echo SKELDIR = "${skeldir}" >&20
+echo SELFPROCDIR = "${selfprocdir}" >&20
+echo DOCDIR = "${docdir}" >&20
+echo INFODIR = "${infodir}" >&20
+echo DVIDIR = "${dvidir}" >&20
+echo PDFDIR = "${pdfdir}" >&20
+echo PSDIR = "${psdir}" >&20
+echo HTMLDIR = "${htmldir}" >&20
+echo MANDIR = "${mandir}" >&20
+echo MAN0 = "${man0}" >&20
+echo MAN1 = "${man1}" >&20
+echo MAN2 = "${man2}" >&20
+echo MAN3 = "${man3}" >&20
+echo MAN4 = "${man4}" >&20
+echo MAN5 = "${man5}" >&20
+echo MAN6 = "${man6}" >&20
+echo MAN7 = "${man7}" >&20
+echo MAN8 = "${man8}" >&20
+echo MAN9 = "${man9}" >&20
+echo MAN0EXT = "${man0ext}" >&20
+echo MAN1EXT = "${man1ext}" >&20
+echo MAN2EXT = "${man2ext}" >&20
+echo MAN3EXT = "${man3ext}" >&20
+echo MAN4EXT = "${man4ext}" >&20
+echo MAN5EXT = "${man5ext}" >&20
+echo MAN6EXT = "${man6ext}" >&20
+echo MAN7EXT = "${man7ext}" >&20
+echo MAN8EXT = "${man8ext}" >&20
+echo MAN9EXT = "${man9ext}" >&20
+
+# Close .config.mk.
+exec 20>&-
+
+# Now, make Makefile available.
+if test -f Makefile; then
+ chmod u+w Makefile # This scripts makes it read-only.
+fi
+exec 30>Makefile
+echo "# ----------------------------------------------------- #" >&30
+echo "# This file was created by ./configure from Makefile.in #" >&30
+echo "# ----------------------------------------------------- #" >&30
+echo >&30
+if test -n "${srcdir}"; then
+ echo v = "${srcdir}" >&30
+fi
+cat "${srcdir_proper}"Makefile.in >&30
+exec 30>&-
+
+
+# config.status should be executable.
+chmod a+x config.status
+
+# Makefile should be read-only to ones does not edit it by mistake.
+chmod a-w Makefile
+
+
+# Help functions for the parent script.
+test_with ()
+{
+ with="$(eval echo '${WITH_'"${1}"'}')"
+ without="$(eval echo '${WITHOUT_'"${1}"'}')"
+ if ! test -n "${with}" && ! test -n "${without}"; then
+ echo "${2}"
+ elif ! test -n "${with}" && test -n "${without}"; then
+ echo "no"
+ elif test -n "${with}" && ! test -n "${without}"; then
+ echo "yes"
+ elif test "${2}" = yes; then
+ echo "no"
+ else
+ echo "yes"
+ fi
+}
+test_enable ()
+{
+ enable="$(eval echo '${ENABLE_'"${1}"'}')"
+ disable="$(eval echo '${DISABLE_'"${1}"'}')"
+ if ! test -n "${enable}" && ! test -n "${disable}"; then
+ echo "${2}"
+ elif ! test -n "${enable}" && test -n "${disable}"; then
+ echo "no"
+ elif test -n "${enable}" && ! test -n "${disable}"; then
+ echo "${enable}"
+ elif test "${2}" = yes ; then
+ echo "no"
+ else
+ echo "${enable}"
+ fi
+}
+
+
+# After including this file, you may want
+# to do something like:
+#
+# cat <<EOF
+#
+# Enabled features, see ${0} for more infomation:
+#
+# Internationalisation $(test_with GETTEXT yes)
+#
+# You can now run 'make && make install'.
+#
+# EOF
+
diff --git a/mk/copy.mk b/mk/copy.mk
index c27604f..1579193 100644
--- a/mk/copy.mk
+++ b/mk/copy.mk
@@ -31,19 +31,19 @@ ifdef _COPYING
install-copyright: install-copying
.PHONY: install-copying
-install-copying: $(_COPYING)
+install-copying: $(foreach F,$(_COPYING),$(v)$(F))
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
$(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
$(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
@$(ECHO_EMPTY)
endif
-ifdef _COPYING
+ifdef _LICENSE
.PHONY: install-copyright
install-copyright: install-license
.PHONY: install-license
-install-license: $(_LICENSE)
+install-license: $(foreach F,$(_LICENSE),$(v)$(F))
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
$(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
$(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
@@ -66,7 +66,7 @@ uninstall-copying:
-$(Q)$(RMDIR) -- "$(DESTDIR)$(LICENSEDIR)/$(PKGNAME)"
endif
-ifdef _COPYING
+ifdef _LICENSE
.PHONY: uninstall-copyright
uninstall-copyright: uninstall-license
diff --git a/mk/dist.mk b/mk/dist.mk
index 34b5f13..a2a3edf 100644
--- a/mk/dist.mk
+++ b/mk/dist.mk
@@ -27,10 +27,29 @@ GPG_FLAGS =
# What key should be used for signing?
GPG_KEY ?=
+# You should define _EVERYTHING to enumerate all files that belong in
+# the release tarball, lest 'git archive' will be used as a fallback.
+
# HELP VARIALES:
+# You may use these to help list all files in _EVERYTHING
+__EVERYTHING_COMMON = $(_COPYING) $(_LICENSE) README
+__EVERYTHING_SRC = $(foreach F,$(_SRC),src/$(F))
+__EVERYTHING_LOCALE = $(foreach L,$(LOCALES),po/$(L).po)
+__EVERYTHING_MK_ = all clean copy dist empty i18n lang-c lowerpath man path prologue tags texinfo tools
+__EVERYTHING_MK = $(foreach F,$(__EVERYTHING_MK_),mk/$(F).mk) mk/configure mk/README configure Makefile.in
+__EVERYTHING_MAN = $(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),doc/man/$(P).$(S))) \
+ $(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach L,$(MAN_LOCALES),$(foreach P,$(_MAN_$(L)_$(S)),doc/man/$(P).$(L).$(S))))
+__EVERYTHING_ALL_COMMON = $(__EVERYTHING_COMMON) $(__EVERYTHING_MK) $(__EVERYTHING_MAN) \
+ $(__EVERYTHING_LOCALE) $(__EVERYTHING_SRC)
+# This one (__todo) if you have a todo file, but do not want it to be greped.
+__TO__ = TO
+__DO__ = DO
+__todo = $(__TO__)$(__DO__)
+
+
# The packages and there detached signatures (if any.)
ifndef DO_NOT_SIGN
__DIST_FILES = $(foreach F,$(DIST_FORMATS),$(_PROJECT)-$(_VERSION).$(F) $(_PROJECT)-$(_VERSION).$(F).sig)
@@ -109,10 +128,20 @@ dist-gz: $(_PROJECT)-$(_VERSION).tar.gz
endif
# Generate the tarball for the release.
-$(_PROJECT)-$(_VERSION).tar:
- @$(PRINTF_INFO) '\e[00;01;31mARCHIVE\e[34m %s\e[00m$A\n' "$@"
+ifdef v
+__GIT_DIR = --git-dir=$(v)
+endif
+$(_PROJECT)-$(_VERSION).tar: $(foreach F,$(_EVERYTHING),$(v)$(F))
+ @$(PRINTF_INFO) '\e[00;01;31mTAR\e[34m %s\e[00m$A\n' "$@"
@if $(TEST) -f $@; then $(RM) $@; fi
- $(Q)git archive --prefix=$(_PROJECT)-$(_VERSION)/ --format=tar $(_VERSION) -o $@ #$Z
+ifndef _EVERYTHING
+ $(Q)git archive --prefix=$(_PROJECT)-$(_VERSION)/ --format=tar $(__GIT_DIR) $(_VERSION) -o $@ #$Z
+endif
+ifdef _EVERYTHING
+ $(Q)$(LN) -s . $(_PROJECT)-$(_VERSION)
+ $(Q)$(TAR) c -- $(foreach F,$(_EVERYTHING),$(v)$(_PROJECT)-$(_VERSION)/$(F)) > $@
+ $(Q)$(RM) $(_PROJECT)-$(_VERSION)
+endif
@$(ECHO_EMPTY)
# Compression rule for xz-compression. Used on the tarball.
diff --git a/mk/empty.mk b/mk/empty.mk
index 6e95a1e..81c06fb 100644
--- a/mk/empty.mk
+++ b/mk/empty.mk
@@ -25,6 +25,10 @@ cmd:
doc:
+.PHONY: check
+check:
+
+
.PHONY: install
install:
@@ -41,6 +45,10 @@ install-cmd:
install-doc:
+.PHONY: installcheck
+installcheck:
+
+
.PHONY: uninstall
uninstall:
diff --git a/mk/i18n.mk b/mk/i18n.mk
index 842377b..cc27903 100644
--- a/mk/i18n.mk
+++ b/mk/i18n.mk
@@ -19,6 +19,9 @@
#
# If WITHOUT_GETTEXT is defined, `locale` and
# `install-locale` will not do anything.
+#
+# _SRC should list all sources files, excluding the src/
+# at the beginning of the pathnames.
ifdef LOCALES
@@ -50,9 +53,9 @@ endif
update-po: $(foreach L,$(LOCALES),po/$(L).po)
# Generate template for translations.
-obj/$(_PROJECT).pot: $(foreach S,$(_SRC),src/$(S).c)
+aux/$(_PROJECT).pot: $(foreach S,$(_SRC),$(v)src/$(S))
@$(PRINTF_INFO) '\e[00;01;31mPOT\e[34m %s\e[00m$A\n' "$@"
- @$(MKDIR) -p obj
+ @$(MKDIR) -p aux
$(Q)$(CPP) -DUSE_GETTEXT=1 $^ | \
$(XGETTEXT) -o "$@" -Lc --from-code utf-8 --package-name "$(_PROJECT_FULL)" \
--package-version $(_VERSION) --no-wrap --force-po \
@@ -60,22 +63,22 @@ obj/$(_PROJECT).pot: $(foreach S,$(_SRC),src/$(S).c)
@$(ECHO_EMPTY)
# Create or update a translation file.
-po/%.po: obj/$(_PROJECT).pot
+po/%.po: aux/$(_PROJECT).pot
@$(PRINTF_INFO) '\e[00;01;31mPO\e[34m %s\e[00m$A\n' "$@"
@$(MKDIR) -p po
$(Q)if ! $(TEST) -e $@; then \
- $(MSGINIT) --no-translator --no-wrap -i $< -o $@ -l $*; \
+ $(MSGINIT) --no-translator --no-wrap -i aux/$(_PROJECT).pot -o $@ -l $*; \
else \
- $(MSGMERGE) --no-wrap -U $@ $<; \
+ $(MSGMERGE) --no-wrap -U $@ aux/$(_PROJECT).pot; \
fi #$Z
@$(TOUCH) $@
@$(ECHO_EMPTY)
# Compile a translation file.
-bin/mo/%/messages.mo: po/%.po
+bin/mo/%/messages.mo: $(v)po/%.po
@$(PRINTF_INFO) '\e[00;01;31mMO\e[34m %s\e[00m$A\n' "$@"
@$(MKDIR) -p bin/mo/$*
- $(Q)cd bin/mo/$* && $(MSGFMT) ../../../$< #$Z
+ $(Q)cd bin/mo/$* && $(MSGFMT) $(__back3unless_v)$< #$Z
@$(ECHO_EMPTY)
diff --git a/mk/lang-c.mk b/mk/lang-c.mk
index 9d5dc8d..83e305b 100644
--- a/mk/lang-c.mk
+++ b/mk/lang-c.mk
@@ -34,7 +34,7 @@
# should be the basenames. For each command
# you should be the variable _OBJ_$(COMMAND)
# that lists all objects files (without the
-# suffix and without the obj/ prefix) that
+# suffix and without the aux/ prefix) that
# are required to build the command.
@@ -60,12 +60,12 @@ endif
# BUILD VARIABLES:
# Optimisation settings for C code compilation.
-ifdef DEBUG
-OPTIMISE = -Og -g
+ifndef DEBUG
+OPTIMISE = -O2 -g
endif
ifndef DEBUG
-ifndef OPTIMISE
-OPTIMISE = -O2
+ifdef OPTIMISE
+OPTIMISE = -Og -g
endif
endif
@@ -73,6 +73,10 @@ endif
ifdef _PEDANTIC
_PEDANTIC = -pedantic
endif
+ifndef DEBUG
+WARN = -Wall
+endif
+ifdef DEBUG
ifdef __USING_GCC
WARN = -Wall -Wextra $(_PEDANTIC) -Wdouble-promotion -Wformat=2 -Winit-self -Wmissing-include-dirs \
-Wtrampolines -Wmissing-prototypes -Wmissing-declarations -Wnested-externs \
@@ -89,6 +93,7 @@ endif
ifndef __USING_GCC
WARN = -Wall -Wextra $(_PEDANTIC)
endif
+endif
# Support for internationalisation?
ifndef WITHOUT_GETTEXT
@@ -102,10 +107,13 @@ _CPPFLAGS += $(foreach D,$(_ALL_DIRS),-D'$(D)="$($(D))"')
# MORE HELP VARIABLES:
# Compilation and linking flags, and command.
-__CC = $(CC) -std=$(_C_STD) $(OPTIMISE) $(WARN) $(_CPPFLAGS) $(_CFLAGS) -c
-__LD = $(CC) -std=$(_C_STD) $(OPTIMISE) $(WARN) $(_LDFLAGS)
-__CC_POST = $(CPPFLAGS) $(CFLAGS)
-__LD_POST = $(LDFLAGS)
+CPPFLAGS = $(_CPPFLAGS)
+CFLAGS = $(OPTIMISE) $(WARN) $(_CFLAGS)
+LDFLAGS = $(OPTIMISE) $(WARN) $(_LDFLAGS)
+__CC = $(CC) -std=$(_C_STD) -c
+__LD = $(CC) -std=$(_C_STD)
+__CC_POST = $(CPPFLAGS) $(CFLAGS) $(EXTRA_CPPFLAGS) $(EXTRA_CFLAGS)
+__LD_POST = $(LDFLAGS) $(EXTRA_LDFLAGS)
# Header files.
__H =
@@ -133,9 +141,9 @@ endif
cmd-c: $(foreach B,$(_BIN),bin/$(B))
# Compile a C file into an object file.
-obj/%.o: src/%.c $(__H)
+aux/%.o: $(v)src/%.c $(foreach H,$(__H),$(v)$(H))
@$(PRINTF_INFO) '\e[00;01;31mCC\e[34m %s\e[00m$A\n' "$@"
- @$(MKDIR) -p $(shell dirname $@)
+ @$(MKDIR) -p $(shell $(DIRNAME) $@)
$(Q)$(__CC) -o $@ $< $(__CC_POST) #$Z
@$(ECHO_EMPTY)
@@ -148,7 +156,7 @@ bin/%:
@$(ECHO_EMPTY)
# Dependencies for the rule above.
-$(foreach B,$(_BIN),$(foreach O,$(_OBJ_$(B)),bin/$(B): obj/$(O).o\
+$(foreach B,$(_BIN),$(foreach O,$(_OBJ_$(B)),bin/$(B): aux/$(O).o\
))
diff --git a/mk/lowerpath.mk b/mk/lowerpath.mk
new file mode 100644
index 0000000..aadb91f
--- /dev/null
+++ b/mk/lowerpath.mk
@@ -0,0 +1,279 @@
+# Copyright (C) 2015 Mattias Andrée <maandree@member.fsf.org>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+
+
+#=== This file overrides values uppercase path variables with values lowercase path variables. ===#
+
+
+ifdef srcdir
+VPATH = $(srcdir)
+endif
+
+ifdef prefix
+PREFIX = $(prefix)
+endif
+
+ifdef sysconfdir
+SYSCONFDIR = $(sysconfdir)
+endif
+
+ifdef sharedstatedir
+COMDIR = $(sharedstatedir)
+endif
+
+ifdef localstatedir
+VARDIR = $(localstatedir)
+endif
+
+ifdef runstatedir
+RUNDIR = $(runstatedir)
+endif
+
+ifdef tmpdir
+TMPDIR = $(tmpdir)
+endif
+
+ifdef devdir
+DEVDIR = $(devdir)
+endif
+
+ifdef sysdir
+SYSDIR = $(sysdir)
+endif
+
+ifdef procdir
+PROCDIR = $(procdir)
+endif
+
+ifdef exec_prefix
+EXEC_PREFIX = $(exec_prefix)
+endif
+
+ifdef bindir
+BINDIR = $(bindir)
+endif
+
+ifdef sbindir
+SBINDIR = $(sbindir)
+endif
+
+ifdef libexecdir
+LIBEXECDIR = $(libexecdir)
+endif
+
+ifdef libdir
+LIBDIR = $(libdir)
+endif
+
+ifdef includedir
+INCLUDEDIR = $(includedir)
+endif
+
+ifdef oldincludedir
+OLDINCLUDEDIR = $(oldincludedir)
+endif
+
+ifdef datarootdir
+DATADIR = $(datarootdir)
+endif
+
+ifdef datadir
+RESDIR = $(datadir)
+endif
+
+ifdef libdatarootdir
+SYSDEPDATADIR = $(libdatarootdir)
+endif
+
+ifdef libdatadir
+SYSDEPRESDIR = $(libdatadir)
+endif
+
+ifdef lispdir
+LISPDIR = $(lispdir)
+endif
+
+ifdef localedir
+LOCALEDIR = $(localedir)
+endif
+
+ifdef licensedir
+LICENSEDIR = $(licensedir)
+endif
+
+ifdef cachedir
+CACHEDIR = $(cachedir)
+endif
+
+ifdef spooldir
+SPOOLDIR = $(spooldir)
+endif
+
+ifdef emptydir
+EMPTYDIR = $(emptydir)
+endif
+
+ifdef logdir
+LOGDIR = $(logdir)
+endif
+
+ifdef statedir
+STATEDIR = $(statedir)
+endif
+
+ifdef gamedir
+GAMEDIR = $(gamedir)
+endif
+
+ifdef sharedcachedir
+COMCACHEDIR = $(sharedcachedir)
+endif
+
+ifdef sharedpooldir
+COMPOOLDIR = $(sharedpooldir)
+endif
+
+ifdef sharedlogdir
+COMLOGDIR = $(sharedlogdir)
+endif
+
+ifdef sharedlogdir
+COMSTATEDIR = $(sharedstatedir)
+endif
+
+ifdef sharedgamedir
+COMGAMEDIR = $(sharedgamedir)
+endif
+
+ifdef localtmpdir
+VARTMPDIR = $(localtmpdir)
+endif
+
+ifdef sharedtmpdir
+COMTMPDIR = $(sharedtmpdir)
+endif
+
+ifdef lockdir
+LOCKDIR = $(lockdir)
+endif
+
+ifdef skeldir
+SKELDIR = $(skeldir)
+endif
+
+ifdef selfprocdir
+SELFPROCDIR = $(selfprocdir)
+endif
+
+ifdef docdir
+DOCDIR = $(docdir)
+endif
+
+ifdef infodir
+INFODIR = $(infodir)
+endif
+
+ifdef dvidir
+DVIDIR = $(dvidir)
+endif
+
+ifdef pdfdir
+PDFDIR = $(pdfdir)
+endif
+
+ifdef psdir
+PSDIR = $(psdir)
+endif
+
+ifdef htmldir
+HTMLDIR = $(htmldir)
+endif
+
+ifdef mandir
+MANDIR = $(mandir)
+endif
+
+ifdef man0
+MAN0 = $(man0)
+endif
+
+ifdef man1
+MAN1 = $(man1)
+endif
+
+ifdef man2
+MAN2 = $(man2)
+endif
+
+ifdef man3
+MAN3 = $(man3)
+endif
+
+ifdef man4
+MAN4 = $(man4)
+endif
+
+ifdef man5
+MAN5 = $(man5)
+endif
+
+ifdef man6
+MAN6 = $(man6)
+endif
+
+ifdef man7
+MAN7 = $(man7)
+endif
+
+ifdef man8
+MAN8 = $(man8)
+endif
+
+ifdef man9
+MAN9 = $(man9)
+endif
+
+ifdef man0ext
+MAN0EXT = $(man0ext)
+endif
+
+ifdef man1ext
+MAN1EXT = $(man1ext)
+endif
+
+ifdef man2ext
+MAN2EXT = $(man2ext)
+endif
+
+ifdef man3ext
+MAN3EXT = $(man3ext)
+endif
+
+ifdef man4ext
+MAN4EXT = $(man4ext)
+endif
+
+ifdef man5ext
+MAN5EXT = $(man5ext)
+endif
+
+ifdef man6ext
+MAN6EXT = $(man6ext)
+endif
+
+ifdef man7ext
+MAN7EXT = $(man7ext)
+endif
+
+ifdef man8ext
+MAN8EXT = $(man8ext)
+endif
+
+ifdef man9ext
+MAN9EXT = $(man9ext)
+endif
+
diff --git a/mk/man.mk b/mk/man.mk
index 20beb50..8105249 100644
--- a/mk/man.mk
+++ b/mk/man.mk
@@ -56,7 +56,7 @@ ifdef COMMAND
ifeq ($(shell $(PRINTF) '%s\n' $(COMMAND) | $(WC) -l),1)
ifeq ($(shell $(PRINTF) '%s\n' $(_MAN_PAGE_SECTIONS) | $(WC) -l),1)
ifeq ($(shell $(PRINTF) '%s\n' $(_MAN_$(_MAN_PAGE_SECTIONS)) | $(WC) -l),1)
-__MAN_COMMAND = $(COMMAND).$(MAN$(_MAN_PAGE_SECTIONS)EXT)
+__MAN_COMMAND = $(COMMAND)$(MAN$(_MAN_PAGE_SECTIONS)EXT)
endif
endif
endif
@@ -71,40 +71,39 @@ install-man: install-man-untranslated install-man-locale
.PHONY: install-man-untranslated
install-man-untranslated:
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
- $(Q)$(INSTALL_DIR) -- $(foreach S,$(_MAN_PAGE_SECTIONS),"$(DESTDIR)$(MANDIR)$(MAN$(S))")
+ $(Q)$(INSTALL_DIR) -- $(foreach S,$(_MAN_PAGE_SECTIONS),"$(DESTDIR)$(MANDIR)/$(MAN$(S))")
ifndef __MAN_COMMAND
- $(Q)$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),$(INSTALL_DATA) doc/man/$(P).$(S) -- "$(DESTDIR)$(MANDIR)$(MAN$(S))/$(P).$(MAN$(S)EXT)" &&)) $(TRUE)
+ $(Q)$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),$(INSTALL_DATA) $(v)doc/man/$(P).$(S) -- "$(DESTDIR)$(MANDIR)/$(MAN$(S))/$(P)$(MAN$(S)EXT)" &&)) $(TRUE)
endif
ifdef __MAN_COMMAND
- $(Q)$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),$(INSTALL_DATA) doc/man/$(P).$(S) -- "$(DESTDIR)$(MANDIR)$(MAN$(S))/$(__MAN_COMMAND)" &&)) $(TRUE)
+ $(Q)$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),$(INSTALL_DATA) $(v)doc/man/$(P).$(S) -- "$(DESTDIR)$(MANDIR)/$(MAN$(S))/$(__MAN_COMMAND)" &&)) $(TRUE)
endif
@$(ECHO_EMPTY)
.PHONY: install-man-locale
install-man-locale:
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
- $(Q)$(foreach L,$(MAN_LOCALES),$(INSTALL_DIR) -- $(foreach S,$(_MAN_PAGE_SECTIONS),"$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))") &&) $(TRUE)
+ $(Q)$(foreach L,$(MAN_LOCALES),$(INSTALL_DIR) -- $(foreach S,$(_MAN_PAGE_SECTIONS),"$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))") &&) $(TRUE)
ifndef __MAN_COMMAND
- $(Q)$(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),$(INSTALL_DATA) doc/man/$(P).$(L).$(S) -- "$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))/$(P).$(MAN$(S)EXT)" &&))) $(TRUE)
+ $(Q)$(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),$(INSTALL_DATA) $(v)doc/man/$(P).$(L).$(S) -- "$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))/$(P)$(MAN$(S)EXT)" &&))) $(TRUE)
endif
ifdef __MAN_COMMAND
- $(Q)$(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),$(INSTALL_DATA) doc/man/$(P).$(L).$(S) -- "$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))/$(__MAN_COMMAND)" &&))) $(TRUE)
+ $(Q)$(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),$(INSTALL_DATA) $(v)doc/man/$(P).$(L).$(S) -- "$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))/$(__MAN_COMMAND)" &&))) $(TRUE)
endif
@$(ECHO_EMPTY)
-
# UNINSTALL RULES:
.PHONY: uninstall-man
uninstall-man:
ifndef __MAN_COMMAND
- -$(Q)$(RM) -- $(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),"$(DESTDIR)$(MANDIR)$(MAN$(S))/$(P).$(MAN$(S)EXT)"))
- -$(Q)$(RM) -- $(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),"$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))/$(P).$(MAN$(S)EXT)")))
+ -$(Q)$(RM) -- $(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(S)),"$(DESTDIR)$(MANDIR)/$(MAN$(S))/$(P).$(MAN$(S)EXT)"))
+ -$(Q)$(RM) -- $(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),"$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))/$(P)$(MAN$(S)EXT)")))
endif
ifdef __MAN_COMMAND
- -$(Q)$(RM) -- "$(DESTDIR)$(MANDIR)$(MAN$(_MAN_PAGE_SECTIONS))/$(__MAN_COMMAND)"
- -$(Q)$(RM) -- $(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),"$(DESTDIR)$(MANDIR)/$(L)$(MAN$(S))/$(__MAN_COMMAND)")))
+ -$(Q)$(RM) -- "$(DESTDIR)$(MANDIR)/$(MAN$(_MAN_PAGE_SECTIONS))/$(__MAN_COMMAND)"
+ -$(Q)$(RM) -- $(foreach L,$(MAN_LOCALES),$(foreach S,$(_MAN_PAGE_SECTIONS),$(foreach P,$(_MAN_$(L)_$(S)),"$(DESTDIR)$(MANDIR)/$(L)/$(MAN$(S))/$(__MAN_COMMAND)")))
endif
diff --git a/mk/path.mk b/mk/path.mk
index 060a1c0..a65b7b8 100644
--- a/mk/path.mk
+++ b/mk/path.mk
@@ -17,6 +17,8 @@ __PATH_MK_INCLUDED = 1
# The package path prefix, if you want to install to another root, set DESTDIR to that root.
PREFIX = /usr
+# The package path prefix for /bin, /sbin, /lib and /libexec.
+EXEC_PREFIX = /usr
# The command path excluding prefix.
BIN = /bin
# The administration command path excluding prefix.
@@ -42,21 +44,32 @@ MAN8 = /man8
MAN9 = /man9
# The command path including prefix.
-BINDIR = $(PREFIX)$(BIN)
+BINDIR = $(EXEC_PREFIX)$(BIN)
# The administration command path including prefix.
-SBINDIR = $(PREFIX)$(SBIN)
+SBINDIR = $(EXEC_PREFIX)$(SBIN)
# The library path including prefix.
-LIBDIR = $(PREFIX)$(LIB)
+LIBDIR = $(EXEC_PREFIX)$(LIB)
# The executable library path including prefix.
-LIBEXECDIR = $(PREFIX)$(LIBEXEC)
+LIBEXECDIR = $(EXEC_PREFIX)$(LIBEXEC)
# The header-file path including prefix.
INCLUDEDIR = $(PREFIX)$(INCLUDE)
-# The resource path including prefix.
+# The header-file path including prefix. Must not be /usr/local.
+ifeq ($(PREFIX),/usr/lcoal)
+OLDINCLUDEDIR = /usr$(INCLUDE)
+endif
+ifneq ($(PREFIX),/usr/lcoal)
+OLDINCLUDEDIR = $(PREFIX)$(INCLUDE)
+endif
+# The data path including prefix.
DATADIR = $(PREFIX)$(DATA)
+# The architecture-dependent data path including prefix.
+SYSDEPDATADIR = $(DATADIR)
+# The resource path including prefix.
+RESDIR = $(DATADIR)
# The architecture-dependent resource path including prefix.
-SYSDEPDATA = $(DATADIR)
+SYSDEPRESDIR = $(RESDIR)
# The generic documentation path including prefix.
-DOCDIR = $(DATADIR)/doc
+DOCDIR = $(DATADIR)/doc/$(PKGNAME)
# The info manual documentation path including prefix.
INFODIR = $(DATADIR)/info
# The DVI documentation path including prefix.
@@ -69,6 +82,8 @@ PSDIR = $(DOCDIR)
HTMLDIR = $(DOCDIR)
# The man page documentation path including prefix.
MANDIR = $(DATADIR)/man
+# The Emacs LISP path including prefix.
+LISPDIR = $(DATADIR)/emacs/site-lisp
# The locale path including prefix.
LOCALEDIR = $(DATADIR)/locale
# The license base path including prefix.
@@ -115,8 +130,6 @@ SKELDIR = $(SYSCONFDIR)/skel
COMCACHEDIR = $(COMDIR)/cache
# The network-common spool directory.
COMSPOOLDIR = $(COMDIR)/spool
-# The network-common empty directory.
-COMEMPTYDIR = $(COMDIR)/empty
# The network-common logfile directory.
COMLOGDIR = $(COMDIR)/log
# The network-common state directory.
@@ -128,28 +141,35 @@ COMGAMEDIR = $(COMDIR)/games
# FILENAME SUFFIXES:
# Filename suffixes for man pages by section.
-MAN0EXT = 0
-MAN1EXT = 1
-MAN2EXT = 2
-MAN3EXT = 3
-MAN4EXT = 4
-MAN5EXT = 5
-MAN6EXT = 6
-MAN7EXT = 7
-MAN8EXT = 8
-MAN9EXT = 9
+MAN0EXT = .0
+MAN1EXT = .1
+MAN2EXT = .2
+MAN3EXT = .3
+MAN4EXT = .4
+MAN5EXT = .5
+MAN6EXT = .6
+MAN7EXT = .7
+MAN8EXT = .8
+MAN9EXT = .9
# HELP VARIABLES:
# All path variables that includes the prefix,
# or are unaffected by the prefix.
-_ALL_DIRS = BINDIR SBINDIR LIBDIR LIBEXECDIR INCLUDEDIR DATADIR SYSDEPDATA DOCDIR \
+_ALL_DIRS = BINDIR SBINDIR LIBDIR LIBEXECDIR INCLUDEDIR DATADIR SYSDEPDATADIR DOCDIR \
INFODIR DVIDIR PDFDIR PSDIR HTMLDIR MANDIR LOCALEDIR LICENSEDIR VARDIR \
- VARTMPDIR COMDIR COMTMPDIR TMPDIR RUNDIR SYSCONFDIR DEVDIR SYSDIR \
+ RESDIR VARTMPDIR COMDIR COMTMPDIR TMPDIR RUNDIR SYSCONFDIR DEVDIR SYSDIR \
PROCDIR SELFPROCDIR CACHEDIR SPOOLDIR EMPTYDIR LOGDIR STATEDIR GAMEDIR \
- LOCKDIR SKELDIR COMCACHEDIR COMSPOOLDIR COMEMPTYDIR COMLOGDIR COMSTATEDIR \
- COMGAMEDIR
+ LOCKDIR SKELDIR COMCACHEDIR COMSPOOLDIR COMLOGDIR COMSTATEDIR COMGAMEDIR \
+ SYSDEPRESDIR OLDINCLUDEDIR
+
+# ../, ../../, and ../../../, ignored if v is used, which if an absolute path.
+ifndef v
+__back1unless_v = ../
+__back2unless_v = ../../
+__back3unless_v = ../../../
+endif
endif
diff --git a/mk/prologue.mk b/mk/prologue.mk
new file mode 100644
index 0000000..525da28
--- /dev/null
+++ b/mk/prologue.mk
@@ -0,0 +1,16 @@
+# Copyright (C) 2015 Mattias Andrée <maandree@member.fsf.org>
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved. This file is offered as-is,
+# without any warranty.
+
+
+#=== This file includes rules for automatically rebuilding the makefile. ===#
+
+
+base: Makefile
+
+Makefile: $(v)Makefile.in config.status $(v)configure $(v)mk/configure
+ ./config.status
+
diff --git a/mk/texinfo.mk b/mk/texinfo.mk
index db7fa07..d08cb6b 100644
--- a/mk/texinfo.mk
+++ b/mk/texinfo.mk
@@ -6,6 +6,7 @@
# without any warranty.
+# TODO ((support translations))
#=== These rules are used for Texinfo manuals. ===#
@@ -64,15 +65,15 @@ uninstall: uninstall-info uninstall-dvi uninstall-pdf uninstall-ps uninstall-htm
__TEXI_SRC =
ifdef _TEXINFO_DIRLEVELS
ifeq ($(_TEXINFO_DIRLEVELS),1)
-__TEXI_SRC += doc/info/*.texinfo
+__TEXI_SRC += $(v)doc/info/*.texinfo
endif
ifneq ($(_TEXINFO_DIRLEVELS),1)
ifeq ($(_TEXINFO_DIRLEVELS),2)
-__TEXI_SRC += doc/info/*.texinfo
-__TEXI_SRC += doc/info/*/*.texinfo
+__TEXI_SRC += $(v)doc/info/*.texinfo
+__TEXI_SRC += $(v)doc/info/*/*.texinfo
endif
ifneq ($(_TEXINFO_DIRLEVELS),2)
-__TEXI_SRC += $(foreach W,$(shell $(SEQ) $(_TEXINFO_DIRLEVELS) | while read n; do $(ECHO) $$($(SEQ) $$n)" " | $(SED) 's/[^ ]* /\/\*/g'; done | $(XARGS) $(ECHO)),doc/info$(W).texinfo)
+__TEXI_SRC += $(foreach W,$(shell $(SEQ) $(_TEXINFO_DIRLEVELS) | while read n; do $(ECHO) $$($(SEQ) $$n)" " | $(SED) 's/[^ ]* /\/\*/g'; done | $(XARGS) $(ECHO)),$(v)doc/info$(W).texinfo)
endif
endif
endif
@@ -95,37 +96,37 @@ endif
ifdef _LOGO
# Prepare conversion of logo.
-obj/$(_LOGO).svg: doc/$(_LOGO).svg
+aux/$(_LOGO).svg: $(v)doc/$(_LOGO).svg
@$(PRINTF_INFO) '\e[00;01;31mCP\e[34m %s\e[00m$A\n' "$@"
- @$(MKDIR) -p obj
- $(Q)$(CP) $< $@ #$Z
+ @$(MKDIR) -p aux
+ $(Q)$(CP) $^ $@ #$Z
@$(ECHO_EMPTY)
# Intermediate format for the logo for DVI and PostScript manuals.
-obj/$(_LOGO).ps: doc/$(_LOGO).svg
+aux/$(_LOGO).ps: $(v)doc/$(_LOGO).svg
@$(PRINTF_INFO) '\e[00;01;31mPS\e[34m %s\e[00m$A\n' "$@"
- @$(MKDIR) -p obj
- $(Q)$(SVG2PS) $< > $@ #$Z
+ @$(MKDIR) -p aux
+ $(Q)$(SVG2PS) $^ > $@ #$Z
@$(ECHO_EMPTY)
# Logo for DVI and PostScript manuals.
-obj/$(_LOGO).eps: obj/$(_LOGO).ps
+aux/$(_LOGO).eps: aux/$(_LOGO).ps
@$(PRINTF_INFO) '\e[00;01;31mEPS\e[34m %s\e[00m$A\n' "$@"
- $(Q)$(PS2EPS) $< #$Z
+ $(Q)$(PS2EPS) $^ #$Z
@$(ECHO_EMPTY)
# Logo for PDF manual.
-obj/$(_LOGO).pdf: doc/$(_LOGO).svg
+aux/$(_LOGO).pdf: doc/$(_LOGO).svg
@$(PRINTF_INFO) '\e[00;01;31mPDF\e[34m %s\e[00m$A\n' "$@"
- @$(MKDIR) -p obj
- $(Q)$(SVG2PDF) $< > $@ #$Z
+ @$(MKDIR) -p aux
+ $(Q)$(SVG2PDF) $^ > $@ #$Z
@$(ECHO_EMPTY)
endif
# Build info manual.
.PHONY: info
info: bin/$(_PROJECT).info
-bin/%.info $(foreach P,$(__INFOPARTS),bin/%.info-$(P)): doc/info/%.texinfo $(__TEXI_SRC)
+bin/%.info $(foreach P,$(__INFOPARTS),bin/%.info-$(P)): $(v)doc/info/%.texinfo $(__TEXI_SRC)
@$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@"
@$(MKDIR) -p bin
$(Q)$(MAKEINFO) $< #$Z
@@ -136,47 +137,47 @@ bin/%.info $(foreach P,$(__INFOPARTS),bin/%.info-$(P)): doc/info/%.texinfo $(__T
# Build DVI manual.
.PHONY: dvi
dvi: bin/$(_PROJECT).dvi
-bin/%.dvi: doc/info/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),obj/$(L).eps)
+bin/%.dvi: $(v)doc/info/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),aux/$(L).eps)
@$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@"
- @! $(TEST) -d obj/dvi/$* || $(RM) -rf obj/dvi/$*
- @$(MKDIR) -p obj/dvi/$* bin
- $(Q)cd obj/dvi/$* && $(TEXI2DVI) ../../../$< $(__TEXINFO_FLAGS) < /dev/null #$Z
+ @! $(TEST) -d aux/dvi/$* || $(RM) -rf aux/dvi/$*
+ @$(MKDIR) -p aux/dvi/$* bin
+ $(Q)cd aux/dvi/$* && $(TEXI2DVI) $(__back3unless_v)$< $(__TEXINFO_FLAGS) < /dev/null #$Z
@$(PRINTF_INFO) '$A'
- $(Q)$(MV) obj/dvi/$*/$*.dvi $@ #$Z
+ $(Q)$(MV) aux/dvi/$*/$*.dvi $@ #$Z
@$(ECHO_EMPTY)
# Build PDF manual.
.PHONY: pdf
pdf: bin/$(_PROJECT).pdf
-bin/%.pdf: doc/info/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),obj/$(L).pdf)
+bin/%.pdf: $(v)doc/info/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),aux/$(L).pdf)
@$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@"
- @! $(TEST) -d obj/pdf/$* || $(RM) -rf obj/pdf/$*
- @$(MKDIR) -p obj/pdf/$* bin
- $(Q)cd obj/pdf/$* && $(TEXI2PDF) ../../../$< $(__TEXINFO_FLAGS) < /dev/null #$Z
+ @! $(TEST) -d aux/pdf/$* || $(RM) -rf aux/pdf/$*
+ @$(MKDIR) -p aux/pdf/$* bin
+ $(Q)cd aux/pdf/$* && $(TEXI2PDF) $(__back3unless_v)$< $(__TEXINFO_FLAGS) < /dev/null #$Z
@$(PRINTF_INFO) '$A'
- $(Q)$(MV) obj/pdf/$*/$*.pdf $@ #$Z
+ $(Q)$(MV) aux/pdf/$*/$*.pdf $@ #$Z
@$(ECHO_EMPTY)
# Build PostScript manual.
.PHONY: ps
ps: bin/$(_PROJECT).ps
-bin/%.ps: doc/info/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),obj/$(L).eps)
+bin/%.ps: $(v)doc/info/%.texinfo $(__TEXI_SRC) $(foreach L,$(_LOGO),aux/$(L).eps)
@$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@"
- @! $(TEST) -d obj/ps/$* || $(RM) -rf obj/ps/$*
- @$(MKDIR) -p obj/ps/$* bin
- $(Q)cd obj/ps/$* && $(TEXI2PS) ../../../$< $(__TEXINFO_FLAGS) < /dev/null #$Z
+ @! $(TEST) -d aux/ps/$* || $(RM) -rf aux/ps/$*
+ @$(MKDIR) -p aux/ps/$* bin
+ $(Q)cd aux/ps/$* && $(TEXI2PS) $(__back3unless_v)$< $(__TEXINFO_FLAGS) < /dev/null #$Z
@$(PRINTF_INFO) '$A'
- $(Q)$(MV) obj/ps/$*/$*.ps $@ #$Z
+ $(Q)$(MV) aux/ps/$*/$*.ps $@ #$Z
@$(ECHO_EMPTY)
# Build HTML manual.
.PHONY: html
html: bin/html/$(_PROJECT)/index.html
-bin/html/%/index.html: doc/info/%.texinfo $(__TEXI_SRC)
+bin/html/%/index.html: $(v)doc/info/%.texinfo $(__TEXI_SRC)
@$(PRINTF_INFO) '\e[00;01;31mTEXI\e[34m %s\e[00m$A\n' "$@"
@! $(TEST) -d bin/html/$* || $(RM) -rf bin/html/$*
@$(MKDIR) -p bin/html
- $(Q)cd bin/html && $(MAKEINFO_HTML) ../../$< < /dev/null #$Z
+ $(Q)cd bin/html && $(MAKEINFO_HTML) $(__back2unless_v)$< < /dev/null #$Z
@$(ECHO_EMPTY)
@@ -187,8 +188,19 @@ bin/html/%/index.html: doc/info/%.texinfo $(__TEXI_SRC)
install-info: bin/$(_PROJECT).info $(foreach P,$(__INFOPARTS),bin/%.info-$(P))
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
$(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(INFODIR)"
- $(Q)$(INSTALL_DATA) $< -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info"
+ $(Q)$(INSTALL_DATA) bin/$(_PROJECT).info -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info"
$(Q)$(forearch P,$(__INFOPARTS),$(INSTALL_DATA) bin/$*.info-$(P) -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info-$(P)" &&) $(TRUE)
+ifdef POST_INSTALL
+ $(POST_INSTALL)
+endif
+ $(Q)if $(SHELL) -c '$(N) $(INSTALL_INFO) --version' > /dev/null 2>&1; then \
+ $(N)$(z) $(INSTALL_INFO) -- "${DESTDIR}${INFODIR}/$(PKGNAME).info" "${DESTDIR}${INFODIR}/dir"; \
+ else \
+ $(TRUE); \
+ fi
+ifdef POST_INSTALL
+ $(NORMAL_INSTALL)
+endif
@$(ECHO_EMPTY)
# Install DVI manual.
@@ -196,7 +208,7 @@ install-info: bin/$(_PROJECT).info $(foreach P,$(__INFOPARTS),bin/%.info-$(P))
install-dvi: bin/$(_PROJECT).dvi
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
$(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(DVIDIR)"
- $(Q)$(INSTALL_DATA) $< -- "$(DESTDIR)$(DVIDIR)/$(PKGNAME).dvi"
+ $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(DVIDIR)/$(PKGNAME).dvi"
@$(ECHO_EMPTY)
# Install PDF manual.
@@ -204,7 +216,7 @@ install-dvi: bin/$(_PROJECT).dvi
install-pdf: bin/$(_PROJECT).pdf
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
$(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(PDFDIR)"
- $(Q)$(INSTALL_DATA) $< -- "$(DESTDIR)$(PDFDIR)/$(PKGNAME).pdf"
+ $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(PDFDIR)/$(PKGNAME).pdf"
@$(ECHO_EMPTY)
# Install PostScript manual.
@@ -212,15 +224,15 @@ install-pdf: bin/$(_PROJECT).pdf
install-ps: bin/$(_PROJECT).ps
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
$(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(PSDIR)"
- $(Q)$(INSTALL_DATA) $< -- "$(DESTDIR)$(PSDIR)/$(PKGNAME).ps"
+ $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(PSDIR)/$(PKGNAME).ps"
@$(ECHO_EMPTY)
# Install HTML manual.
.PHONY: install-html
install-html: $(foreach F,$(_HTML_FILES),bin/html/$(_PROJECT)/$(F))
@$(PRINTF_INFO) '\e[00;01;31mINSTALL\e[34m %s\e[00m\n' "$@"
- $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)/html"
- $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)/html/"
+ $(Q)$(INSTALL_DIR) -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)"
+ $(Q)$(INSTALL_DATA) $^ -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)/"
@$(ECHO_EMPTY)
@@ -229,6 +241,13 @@ install-html: $(foreach F,$(_HTML_FILES),bin/html/$(_PROJECT)/$(F))
# Uninstall info manual.
.PHONY: uninstall-info
uninstall-info:
+ifdef PRE_UNINSTALL
+ $(PRE_UNINSTALL)
+endif
+ -$(Q)$(N)$(a) $(INSTALL_INFO) --delete -- "${DESTDIR}${INFODIR}/$(PKGNAME).info" "${DESTDIR}${INFODIR}/dir"
+ifdef PRE_UNINSTALL
+ $(NORMAL_UNINSTALL)
+endif
-$(Q)$(RM) -- "$(DESTDIR)$(INFODIR)/$(PKGNAME).info" $(forearch P,$(__INFOPARTS),"$(DESTDIR)$(INFODIR)/$(PKGNAME).info-$(P)")
# Uninstall DVI manual.
@@ -249,8 +268,7 @@ uninstall-ps:
# Uninstall HTML manual.
.PHONY: uninstall-html
uninstall-html:
- -$(Q)$(RM) -- $(foreach F,$(_HTML_FILES),"$(DESTDIR)$(HTMLDIR)/$(PKGNAME)/html/$(F)")
- -$(Q)$(RM) -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)/html"
+ -$(Q)$(RM) -- $(foreach F,$(_HTML_FILES),"$(DESTDIR)$(HTMLDIR)/$(PKGNAME)/$(F)")
-$(Q)$(RM) -- "$(DESTDIR)$(HTMLDIR)/$(PKGNAME)"
diff --git a/mk/tools.mk b/mk/tools.mk
index 6793840..5801d4f 100644
--- a/mk/tools.mk
+++ b/mk/tools.mk
@@ -10,27 +10,70 @@
# Part of GNU Coreutils:
-MKDIR ?= mkdir
+BASENAME ?= basename
+CHGRP ?= chgrp
+CHMOD ?= chmod
+CHOWN ?= chown
CP ?= cp
+CPLIT ?= cplit
+CUT ?= cut
+DATE ?= date
+DIRNAME ?= dirname
+ECHO ?= echo
+ENV ?= env
+EXPAND ?= expand
+EXPR ?= expr
+FALS ?= false
+FMT ?= fmt
+FOLD ?= fold
+HEAD ?= head
+INSTALL ?= install
+INSTALL_DATA ?= $(INSTALL) -m644
+INSTALL_DIR ?= $(INSTALL) -dm755
+INSTALL_PROGRAM ?= $(INSTALL) -m755
+JOIN ?= join
+LN ?= ln
+MKDIR ?= mkdir
+MKFIFO ?= mkfifo
+MKNOD ?= mknod
MV ?= mv
+NL ?= nl
+NPROC ?= nproc
+NUMFMT ?= numfmt
+OD ?= od
+PASTE ?= paste
+PATHCHK ?= pathchk
+PR ?= pr
+PRINTF ?= printf
+READLINK ?= readlink
+REALPATH ?= realpath
RM ?= rm
RMDIR ?= rmdir
-TRUE ?= true
-TEST ?= test
-TOUCH ?= touch
-ECHO ?= echo
-CUT ?= cut
+SEQ ?= seq
+SLEEP ?= sleep
+SORT ?= sort
+SPLIT ?= split
+STAT ?= stat
TAC ?= tac
TAIL ?= tail
-HEAD ?= head
-SORT ?= sort
+TEE ?= tee
+TEST ?= test
+TOUCH ?= touch
+TR ?= tr
+TRUE ?= true
+TRUNCATE ?= truncate
+TSORT ?= tsort
+UNAME ?= uname
+UNEXPAND ?= unexpand
UNIQ ?= uniq
-PRINTF ?= printf
WC ?= wc
-INSTALL ?= install
-INSTALL_PROGRAM ?= $(INSTALL) -m755
-INSTALL_DATA ?= $(INSTALL) -m644
-INSTALL_DIR ?= $(INSTALL) -dm755
+YES ?= yes
+
+# Part of GNU help2man:
+HELP2MAN ?= help2man
+
+# Part of GNU tar:
+TAR ?= tar
# Part of GNU Findutils:
FIND ?= find
@@ -38,6 +81,8 @@ XARGS ?= xargs
# Part of GNU Grep:
GREP ?= grep
+EGREP ?= egrep
+FGREP ?= fgrep
# Part of GNU Sed:
SED ?= sed
@@ -48,6 +93,7 @@ GPG ?= gpg
# Part of Texinfo:
MAKEINFO ?= makeinfo
MAKEINFO_HTML ?= $(MAKEINFO) --html
+INSTALL_INFO ?= install-info
# Part of Texlive-plainextra:
TEXI2PDF ?= texi2pdf
@@ -62,9 +108,26 @@ RSVG_CONVERT ?= rsvg-convert
SVG2PS ?= $(RSVG_CONVERT) --format=ps
SVG2PDF ?= $(RSVG_CONVERT) --format=pdf
-# Part of GCC:
+# Part of GNU Compiler Collection:
CC ?= cc
CPP ?= cpp
+CXX ?= c++
+
+# Part of GNU Binutils:
+AR ?= ar
+LD ?= ld
+RANLIB ?= ranlib
+
+# Part of GNU Bison:
+BISON ?= bison
+YACC ?= yacc
+
+# Part of Flex:
+FLEX ?= FLEX
+LEX ?= lex
+
+# Part of GNU C Library:
+LDCONFIG ?= ldconfig
# Part of GNU Gettext:
XGETTEXT ?= xgettext