Makefile should minimally contain the following:
all:: m5web-all # Identify documents to be built here. For example: DOCS += index DOCS += styles/main DOCS += styles/print # Identify simple image copies or conversions. For example: PNGS += icons/foo JPEGS += icons/bar SVGS += icons/baz SVGZS += icons/qux TARGET_LANGUAGE=en-GB INDEXBASE= include m5web.mk
That example expects the following files to exist:
- src/www/index.m5
- src/www/styles/main.m5
- src/www/styles/print.m5
- src/www/icons/foo.sfx1
- src/www/icons/bar.sfx2
- src/www/icons/baz.sfx3
- src/www/icons/qux.sfx4
…where sfx1 is png or a suffix for an image type that can be converted to PNG, sfx2 is jpg or a suffix for an image type that can be converted to JPEG, etc.
Suffixes
You can configure the suffixes used for different file types, in both source and public directories. For a given type, identified by a label TYPE, there are upto four pre-defined variables in Make:
-
TYPE_DFL_SUFFIX — This is an internal suffix which you should not override. It is also the suffix used inside var/www/.
-
TYPE_SRC_SUFFIX — This is the suffix identifying the type within src/www/. You probably won't need to change this, but you can if it makes things more convenient. It defaults to
$(TYPE_DFL_SUFFIX)
. -
TYPE_SUFFIX — This is the suffix identifying the type in pub/www. It defaults to
$(TYPE_DFL_SUFFIX)
. -
TYPE_LNK_SUFFIX — This is the suffix used to link to files of this type. It defaults to
$(TYPE_SUFFIX)
. Clear it to enable content negotiation, or simply to make the link independent of the underlying technology.
The types HTML, CSS, XHTML, XSLT2HTML, PHP2HTML and STDMAP don't define a source suffix TYPE_SRC_SUFFIX, as they are usually created from Mokvino files. Other types, mainly graphics, define all four variables.
Many of these variables, especially those of the form TYPE_SUFFIX and TYPE_LNK_SUFFIX, are exported to Mokvino under the same names.
Multiple installations
You might want to have multiple installations of your site's source, each requiring variations in the configuration to suit the different environments. For example, to build your public pages, you might want to use hyperlinks without suffixes, and have each page available in all languages defined for it. Makefile would then have to contain:
all:: m5web-all HTML_LNK_SUFFIX=
Meanwhile, for testing and preparation, you could have a local installation that only generates pages in English, and uses full suffixes, even on index pages. For that, you'd need:
all:: m5web-all TARGET_LANGUAGE=en-GB INDEXBASE=
To achieve both, without causing conflicts in your version-control system, use this instead:
all:: m5web-all -include mysite-env.mk
This will cause GNU Make to search for mysite-env.mk in the same directory as Makefile, then to try other locations as defined by -Idirectory. This gives you a chance to inject local configuration by putting it in that file, without causing an error if not found.