diff --git a/.gitignore b/.gitignore index 48c1b327..4daa6c49 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ modules.sum doc/diff_with_c-version.txt doc/html/*.html doc/man +doc/source/module.pod www/tcl www/docs .makeinstallpath diff --git a/Makefile b/Makefile index 6f100a47..29024f3c 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,8 @@ initdir: initdir=$(initdir) doc: - make -C doc all prefix=$(prefix) datarootdir=$(datarootdir) \ + make -C doc all prefix=$(prefix) libexecdir=$(libexecdir) \ + initdir=$(initdir) datarootdir=$(datarootdir) \ mandir=$(mandir) docdir=$(docdir) www: diff --git a/doc/Makefile b/doc/Makefile index 2946af0f..a53cec65 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -16,6 +16,8 @@ SOURCE_DIR := source # set default installation paths if not yet defined prefix ?= /usr/local/modules-tcl +libexecdir ?= $(prefix)/libexec +initdir ?= $(prefix)/init datarootdir ?= $(prefix)/share mandir ?= $(datarootdir)/man docdir ?= $(datarootdir)/doc @@ -25,13 +27,24 @@ all: $(HTML_DIR)/module.html $(HTML_DIR)/modulefile.html \ $(HTML_DIR)/diff_with_c-version.html diff_with_c-version.txt \ .makeinstallpath +define translate-in-script +perl -pe 's|\@prefix\@|$(prefix)|g; \ + s|\@libexecdir\@|$(libexecdir)|g; \ + s|\@initdir\@|$(initdir)|g;' $< > $@ +endef + # save defined install paths .makeinstallpath: @echo "prefix := $(prefix)" >$@ + @echo "libexecdir := $(libexecdir)" >>$@ + @echo "initdir := $(initdir)" >>$@ @echo "datarootdir := $(datarootdir)" >>$@ @echo "mandir := $(mandir)" >>$@ @echo "docdir := $(docdir)" >>$@ +$(SOURCE_DIR)/%.pod: $(SOURCE_DIR)/%.pod.in + $(translate-in-script) + $(HTML_DIR)/%.html: $(SOURCE_DIR)/%.pod $(VERSION_FILE) mkdir -p $(HTML_DIR) pod2html --noindex --css=common.css --infile=$< --outfile=$@ @@ -59,6 +72,7 @@ install: all clean: rm -f $(HTML_DIR)/*.html rm -f $(MAN1_DIR)/*.1 $(MAN4_DIR)/*.4 + rm -f $(SOURCE_DIR)/module.pod rmdir $(MAN1_DIR) $(MAN4_DIR) $(MAN_DIR) rm -f diff_with_c-version.txt rm -f pod*.tmp .makeinstallpath diff --git a/doc/source/module.pod b/doc/source/module.pod.in similarity index 95% rename from doc/source/module.pod rename to doc/source/module.pod.in index 508a924a..0a320c61 100644 --- a/doc/source/module.pod +++ b/doc/source/module.pod.in @@ -37,40 +37,37 @@ creates the B command as either an alias or function and creates Modules environment variables. The B alias or function executes the B program -located in F<$MODULESHOME> and has the shell evaluate the command's +located in F<@libexecdir@> and has the shell evaluate the command's output. The first argument to B specifies the type of shell. -The initialization scripts are kept in F<$MODULESHOME/init/EshellE> +The initialization scripts are kept in F<@initdir@/EshellE> where IshellE> is the name of the sourcing shell. For example, -a C Shell user sources the F<$MODULESHOME/init/csh> script. The sh, csh, +a C Shell user sources the F<@initdir@/csh> script. The sh, csh, tcsh, bash, ksh, zsh and fish shells are supported by B. In addition, python, perl, tcl and lisp "shells" are supported which writes the environment changes to stdout as python, perl, tcl or lisp code. =head2 Examples of initialization -In the following examples, replace F<$MODULESHOME> with the actual -directory name. - C Shell initialization (and derivatives): - source $MODULESHOME/init/csh + source @initdir@/csh module load modulefile modulefile ... Bourne Shell (sh) (and derivatives): - . $MODULESHOME/init/sh + . @initdir@/sh module load modulefile modulefile ... Perl: - require "${MODULESHOME}/init/perl"; + require "@initdir@/perl"; &module("load modulefile modulefile ..."); Python: import os - exec(open(os.environ['MODULESHOME'] + '/init/python').read()) + exec(open('@initdir@/python').read()) module('load modulefile modulefile ...') =head2 Modulecmd startup @@ -86,7 +83,7 @@ in the following order: =item 1. -Global RC file as specified by F<$MODULERCFILE> or F<$MODULESHOME/etc/rc>. +Global RC file as specified by F<$MODULERCFILE> or F<@prefix@/etc/rc>. If F<$MODULERCFILE> points to a directory, the F file in this directory is used as global RC file. @@ -408,7 +405,7 @@ and a directory containing a collection of master I. The path that the B command searches when looking for I. Typically, it is set to the master I directory, -I<$MODULESHOME/modulefiles>, by the initialization script. B +I<@prefix@/modulefiles>, by the initialization script. B can be set using B or by the module initialization script to search group or personal I directories before or after the master I directory. @@ -448,11 +445,11 @@ etc. =over -=item B<$MODULESHOME> +=item B<@prefix@> The B directory. -=item B<$MODULESHOME/etc/rc> +=item B<@prefix@/etc/rc> The system-wide modules rc file. The location of this file can be changed using the B environment variable as described above. @@ -465,18 +462,18 @@ The user specific modules rc file. The user specific collection directory. -=item B<$MODULESHOME/modulefiles> +=item B<@prefix@/modulefiles> The directory for system-wide I. The location of the directory can be changed using the B environment variable as described above. -=item B<$MODULESHOME/bin/modulecmd.tcl> +=item B<@libexecdir@/modulecmd.tcl> The I interpreter that gets executed upon each invocation of B. -=item B<$MODULESHOME/init/> +=item B<@initdir@/> The Modules package initialization file sourced into the user's environment.