> pictools > doc > MakeTargets
> pictools > doc > MakeTargets
Pictools: MakeFile Internals
V3.3 (342)
MakeTargets
/pictools/MakeTargets
Include file for Makefiles; implements targets 'build' and 'upload'
usage, in a Makefile: include $(PICTOOLS)/MakeTargets

MakeTargets is the action complement to MakeVars, which defines variables that control the behaviors described below.. Other useful values are properties.

The main action targets are build and upload. Target build builds or copies files from the current directory to its corresponding staging area directory. Target upload copies the files from the staging area to the corresponding directory on the server. (The plan was to be able to view files in the staging area. This now fails because files are php scripts that need to run on the server.)

Referring to the directories diagram, the current directory is SRC and its path from SRCROOT is _SITEPATH. So the source directory is SRCROOT/_SITEPATH, the staging directory is STAGINGAREA/_SITEPATH, and the directory on the server is SSHDEST/PICSDIR/_SITEPATH.  _SITEPATH is derived by MakeVars, the other values should be defined in Pictools.properties or one of the alternatives described in the propcon document.

Targets

MakeTargets (together with MakeVars) defines the targets in the following table. The default is buildall.

all
recursive Same as buildall, this is the default target
build local Transfer local files to the staging area a STAGINGAREA/THISDIR; buld local files locally or to the staging area
buildall recursive Does the build target in this directory and then in all the SUBDIRS directories
upload local Uploads to the server all the files in the staging area for this directory; invokes target uploadpix
uploadall recursive Makes the 'upload' target locally and recurs to do 'uploadall' in each of the SUBDIRS directories
uploadpix local Uploads all the pictures in those PICTURESROOT directories mentioned in the captions file.
capinfo local Prints the lists generated from the captions file: the segment names, the two files generated for each, and the list of directories to be uploaded from PICDIRSROOT.
clean
local Removes all files listed in JUNKFILES, including those in LOCALJUNK.
cleanall recursive Recurses through the SUBDIRS doing cleanall in each; then does the 'clean' target locally

The value of SUBDIRS may be set on the command line: 'make SUBDIRS=2007 upload'. It is not passed recursively, so the named sub-directories and all their descendants are processed.

In detail, the 'build' target

  • builds locally the files listed in BUILDONLY,
  • copies to the staging area the files listed in COPYFILES,
  • builds to the staging area the files listed in BUILDTOSTAGE,
  • builds to the staging area the segments listed in the local captions file
  • copies to the staging area all the files in these lists collected by MakeVars: IMAGEFILES HTMLFILES PHPFILES JSFILES CAPFILE CSSFILES

The 'upload' target uploads all of those items except those in BUILDONLY. The time of upload is recorded as the time on a dummy file called uploadtime in the staging area directory.

Processing captions files

CAPFILE is processed through gendirs to create image viewing pages. For cap file xxx.cap, MakeTargets generates a file called xxx-titles.txt. This has HTML code for the elements of a list that can be included in the html portion of a .php page like this: <ul> <?php include("xxx-titles.txt"); ?></ul>

If there is a .cap file it is segmented by header lines like:

file: segmentname description  

'Make build' processes the cap file by calling gendirs on it. For each segment name, gendirs creates directory segname in the staging area and populates it with index.php and localcaptions.cap.

The actual pictures for a captions file are those in those PICTURESROOT subdirectories listed in 'picturesdir' lines in the captions file. See Uploading Pictures, just below.

Creating Directories

Maketargets must create a number of directories in both the staging area and on the server.The mechanism driving this relies on gnumake's order-only-prerequisites. These appear at the end of a prerequisite list, separated from full prerequisites by a vertical bar:

$(_BUILDONTOSTAGE) : | $(STAGE)/.

Written this way, the prerequisite gets made only if it does not exist; its relative time does not matter. The rule for creating a directory relies on the final "/." in the directory name:

%/. :
        mkdir -p $@

The mechanim for creating directories on the server is similar, but the action is either 'ssh SSHDEST mkdir DIRECTORY' or 'picmkdir SSHDEST DIRECTORY'

The time (and fact) of directory creation is recorded in the staging area with a dummy file, serverdir.

Uploading Pictures

Captions files have "picturesdir:" lines. Each names a directory where full, unscaled pictuers are stored. For each named directory, MakeTargets runs therein the command 'make -f  MakeServerPix upload'. This process scales the pictures into the staging area amd uploads them to the correponding directory on the sever.

 
Copyright © 2018 ZweiBieren, All rights reserved. Dec 20, 2018 12:18 GMT Page maintained by ZweiBieren