#
# Makefile rules for multi HTMLs and a single text
#
COMPILE=yes
SRC_EXPR =
IMAGE_EXPR = -o -name '*.gif' \
-o -name '*.png' \
-o -name '*.jpg' \
-o -name '*.jpeg' \
-o -name '*.tif' \
-o -name '*.tiff'\
-o -name '*.css'
ifeq ($(origin BASENAME), undefined)
BASENAME := $(notdir $(CURDIR))
endif
#
# condition check
#
ifeq ($(RESTRICT_COMMERCIAL), yes)
ifeq ($(RESTRICT-DIST), yes)
COMPILE=no
endif
endif
#
# default target by condition.
#
ifeq ($(COMPILE), yes)
all: index.html $(BASENAME).txt
install: install-work \
install-www \
install-ftp \
install-ldp-mirror
else
all:
@echo Skip compilation.
install:
@echo Skip installation.
endif
#
# rules
#
index.html:
@echo HTMLs are supplied from upstream
$(BASENAME).txt:
@echo text is supplied from upstream
$(BASENAME).tar.gz: index.html
find . -name '*.html' $(IMAGE_EXPR) \
| tar cvfz $@ --files-from=-
#
# Create JF archives
#
#
# single html file with images, multiple html files,
# multiple html files with images
#
install-work: \
$(WORK_TEXT)/$(BASENAME).txt \
$(WORK_HTML)/$(BASENAME)/index.html
$(WORK_TEXT)/$(BASENAME).txt: $(BASENAME).txt
mkdir -p $(@D)
$(INSTALL) $< $@
touch $(LAST_MODIFIED)
$(WORK_HTML)/$(BASENAME)/index.html: index.html
mkdir -p $(WORK_HTML)
mkdir -p $(@D)
tar cf - `find . -name '*.html' $(IMAGE_EXPR)` \
| ( cd $(@D); tar xpf -)
#
# Install WWW contents
#
ifneq ($(INSTALL_WWW), yes)
install-www:
else
install-www: \
$(DEST_WWW_TEXT)/$(BASENAME).txt \
$(DEST_WWW_HTML)/$(BASENAME)/index.html
$(DEST_WWW_TEXT)/$(BASENAME).txt: $(BASENAME).txt
mkdir -p $(@D)
$(INSTALL) $< $@
$(DEST_WWW_HTML)/$(BASENAME)/index.html: index.html
mkdir -p $(DEST_WWW_HTML)
mkdir -p $(@D)
tar cf - `find . -name '*.html' $(IMAGE_EXPR)` \
| ( cd $(@D); tar xpf -)
if [ -r dot.htaccess ]; then \
$(INSTALL) dot.htaccess $(@D)/.htaccess ; \
fi
endif
#
# Install FTP contents
#
ifneq ($(INSTALL_FTP), yes)
install-ftp:
else
install-ftp: \
$(DEST_FTP_TEXT)/$(BASENAME).gz \
$(DEST_FTP_HTML)/$(BASENAME).tar.gz
$(DEST_FTP_TEXT)/$(BASENAME).gz: $(BASENAME).txt
mkdir -p $(@D)
$(INSTALL) $< $(@:.gz=)
rm -f $@
gzip $(@:.gz=)
$(DEST_FTP_HTML)/$(BASENAME).tar.gz: $(BASENAME).tar.gz
mkdir -p $(@D)
$(INSTALL) $< $@
endif
#
# Install LDP translations for mirror
#
ifneq ($(INSTALL_LDP), yes)
install-ldp-mirror:
else
ifneq ($(KIND), LDP-TRANS)
install-ldp-mirror:
@echo Non-LDP document. Skipped.
else
install-ldp-mirror: \
$(DEST_LDP_TEXT)/$(BASENAME).gz \
$(DEST_LDP_HTML)/$(BASENAME).tar.gz
$(DEST_LDP_TEXT)/$(BASENAME).gz: $(BASENAME).txt
mkdir -p $(@D)
$(INSTALL) $< $(@:.gz=)
rm -f $@
gzip $(@:.gz=)
$(DEST_LDP_HTML)/$(BASENAME).tar.gz: $(BASENAME).tar.gz
mkdir -p $(@D)
$(INSTALL) $< $@
endif
endif
#
clean:
rm -f $(BASENAME).tar.gz