Build and install instructions for etsh!

--------
SYNOPSIS
	env [variable=value ...] make [target ...]
	make [variable=value ...] [target ...]

If the defaults described below match your desires and/or the
requirements of your system, you can build and install the etsh
package (binaries and manual pages) by doing the following.

	% ./configure
	% make
	% make exp
	# make install install-exp

...
NOTE: You can do `./configure -h' for help.

Otherwise, continue reading for full build and install details.
See the EXAMPLES section at the end of this file for additional
help if needed.

---------
VARIABLES
The Makefile defines the following configuration variables (default
value listed).  The user can modify the default configuration by
passing the desired variable=value pair(s) on the command line.

	DESTDIR		Unset by default.  This may be used as a
			target directory for building/packaging
			binary packages if needed.

	PREFIX		Defaults to /usr/local.  This is the target directory
			where BINDIR, LIBEXECDIR*, DOCDIR, EXPDIR, MANDIR,
			and SYSCONFDIR are located by default.

	BINDIR		Defaults to $(PREFIX)/bin.
			This is the target directory where
			the etsh and tsh binaries are installed.

	LIBEXECDIR	Defaults to $(PREFIX)/libexec/$(ETSH_VERSION).
			This is the target directory that contains two
			subdirectories, etsh and tsh.

	LIBEXECDIRETSH	Defaults to $(PREFIX)/libexec/$(ETSH_VERSION)/etsh.
			This is the target directory for etsh(1) support
			scripts and files.

	LIBEXECDIRTSH	Defaults to $(PREFIX)/libexec/$(ETSH_VERSION)/tsh.
			This is the target directory where tsh(1) external
			utilities (glob, if, goto, and fd2) are installed
			and where tsh(1) expects to find them.

	DOCDIR		Defaults to $(PREFIX)/share/doc/etsh.  This is the
			target directory for the - README, PROJECT, NOTES,
			LICENSE, DEDICATIONS, and AUTHORS - files.

	EXPDIR		Defaults to $(PREFIX)/share/examples/etsh.  This is the
			target directory for the examples/.* & examples/* files.

	MANDIR		Defaults to $(PREFIX)/man/man1.  This is the
			target directory where the manual pages are
			installed.

	SYSCONFDIR	Defaults to $(PREFIX)/etc.  This is the target
			directory where etsh searches for its system-wide
			rc (init and logout) files if such files are
			available on the system.  See also:

				https://etsh.nl/examples

			...
			for example rc files.

Build utilities (SHELL must be POSIX-compliant):

	CC		Unset by default, except as noted in the
			EXAMPLES below for OpenIndiana.

	INSTALL		Defaults to /usr/bin/install.  The install(1)
			utility is used to copy the resulting binaries,
			manual pages, and other files to final targets.

	SHELL		Defaults to /bin/sh.

(Mac) OS X only:
The following configuration variables specify the desired target
architecture(s) for compiling universal binaries and/or 64-bit
binaries and/or 32-bit binaries for (Mac) OS X running on Intel
and PowerPC Macs.

	OSXCFLAGS	Unset by default.

	OSXLDFLAGS	Unset by default.

			Possible value(s) for OSXCFLAGS and OSXLDFLAGS may
			include one or more of the following on supported
			systems:

				-arch x86_64, -arch ppc64, -arch i386, -arch ppc

			...
			See also EXAMPLES.

-------
TARGETS
The following targets are available.

	all		Default target is the same as typing `make'.
			Compiles everything and generates manual pages.

	etshall		Compiles etsh and generates manual pages.

	tshall		Compiles tsh, glob, if, goto, fd2 and
			generates manual pages.

	exp		Prepares and/or readies examples for installation.

	check		Runs the regression test suite with etsh and tsh.
	check-etsh	...                                 etsh.
	check-etshall	...                                 etsh.
	check-tsh	...                                          tsh.
	check-tshall	...                                          tsh.

	check-newlog	Generates new test logs for the etsh and tsh
			regression test suite.

	install		Installs all binaries and manual pages.

	install-etshall	Installs etsh binary and manual pages.

	install-tshall	Installs tshall binaries and manual pages.

	install-doc	Installs package documentation.

	install-exp	Installs examples.

	clean-obj	Removes all object files.

	clean		Removes all binaries, object files, and other
			files generated during the build.

