MakeVars
defines make
variables for use in MakeTargets
and
specialized Makefile
s. The file itself has copious comments,
which may help your understanding.
Variable definitions may be on the command line, in a Makefile
,
in MakeVars, in a Pictools.properties
file, or in the environment.
That order is the precedence; definitions in one source override all those
in subsequent sources. Assignments in MakeVars are usually with "?="; that
is, if a variable already has a value it is not changed. Otherwise, variables
definedwith "=" will override previous definitions. (In make, "=" assignment
iis not evaluated until a reference is made to the defined variable. Someday
you may be tstruck by the wisdom of this.
Variables values are NOT exported to recipes
and recursive make
s. However, your Makefile may have export
directives,
as you like.
When a property value is a file or directory
name, it is almost always relative to SRCROOT
. It begins with a
slash, and ends without one. No spaces; only letters, digits, -, ., _, and / and : as delimiters.
As described in Makefiles and directories, MakeTargets
builds files from a source directory to a staging directory and then copies the files from that staging directory to the server. MakeVars sets variable _SITEPATH
to be the path from SRCROOT
to the current source directory
. So:
'make build' copies from SRCROOT/_SITEPATH
to STAGINGAREA/_SITEPATH
'make upload' copies from the latter to the server, that is, from STAGINGAREA/_SITEPATH
to SHDEST:PICSDIR/_SITEPATH
Mandatory Environment Variables
Before running make
or any Pictools scripts, two variables must be defined in the shell environment. As described in setup, they can be defined in either the user's environment or or the initialization script for the shell.
SRCROOT
- Path to the tree of source directories holding the site source.
The value must be a full path, start with a slash, and end without a slash.
Example value: /cygdrive/h/physpics/websrc
PICTOOLS
- Must contain the path to the
pictools
directory from SRCROOT
.
The value must start with a slash and end without a slash.
Usual value: /pictools
.
Initial steps
For startup, MakeVars does these
- Fetch the Pictools properties by
running
propcon
and
then importing Pictools.mkinc
. It the current directory
is not a child of SRCROOT
, properties are fetched from SRCROOT
.
- Define
SRC
to be the current directory, with drive letter in lower case.
- Check the values of
SRCROOT
and STAGINGAREA
.
- If PICSCP is set to fakescp, prompt for the ftp password.
Variables Defined from Properties
The variables are typically defined in /Pictools.properties
.
STAGINGAREA
- Path to the tree of directories holding the staging area.
Starts with slash; no final slash.
Example value: /cygdrive/c/physpics.com
PICSDIR
- A directory path on the server leading from the initial
SSHDEST directory to the directory corresponding to SRCROOT.
Examples: physpics.com (dreamhost); httpdocs (networksolutions)
The value may be empty and usually does not begin with a slash.
No final slash unlss value is "/" (highly unlikely).
SSHDEST
- User name and host name with '@' between. The destination for
sftp
to server. Example value: physpics@physpics.com
PICSCP
= scp
- May be set to
fakescp
to use ftp
instead of scp
.
To make this work you will have to modify MakeVars and MakeTargets to use ftp
instead of tar|tar.
PICPASS
- If using
fakescp or picmikdir
, the ftp
password must be supplied;
if PICPASS
is not set, MakeVars
prompts for the password and exports it to the environment used for running commands. (That is, the password is not stored in a file, but is available to commands run for recipes during this execution of make
.)
AFTERSSH =
DreamHost
aborts an upload if there are more than 10 ssh
calls per minute. As a work-around, this variable is inserted in MakeTargets
recipes after each ssh
. If you are using DreamHost
to do a major upload, set this variable to something like sleep 10
. It is usually enough to set this in the shell you are using for an upload; you may also set it in Pictools.properties as: afterssh = sleep 10
By the above, the server tree resides at ${SSHDEST}:${PICSDIR};
for example: physpics@physpics.com:httpdocs
Site Variables set by MakeVars
These variables are set by MakeVars
and may be used by the client Makefile
.
Most begin with slash and end without one. Server
begins with
a user name. If you think you need to change these
values in your client Makefile
,
you are wrong; do something differently.
_SITEPATH
= subpath
- Path from
$(SRCROOT)
to $(CURDIR)
. Something like: /annals/2015
; may be empty.
STAGE = ${STAGINGAREA}${_SITEPATH}
- '
build
' places files in this directory
SERVER = $(SSHDEST):$(PICSDIR)$(_SITEPATH)
- '
upload
' runs 'scp' to copy from STAGE
to SERVER
SRC = $(CURDIR)
- A copy of
Make
's CURDIR,
the initial current directory.
Content Variables
A client Makefile defines these variables to specify directory-specific
lists of things to be built, copied to the staging directory, or uploaded.
The default for each is no value.
SUBDIRS = dir1 dir2 ...
- A list of those subdirectories to be processed for buildall, updateall, and cleanall.
COPYFILES = file1 file2 ...
- Files to be copied to
STAGE
and then uploaded to SERVER
. If non-existent or out-of-date, they are first built.
BUILDTOSTAGE = file1 file2 ...
- Files to be built directly into
STAGE
. Although they do not appear in the source directory, these files ae must be listed without a directory name.
Rules for making items on the list do have the STAGE
directory
If file fffff.ext
is in the BUILDTOSTAGE
list,
there must be a rule for building STAGE/ffff.ext
BUILDONLY = file1 file2 ...
- Files to be generated locally for 'build', but not uploaded.
FINISHUPLOAD
- Additional targets to be added to the list of targets made for 'target 'upload'.
DEFINES = -Dv1=value1 -Dv2=value2 ...
- These variable definitions are passed along to
genhtm
for expanding caption files.
Example: -DtripTitle="Florida, Spring, 2007"
LOCALJUNK = item1 item2 ...
- A list of files or wild cards to be deleted for
make clean
. Entries may be file names or wild cards.
Example: testout.txt *.o foo*
TAR_EXCLUDE_LIST = _notes CVS *.BAK *~* Thumbs.db *.exe \
Pictools.csh Pictools.mkinc $(MORE_TAR_EXCLUDES)
- List of files to be omitted when creating tar files. Replace this value if
you do not wish to exclude some of these files.
MORE_TAR_EXCLUDES
- Set this variable to exclude additional files or types of files.
Default Content Lists
The following variables are given tentative values in MakeVars
. If the client wants some other value, it can reset them. Note that values are case-sensitive. All files listed are copied to the server.
HTMLFILES = *.html
IMAGEFILES = *.png *.PNG *.jpg *.JPG *.gif *.GIF *.bmp *.BMP
JSFILES = *.js
CSSFILES = *.css
PHPFILES = *.php
CAPFILE = *.cap
- is set by
MakeVars
to *.cap
. May be set by the
client to some other value. NO MORE THAN ONE
.cap
file is supported.
JUNKFILES = *~ $(LOCALJUNK)
- List of files to be removed for `make clean'
Targets
MakeVars defines a few standard targets, especially for recursion. The basic single directory targets--build and upload--are defined in MakeTargets. See Makefiles. The targets defined in MakeVars are all
, buildall
(the default), clean
, and cleanall
. Also defined are targets to create directories and the macros run-scp
and make-thumb
for copying to the server and making thumbnail images.
Debugging
The variable PICTOOLSDEBUG
may be defined in the shell environment
running make. If set, some tools will append notes to /tmp/pictoolsdebug
.
Larger values may give more information. (At present the talkative tools
are MakeVars
, MakeTargets
, gendirs.csh
, debug.csh
, fakescp
, gencaps
.)
When PICTOOLSDEBUG
is 5 or more, MakeVars
will show ALL defined variables.