# Makefile -- generate Alphadoc web pages # # This Makefile generates the web pages for the Alpha systems. Prepared # HTML pages for each system is contained in a "sysdata" directory tree. # Although the files under this directory contain HTML markup, they are # not self-contained web pages. To this end, a number of (PHP) formatter # scripts is used to add various bits to the aforementioned HTML pages, # creating self-contained web pages. # # June 18, 2018 # PROJECT_NAME = Alpha Documentation Pages ### USER CONFIGURATION SECTION ### # # Target directory for generated HTML files. # Permissions and ownership is optional. # WWWROOT = html PERM_DIR = PERM_FILE = OWNER = GROUP = MKDIRHIER = mkdir -p INSTALL_DATA = install -m644 WGET = wget --timestamping --progress=dot # # Don't generate any thumbnail images. This is primarily to # save time during testing. Default is to disable this # option, so thumbnails are generated. Set to `1' to enable # the option. # NO_THUMBNAILS = 0 # # Options for the web page generator script. # # EN_BLITZ_FCO : Add Blitz and FCOs to Document pages # EN_IPB : Add Illustrated Parts Breakdown pages # GEN_FLAGS = #-DEN_BLITZ_FCO -DEN_IPB ### END USER CONFIGURATION SECTION ### ### MAINTAINER CONFIGURATION SECTION ### # # Command echo'ing. # Q = @ # # Location of support scripts. # SCRIPTS_DIR = scripts # # Script for formatting the web pages. # GEN_SYS_PAGE = $(SCRIPTS_DIR)/gen_sys_page.php GETVALUE = $(SCRIPTS_DIR)/getvalue.php LSTHUMBNAILS = $(SCRIPTS_DIR)/list_tn_files.php MKTHUMBNAIL = $(SCRIPTS_DIR)/mk_thumbnail.sh # # Directory names for the "sysdata" tree. # SYSDATA_DIR = $(SITEDATA_DIR)/sysdata API_DIR = api ASPSYS_DIR = aspensystems BTG_DIR = btg CARRERA_DIR = carreracomputers COMPAQ_DIR = compaq COREMICRO_DIR = coremicro DCG_DIR = dcgcomputers DEC_DIR = dec DTI_DIR = deskstation FORCE_DIR = forcecomputers HARDDATA_DIR = harddata HP_DIR = hp ICS_DIR = ics ITC_DIR = itc MAXVISION_DIR = maxvision MICROWAY_DIR = microway NCP_DIR = ncp NEKOTECH_DIR = nekotech PANDA_DIR = panda POLYWELL_DIR = polywell SAMSUNG_DIR = samsung SHANNON_DIR = shannon SMART_DIR = smart TRISTAR_DIR = tristar # # Directory names for the "sitedata" tree. # SITEDATA_DIR := $(shell $(GETVALUE) sitedata) GLOBAL_DIR := $(SITEDATA_DIR)/global # A number of definitions set in the PHP files. # In order to omit duplicating definitions, we # use the `getvalue.php' helper script to fetch # the values. # HTML_EXT := $(shell $(GETVALUE) htmlext) THUMB_EXT := $(shell $(GETVALUE) thumbnailext) SUFFIX_SEP := $(shell $(GETVALUE) suffixsep) SPEC_SUFF := $(shell $(GETVALUE) specsuffix) DOC_SUFF := $(shell $(GETVALUE) docsuffix) MEDIA_SUFF := $(shell $(GETVALUE) mediasuffix) CSS_FILE := $(shell $(GETVALUE) css) HREF_BASE := $(shell $(GETVALUE) sitehref) # # Alpha system names as they appear in the "sysdata" tree. # The names are sorted by vendor since some Alpha systems # were marketed by multiple vendors. # SYS_API := $(shell $(GETVALUE) sysids api) SYS_ASPSYS := $(shell $(GETVALUE) sysids aspensystems) SYS_BTG := $(shell $(GETVALUE) sysids btg) SYS_CARRERA := $(shell $(GETVALUE) sysids carreracomputers) SYS_COMPAQ := $(shell $(GETVALUE) sysids compaq) SYS_COREMICRO := $(shell $(GETVALUE) sysids coremicro) SYS_DCG := $(shell $(GETVALUE) sysids dcgcomputers) SYS_DEC := $(shell $(GETVALUE) sysids dec) SYS_DTI := $(shell $(GETVALUE) sysids deskstation) SYS_FORCE := $(shell $(GETVALUE) sysids forcecomputers) SYS_HARDDATA := $(shell $(GETVALUE) sysids harddata) SYS_HP := $(shell $(GETVALUE) sysids hp) SYS_ICS := $(shell $(GETVALUE) sysids ics) SYS_ITC := $(shell $(GETVALUE) sysids itc) SYS_MAXVISION := $(shell $(GETVALUE) sysids maxvision) SYS_MICROWAY := $(shell $(GETVALUE) sysids microway) SYS_NCP := $(shell $(GETVALUE) sysids ncp) SYS_NEKOTECH := $(shell $(GETVALUE) sysids nekotech) SYS_PANDA := $(shell $(GETVALUE) sysids panda) SYS_POLYWELL := $(shell $(GETVALUE) sysids polywell) SYS_SAMSUNG := $(shell $(GETVALUE) sysids samsung) SYS_SHANNON := $(shell $(GETVALUE) sysids shannon) SYS_SMART := $(shell $(GETVALUE) sysids smart) SYS_TRISTAR := $(shell $(GETVALUE) sysids tristar) # # Generate targets for web pages for all the systems of every vendor. # SPEC_TARGETS_API = $(call fmt_spec_targets, API) DOC_TARGETS_API = $(call fmt_doc_targets, API) MEDIA_TARGETS_API = $(call fmt_media_targets, API) SPEC_TARGETS_ASPSYS = $(call fmt_spec_targets, ASPSYS) DOC_TARGETS_ASPSYS = $(call fmt_doc_targets, ASPSYS) MEDIA_TARGETS_ASPSYS = $(call fmt_media_targets, ASPSYS) SPEC_TARGETS_BTG = $(call fmt_spec_targets, BTG) DOC_TARGETS_BTG = $(call fmt_doc_targets, BTG) MEDIA_TARGETS_BTG = $(call fmt_media_targets, BTG) SPEC_TARGETS_CARRERA = $(call fmt_spec_targets, CARRERA) DOC_TARGETS_CARRERA = $(call fmt_doc_targets, CARRERA) MEDIA_TARGETS_CARRERA = $(call fmt_media_targets, CARRERA) SPEC_TARGETS_COMPAQ = $(call fmt_spec_targets, COMPAQ) DOC_TARGETS_COMPAQ = $(call fmt_doc_targets, COMPAQ) MEDIA_TARGETS_COMPAQ = $(call fmt_media_targets, COMPAQ) SPEC_TARGETS_COREMICRO = $(call fmt_spec_targets, COREMICRO) DOC_TARGETS_COREMICRO = $(call fmt_doc_targets, COREMICRO) MEDIA_TARGETS_COREMICRO = $(call fmt_media_targets, COREMICRO) SPEC_TARGETS_DCG = $(call fmt_spec_targets, DCG) DOC_TARGETS_DCG = $(call fmt_doc_targets, DCG) MEDIA_TARGETS_DCG = $(call fmt_media_targets, DCG) SPEC_TARGETS_DEC = $(call fmt_spec_targets, DEC) DOC_TARGETS_DEC = $(call fmt_doc_targets, DEC) MEDIA_TARGETS_DEC = $(call fmt_media_targets, DEC) SPEC_TARGETS_DTI = $(call fmt_spec_targets, DTI) DOC_TARGETS_DTI = $(call fmt_doc_targets, DTI) MEDIA_TARGETS_DTI = $(call fmt_media_targets, DTI) SPEC_TARGETS_FORCE = $(call fmt_spec_targets, FORCE) DOC_TARGETS_FORCE = $(call fmt_doc_targets, FORCE) MEDIA_TARGETS_FORCE = $(call fmt_media_targets, FORCE) SPEC_TARGETS_HARDDATA = $(call fmt_spec_targets, HARDDATA) DOC_TARGETS_HARDDATA = $(call fmt_doc_targets, HARDDATA) MEDIA_TARGETS_HARDDATA = $(call fmt_media_targets, HARDDATA) SPEC_TARGETS_HP = $(call fmt_spec_targets, HP) DOC_TARGETS_HP = $(call fmt_doc_targets, HP) MEDIA_TARGETS_HP = $(call fmt_media_targets, HP) SPEC_TARGETS_ICS = $(call fmt_spec_targets, ICS) DOC_TARGETS_ICS = $(call fmt_doc_targets, ICS) MEDIA_TARGETS_ICS = $(call fmt_media_targets, ICS) SPEC_TARGETS_ITC = $(call fmt_spec_targets, ITC) DOC_TARGETS_ITC = $(call fmt_doc_targets, ITC) MEDIA_TARGETS_ITC = $(call fmt_media_targets, ITC) SPEC_TARGETS_MAXVISION = $(call fmt_spec_targets, MAXVISION) DOC_TARGETS_MAXVISION = $(call fmt_doc_targets, MAXVISION) MEDIA_TARGETS_MAXVISION = $(call fmt_media_targets, MAXVISION) SPEC_TARGETS_MICROWAY = $(call fmt_spec_targets, MICROWAY) DOC_TARGETS_MICROWAY = $(call fmt_doc_targets, MICROWAY) MEDIA_TARGETS_MICROWAY = $(call fmt_media_targets, MICROWAY) SPEC_TARGETS_NCP = $(call fmt_spec_targets, NCP) DOC_TARGETS_NCP = $(call fmt_doc_targets, NCP) MEDIA_TARGETS_NCP = $(call fmt_media_targets, NCP) SPEC_TARGETS_NEKOTECH = $(call fmt_spec_targets, NEKOTECH) DOC_TARGETS_NEKOTECH = $(call fmt_doc_targets, NEKOTECH) MEDIA_TARGETS_NEKOTECH = $(call fmt_media_targets, NEKOTECH) SPEC_TARGETS_PANDA = $(call fmt_spec_targets, PANDA) DOC_TARGETS_PANDA = $(call fmt_doc_targets, PANDA) MEDIA_TARGETS_PANDA = $(call fmt_media_targets, PANDA) SPEC_TARGETS_POLYWELL = $(call fmt_spec_targets, POLYWELL) DOC_TARGETS_POLYWELL = $(call fmt_doc_targets, POLYWELL) MEDIA_TARGETS_POLYWELL = $(call fmt_media_targets, POLYWELL) SPEC_TARGETS_SAMSUNG = $(call fmt_spec_targets, SAMSUNG) DOC_TARGETS_SAMSUNG = $(call fmt_doc_targets, SAMSUNG) MEDIA_TARGETS_SAMSUNG = $(call fmt_media_targets, SAMSUNG) SPEC_TARGETS_SHANNON = $(call fmt_spec_targets, SHANNON) DOC_TARGETS_SHANNON = $(call fmt_doc_targets, SHANNON) MEDIA_TARGETS_SHANNON = $(call fmt_media_targets, SHANNON) SPEC_TARGETS_SMART = $(call fmt_spec_targets, SMART) DOC_TARGETS_SMART = $(call fmt_doc_targets, SMART) MEDIA_TARGETS_SMART = $(call fmt_media_targets, SMART) SPEC_TARGETS_TRISTAR = $(call fmt_spec_targets, TRISTAR) DOC_TARGETS_TRISTAR = $(call fmt_doc_targets, TRISTAR) MEDIA_TARGETS_TRISTAR = $(call fmt_media_targets, TRISTAR) ALL_SPEC_TARGETS = $(SPEC_TARGETS_API) $(SPEC_TARGETS_ASPSYS) \ $(SPEC_TARGETS_BTG) $(SPEC_TARGETS_CARRERA) \ $(SPEC_TARGETS_COMPAQ) $(SPEC_TARGETS_COREMICRO) \ $(SPEC_TARGETS_DCG) $(SPEC_TARGETS_DEC) \ $(SPEC_TARGETS_DTI) $(SPEC_TARGETS_FORCE) \ $(SPEC_TARGETS_HARDDATA) $(SPEC_TARGETS_HP) \ $(SPEC_TARGETS_ICS) $(SPEC_TARGETS_ITC) \ $(SPEC_TARGETS_MAXVISION) $(SPEC_TARGETS_MICROWAY) \ $(SPEC_TARGETS_NCP) $(SPEC_TARGETS_NEKOTECH) \ $(SPEC_TARGETS_PANDA) $(SPEC_TARGETS_POLYWELL) \ $(SPEC_TARGETS_SAMSUNG) $(SPEC_TARGETS_SHANNON) \ $(SPEC_TARGETS_SMART) $(SPEC_TARGETS_TRISTAR) ALL_DOC_TARGETS = $(DOC_TARGETS_API) $(DOC_TARGETS_ASPSYS) \ $(DOC_TARGETS_BTG) $(DOC_TARGETS_CARRERA) \ $(DOC_TARGETS_COMPAQ) $(DOC_TARGETS_COREMICRO) \ $(DOC_TARGETS_DCG) $(DOC_TARGETS_DEC) \ $(DOC_TARGETS_DTI) $(DOC_TARGETS_FORCE) \ $(DOC_TARGETS_HARDDATA) $(DOC_TARGETS_HP) \ $(DOC_TARGETS_ICS) $(DOC_TARGETS_ITC) \ $(DOC_TARGETS_MAXVISION) $(DOC_TARGETS_MICROWAY) \ $(DOC_TARGETS_NCP) $(DOC_TARGETS_NEKOTECH) \ $(DOC_TARGETS_PANDA) $(DOC_TARGETS_POLYWELL) \ $(DOC_TARGETS_SAMSUNG) $(DOC_TARGETS_SHANNON) \ $(DOC_TARGETS_SMART) $(DOC_TARGETS_TRISTAR) ALL_MEDIA_TARGETS = $(MEDIA_TARGETS_API) $(MEDIA_TARGETS_ASPSYS) \ $(MEDIA_TARGETS_BTG) $(MEDIA_TARGETS_CARRERA) \ $(MEDIA_TARGETS_COMPAQ) $(MEDIA_TARGETS_COREMICRO) \ $(MEDIA_TARGETS_DCG) $(MEDIA_TARGETS_DEC) \ $(MEDIA_TARGETS_DTI) $(MEDIA_TARGETS_FORCE) \ $(MEDIA_TARGETS_HARDDATA) $(MEDIA_TARGETS_HP) \ $(MEDIA_TARGETS_ICS) $(MEDIA_TARGETS_ITC) \ $(MEDIA_TARGETS_MAXVISION) $(MEDIA_TARGETS_MICROWAY) \ $(MEDIA_TARGETS_NCP) $(MEDIA_TARGETS_NEKOTECH) \ $(MEDIA_TARGETS_PANDA) $(MEDIA_TARGETS_POLYWELL) \ $(MEDIA_TARGETS_SAMSUNG) $(MEDIA_TARGETS_SHANNON) \ $(MEDIA_TARGETS_SMART) $(MEDIA_TARGETS_TRISTAR) # # Targets for global web pages. # INDEX_TARGET = $(GLOBAL_DIR)/index.html ABOUT_TARGET = $(GLOBAL_DIR)/about.html ALPHADOCS_TARGET = $(GLOBAL_DIR)/alphadocs.html TECH_TARGETS = $(GLOBAL_DIR)/tech.html \ $(GLOBAL_DIR)/tech.alphachips.html ALL_GLOBAL_TARGETS = $(INDEX_TARGET) $(ABOUT_TARGET) $(ALPHADOCS_TARGET) \ $(TECH_TARGETS) # # Targets for thumbnail files. These targets are not known in advance # because the thumbnail filenames are extracted from the Media page HTML # file which are targets by themself. So, we create an "index file" for # each Media page HTML which have similar naming. The "index file" will # list the thumbnail filenames extracted from the Media page HTML. # ifeq ($(strip $(NO_THUMBNAILS)),0) ALL_THUMBNAIL_IDX_TARGETS = $(ALL_MEDIA_TARGETS:.$(HTML_EXT)=.thumbs.mk) endif ALL_TARGETS = $(ALL_SPEC_TARGETS) \ $(ALL_DOC_TARGETS) \ $(ALL_MEDIA_TARGETS) \ $(ALL_GLOBAL_TARGETS) \ $(ALL_THUMBNAIL_TARGETS) \ $(ALL_THUMBNAIL_IDX_TARGETS) # # Verbatim files. # SUPPORT_FILES = $(call fmt_relative_path, $(CSS_FILE)) # # Web page dependencies. # COMMON_DEPS = $(SCRIPTS_DIR)/inc/defs.php \ $(SCRIPTS_DIR)/inc/systems.php \ $(SITEDATA_DIR)/common/footer.in \ $(SITEDATA_DIR)/common/header.in \ $(SITEDATA_DIR)/common/tabbar.in \ $(SITEDATA_DIR)/common/alphadocs_body_tmpl.in \ $(SITEDATA_DIR)/common/alphadocs_head_tmpl.in \ $(SITEDATA_DIR)/common/doc_body_tmpl.in \ $(SITEDATA_DIR)/common/doc_head_tmpl.in \ $(SITEDATA_DIR)/common/doc_category_ov.in \ $(SITEDATA_DIR)/common/media_body_tmpl.in \ $(SITEDATA_DIR)/common/media_head_tmpl.in \ $(SITEDATA_DIR)/common/spec_body_tmpl.in \ $(SITEDATA_DIR)/common/spec_head_tmpl.in # # List of support directories in HTML target directory. # Note that some directories may be defined as absolute # paths because they're used in that way in the web pages. # Turn these directories in relative paths if necessary. # SUPPORT_DIRS = $(call fmt_relative_path, $(dir $(CSS_FILE))) # # HTML installation directory and list of directories under # installation directory. # INSTALL_DIR = $(WWWROOT)/$(call fmt_relative_path,$(HREF_BASE)) ALL_INSTALL_DIRS = $(call fmt_relative_path_list, \ $(subst $(SYSDATA_DIR),, $(sort \ $(dir $(ALL_SPEC_TARGETS) \ $(ALL_DOC_TARGETS) \ $(ALL_MEDIA_TARGETS)) \ )) \ $(subst $(GLOBAL_DIR),, $(sort \ $(dir $(ALL_GLOBAL_TARGETS)) \ )) \ $(subst $(SYSDATA_DIR),, $(sort \ $(dir $(ALL_THUMBNAIL_TARGETS)) \ )) \ $(SUPPORT_DIRS) \ ) # # Generate targets for the web pages of given vendor. # # Format: //. # # $1: Vendor name (uppercase). # $2: Type of web pages. This is indicated by the # suffix of the page. See *_SUFF variables. # fmt_targets = \ $(addprefix $(SYSDATA_DIR)/$($(strip $1)_DIR)/, \ $(addsuffix $(SUFFIX_SEP)$($(strip $2)_SUFF).$(HTML_EXT), \ $(SYS_$(strip $1))) \ ) fmt_spec_targets = $(call fmt_targets, $1, SPEC) fmt_doc_targets = $(call fmt_targets, $1, DOC) fmt_media_targets = $(call fmt_targets, $1, MEDIA) # # Ensure pathname is relative. Note that the function does # not support pathnames containing spaces. # # $1: Pathname. # fmt_relative_path = $(subst $(space),/,$(strip $(subst /, ,$1))) # # Turn list of pathnames into relative paths. This is a bulk # version of the "fmt_relative_path" function. # # $1: List of pathnames. # fmt_relative_path_list = $(foreach p, $1, $(call fmt_relative_path,$p)) ### END MAINTAINER CONFIGURATION SECTION ### empty := space := $(empty) $(empty) # # This is mainly for thumbnail generation. If the file was # not created successfully, it may be empty or corrupt. So, # we'll remove the file. # .DELETE_ON_ERROR: # # Enable secondary expansion such that certain targets can # pick up the final value of ALL_THUMBNAIL_TARGETS variable. # .SECONDEXPANSION: ################################# BUILD RULES ################################## all: $$(ALL_TARGETS) global-pages: $(ALL_GLOBAL_TARGETS) spec-pages: $(ALL_SPEC_TARGETS) doc-pages: $(ALL_DOC_TARGETS) media-pages: $(ALL_MEDIA_TARGETS) thumbnails: $$(ALL_THUMBNAIL_TARGETS) install: install-global-pages install-support-files install-system-pages ifeq ($(strip $(NO_THUMBNAILS)),0) install: install-thumbnails endif # # Transfer index page etc. to HTML target directory. # Permissions and ownership are set, if requested. # install-global-pages: global-pages install-dirs @echo "Installing global pages in \`$(INSTALL_DIR)'" $(Q)htmldir="$(strip $(INSTALL_DIR))"; perm="$(strip $(PERM_FILE))"; \ htmldir=`readlink -e $$htmldir`; \ cd $(GLOBAL_DIR); \ html_list="$(call fmt_relative_path_list, \ $(subst $(GLOBAL_DIR),,$(ALL_GLOBAL_TARGETS)))"; \ for html in $$html_list; do \ echo " $$html"; \ $(INSTALL_DATA) $$html $$htmldir/$$html; done # # Transfer CSS file and the like to HTML target directory. # Permissions and ownership are set, if requested. # install-support-files: install-dirs @echo "Installing support files in \`$(INSTALL_DIR)'" $(Q)htmldir="$(strip $(INSTALL_DIR))"; perm="$(strip $(PERM_FILE))"; \ htmldir=`readlink -e $$htmldir`; \ cd $(SITEDATA_DIR); \ file_list="$(call fmt_relative_path_list, \ $(subst $(SITEDATA_DIR),,$(SUPPORT_FILES)))"; \ for file in $$file_list; do \ echo " $$file"; \ $(INSTALL_DATA) $$file $$htmldir/$$file; done # # Transfer generated HTML files to HTML target directory. The # sub-directories *under* the "sysdata" directory are mirrored # in the HTML target directory. # Permissions and ownership are set, if requested. # install-system-pages: spec-pages doc-pages media-pages install-dirs @echo "Installing system-specific pages in \`$(INSTALL_DIR)'" $(Q)htmldir="$(strip $(INSTALL_DIR))"; perm="$(strip $(PERM_FILE))"; \ owner="$(strip $(OWNER))"; group="$(strip $(GROUP))"; \ opt_perm=$${perm:+-m$$perm}; \ opt_owner=$${owner:+-o$$owner}; \ opt_group=$${group:+-g$$group}; \ htmldir=`readlink -e $$htmldir`; \ cd $(SYSDATA_DIR); \ html_list="$(call fmt_relative_path_list, \ $(subst $(SYSDATA_DIR),,$(ALL_SPEC_TARGETS) $(ALL_DOC_TARGETS) $(ALL_MEDIA_TARGETS)))"; \ for html in $$html_list; do \ echo " $$html"; \ $(INSTALL_DATA) $$opt_owner $$opt_group $$opt_perm $$html $$htmldir/$$html; done # # Transfer thumbnail images to HTML target directory. The # sub-directories *under* the "sysdata" directory are mirrored # in the HTML target directory. Since the thumbnail images are # prefixed by HREF_BASE that prefix needs to be omitted prior # to installation. # Permissions and ownership are set, if requested. # install-thumbnails: thumbnails install-dirs @echo "Installing thumbnails in \`$(INSTALL_DIR)'" $(Q)htmldir="$(strip $(INSTALL_DIR))"; \ perm="$(strip $(PERM_FILE))"; \ owner="$(strip $(OWNER))"; group="$(strip $(GROUP))"; \ opt_perm=$${perm:+-m$$perm}; \ opt_owner=$${owner:+-o$$owner}; \ opt_group=$${group:+-g$$group}; \ htmldir=`readlink -e $$htmldir`; \ cd $(SYSDATA_DIR); \ tn_list="$(call fmt_relative_path_list, \ $(subst $(SYSDATA_DIR),,$(ALL_THUMBNAIL_TARGETS)))"; \ for tn in $$tn_list; do \ echo " $$tn"; \ $(INSTALL_DATA) $$opt_owner $$opt_group $$opt_perm $$tn $$htmldir/$$tn; done # # Prepare the target HTML directory tree. # # Create directory for target HTML files, vendor and system # sub-directories, support directories etc. # Permissions and ownership are set for the directories, if # requested, but after *all* directories have been created. # Using narrow permissions could deny the ability to create # sub-directories. # install-dirs: @echo "Creating HTML target directory \`$(INSTALL_DIR)'" $(Q)htmldir="$(strip $(INSTALL_DIR))"; \ if test -n "$$htmldir"; then \ if test ! -d "$$htmldir"; then \ $(MKDIRHIER) $$htmldir; fi; \ else \ echo "No HTML target directory set."; false; fi @echo "Populating HTML target directory..." $(Q)htmldir="$(strip $(INSTALL_DIR))"; \ dirs="$(ALL_INSTALL_DIRS)"; \ for dir in $$dirs; do \ ( cd $$htmldir && $(MKDIRHIER) $$dir; ); \ done @echo "Checking permissions and ownership..." $(Q)htmldir="$(strip $(INSTALL_DIR))"; \ dirs="$(ALL_INSTALL_DIRS)"; \ perm="$(strip $(PERM_DIR))"; \ owner="$(strip $(OWNER))"; \ group="$(strip $(GROUP))"; \ for dir in $$dirs; do \ dirlist=`echo $$dir | sed -e 's@/@ @g' 2>/dev/null`; \ ( cd $$htmldir && for subdir in $$dirlist; do \ if test -n "$$perm"; then \ echo "Setting directory permissions on \`$$subdir'"; \ chmod $$perm $$subdir; fi; \ if test "$$owner:$$group" != ":"; then \ echo "Setting directory ownership on \`$$subdir'"; \ chown $$owner:$$group $$subdir; fi; \ cd $$subdir; \ done; \ ); \ done; \ if test -n "$$perm"; then \ echo "Setting directory permissions on \`$$htmldir'"; \ chmod $$perm $$htmldir; fi; \ if test "$$owner:$$group" != ":"; then \ echo "Setting directory ownership on \`$$htmldir'"; \ chown $$owner:$$group $$htmldir; fi $(ALL_TARGETS): $(COMMON_DEPS) $(ALL_SPEC_TARGETS): page = spec $(ALL_DOC_TARGETS): page = doc $(ALL_MEDIA_TARGETS): page = media $(ALL_DOC_TARGETS) $(ALL_MEDIA_TARGETS) $(ALL_SPEC_TARGETS): %.$(HTML_EXT): %.in $(Q)dir=`dirname $@`; vendor=$${dir##*/}; \ base=`basename $@`; sysid=$${base%$(SUFFIX_SEP)*.$(HTML_EXT)}; \ sysname=`$(GETVALUE) sysname "$$vendor" "$$sysid"`; \ echo "Generating \"$(page)\" page for $$vendor-$$sysid"; \ $(GEN_SYS_PAGE) $(GEN_FLAGS) "$(page)" "$<" "$$sysnam" >$@ $(ALL_GLOBAL_TARGETS): %.$(HTML_EXT): %.in $(Q)base=`basename $@`; page=$${base%%.*}; \ echo "Generating \"$$page\" page"; \ $(GEN_SYS_PAGE) $(GEN_FLAGS) "$$page" "$<" "$(PROJECT_NAME)" >$@ # # Generate Makefile for thumbnails. The thumbnail paths are extracted from # the HTML file and are stored under the SYSDATA directory (preserving # the directory components of the path). The original image, downloaded from # the (remote) host will be stored next to the corresponding thumbnail. The # idea is that the HTML file determines the thumbnail paths and the # Makefile honours them. # # For each thumbnail a build rule is defined as is for each image to be # downloaded. # # The (Makefile) variables ALL_THUMBNAIL_TARGETS and ALL_IMAGE_TARGETS keep # track of the thumbnails and image files that have been created resp. # downloaded. These variables can be used later on for "install" and "clean" # targets. For the targets on the ALL_THUMBNAIL_TARGETS variable, the prefix # HREF_BASE is removed. # # Note that the correct escaping of the '$'-sign is used in the build rule. # Some expansions are meant for the build rule in the generated Makefile. # %.thumbs.mk: %.$(HTML_EXT) $(Q)echo "# Thumbnail Makefile. This file is auto-generated." > $@ $(Q)$(LSTHUMBNAILS) $< | while read line; do \ base_dir="$(SYSDATA_DIR)"; \ tn_loc=`echo "$$line" | cut -f1 2>/dev/null`; \ tn_loc=`echo "$$tn_loc" | sed -e 's!^$(HREF_BASE)!!' 2>/dev/null`; \ img_url=`echo "$$line" | cut -f2 2>/dev/null`; \ tn_dir=`dirname $$tn_loc 2>/dev/null`; \ img_dir="$$tn_dir"; \ img_name=`basename $$img_url 2>/dev/null`; \ tn="$$base_dir/$${tn_loc%.*}.$(THUMB_EXT)"; \ img="$$base_dir/$$img_dir/$$img_name"; \ echo "" >> $@; \ echo "$$tn: $$img" >> $@; \ echo -e "\t\$$(Q)\$$(MKDIRHIER) $$base_dir/$$tn_dir" >> $@; \ echo -e "\t\$$(Q)\$$(MKTHUMBNAIL) \$$< \$$@" >> $@; \ echo "" >> $@; \ echo "$$img:" >> $@; \ echo -e "\t\$$(Q)\$$(MKDIRHIER) $$base_dir/$$img_dir" >> $@; \ echo -e "\t\$$(Q)\$$(WGET) -nd -nH -P \$$(@D) $$img_url" >> $@; \ echo "" >> $@; \ echo "ALL_THUMBNAIL_TARGETS += $$tn" >> $@; \ echo "ALL_IMAGE_TARGETS += $$img" >> $@; \ echo "" >> $@; \ done; clean: rm -f $(ALL_SPEC_TARGETS) rm -f $(ALL_DOC_TARGETS) rm -f $(ALL_MEDIA_TARGETS) rm -f $(ALL_GLOBAL_TARGETS) rm -f $(ALL_THUMBNAIL_TARGETS) distclean: clean rm -f $(ALL_THUMBNAIL_IDX_TARGETS) rm -f $(ALL_IMAGE_TARGETS) help: @echo @echo "$(PROJECT_NAME)" @echo @echo "Available targets:" @echo @echo " all - generate all web pages (default)" @echo " global-pages - generate global site pages" @echo " spec-pages - generate Specification page for all systems" @echo " doc-pages - generate Documentation page for all systems" @echo " media-pages - generate Media page for all systems" @echo " thumbnails - generate thumbnail images" @echo " install - install generated web pages in target directory" @echo " (default: $(INSTALL_DIR))" @echo " clean - remove generated web pages and thumbnails" @echo " distclean - clean + remove thumbnail Makefiles and images" @echo @echo "Parameters:" @echo @echo " WWWROOT : $(WWWROOT)" @echo .PHONY: all global-pages spec-pages doc-pages media-pages thumbnails .PHONY: install install-global-pages install-support-files .PHONY: install-system-pages install-dirs .PHONY: clean distclean help # # Omit including thumbnail Makefiles when calling help. # ifneq ($(strip $(filter help,$(MAKECMDGOALS))),help) -include $(ALL_THUMBNAIL_IDX_TARGETS) endif # vim:ts=8:sw=8:noet:ft=make