--------
EXAMPLES
The following configures and compiles tsh and its external utilities
(glob, if, goto, and fd2) for /usr/pkg.  Then, it installs the tsh
binary into /usr/pkg/bin, its external utilities into LIBEXECDIRTSH,
and the manual pages into /usr/pkg/man/man1.

	% ./configure
	% make PREFIX=/usr/pkg tshall
	# make PREFIX=/usr/pkg install-tshall

If you build on OpenBSD or NetBSD with BSD make and the default CFLAGS=-O2
suites your needs, then don't specify CFLAGS.  On the other hand, if you
use GNU make (gmake) on OpenBSD or GNU/Linux, you will want to specify
your optimization via CFLAGS or have it unspecified for your build.

If you want to specify any -O (optimization) flags/options, you can
use env and CFLAGS=-O2 (or the optimization level you prefer), as
illustrated below.  [1]...

The following configures and compiles everything, setting up etsh to
search for its system-wide rc files in /etc instead of /usr/local/etc
by default.  Then, it installs the entire etsh package, including
package documentation and examples, into the default locations.

	% ./configure
	% env CFLAGS=-O2 make SYSCONFDIR=/etc
	% make SYSCONFDIR=/etc exp
	# make install install-doc install-exp

The following is the same as above, but with statically-linked binaries,
instead of dynamically-linked, which is the default.  [2]...

	% ./configure
	% env CFLAGS=-O2 LDFLAGS=-static make SYSCONFDIR=/etc
	% make SYSCONFDIR=/etc exp
	# make install install-doc install-exp

The following configures and compiles each program as a 2-way 64/32-bit
universal binary for (Mac) OS X running on Intel Macs.  Then, it installs
the entire etsh package, including package documentation and examples,
into the default locations.
 
	% ./configure
	% make OSXCFLAGS='-arch x86_64 -arch i386' \
	       OSXLDFLAGS='-arch x86_64 -arch i386'
	% make exp
	# make install install-doc install-exp

The following works on OpenIndiana.  Notice that mkconfig sets
CC=/usr/bin/gcc and INSTALL=/usr/bin/ginstall for you.  If you notice
that it is compiling without optimization, and you want it, I put an
optional '[env CFLAGS=-O2]' in the example below.  Don't type the
'[' or ']' though.

Last but not least, I would like to mention PREFIX.  As noted elsewhere
in this file and the Makefile, PREFIX=/usr/local is the default.  I don't
exactly recommend changing it, but if you want to do so, go for it.  See
how I've used it in the example below.

	% ./configure

	% uname -srm
	SunOS 5.11 ...
		? output on latest OpenIndiana Hipster ?
			... I don't remember exactly ...

	% which gcc gmake ginstall
	/usr/bin/gcc
	/usr/bin/gmake
	/usr/bin/ginstall

	% [env CFLAGS=-O2] gmake [PREFIX=/your/preferred/directory]
	% gmake [PREFIX=/your/preferred/directory] exp
	# gmake [PREFIX=/your/preferred/directory] install \
						   install-doc install-exp

Hopefully, this file has been helpful.  If not, please let me know.

Footnotes:

1. ... It's not unimportant, since I haven't specified any optimization
   level in the Makefile.  I had heard that doing so can cause problems,
   which is why I removed -O2 from CFLAGS in the Makefile.

2. ... But you may ask...  Why would you want to statically link etsh
   and/or tsh & its utilities??  For me, being able to run etsh in single-
   user mode is the main reason!  Yes, I keep a statically linked etsh
   installed in /etroot and add /bin/etsh as a hard link to it =)

Jeffrey Allen Neitzel						2018/12/06

@(#)$Id: INSTALL,v 1.5 2018/12/05 08:12:31 jneitzel Exp $
