Source

xemacsweb / Makefile

# -*-Makefile-*-  for Unix and Windows NT.
#
# Adrian Aichner (APA), aichner@ecf.teradyne.com, Teradyne GmbH, 2000-07-29.
# Stephen Turnbull (stephen), stephen@xemacs.org, 2008-02-02
#
# Requires GNU make, available on Windows NT via Cygwin and MSYS.
# (This Makefile uses immediately-expanded assignments in an essential way.)
#
# You *must* provide a Local.rules file, but it can be a no-op.
# Templates are provided in Local.rules.template and Local.rules.windows.
#
# Supported targets:
#
# all:              Builtin default target.  Runs "make validdocs checkconfig".
# everything:       validdocs + namazu-re-index + Download/win32
# validdocs:        Generate all .html files, and validate them
# linklint:         Run linklint on the tree, including remote links.
# namazu-re-index:  Run the namazu indexer on the tree,
# Documentation:    Make HTML documents from XEmacs 21.5 sources.
# Download/win32:   Update Win32 download information,
# checkconfig:	    Check for problems in environment and fix where possible.

################ Override variables in Local.rules. ################
################  No user-serviceable parts below.  ################

.SUFFIXES:			   # Delete the default suffixes
.SUFFIXES: .content .html .el .elc # Define our suffix list
.PHONY: namazu-re-index linklint Documentation Download/win32

#   Include the default configuration.
#   Local.rules.mk includes Local.rules itself, and sanity checks the result.
include Local.rules.mk

# Define collections of files to process.
# The *_FILES variables are computed when accessed.

# These are recursively-expanded, because FIND is defined in Local.rules.
CONTENT_FILES        = $(shell $(FIND) . $(PRUNES) -o -name "*.content" -print)
GENERATED_HTML_FILES = $(CONTENT_FILES:.content=.html)
VALIDATE_HTML_FILES  = $(shell $(FIND) . $(PRUNES) -o -name "*.html" -print) $(GENERATED_HTML_FILES)

# Define directories to prune because we won't find .content files
# or HTML files requiring validation in them.
PRUNE_GENPAGE  := -path ./genpage -prune
PRUNE_LINKLINT := -path "./linklint*" -prune
PRUNE_215_TEXI := -path ./Documentation/21.5/html -prune
PRUNE_PKG_TEXI := -path ./Documentation/packages/html -prune
PRUNES := $(PRUNE_GENPAGE) -o $(PRUNE_LINKLINT)
PRUNES := \( $(PRUNES) -o $(PRUNE_215_TEXI) -o $(PRUNE_PKG_TEXI) \)

# Some prerequisites we use.

GENPAGE_CONF := "genpage.conf"
ELCS         := batch-psgml-validate.elc release-mail-to-html.elc

#   Rules

#   Default target; must come before other targets but after Local.rules.
all: checkconfig validdocs

validdocs: $(ELCS) htdocs $(STAMPS)/validate

everything: checkconfig validate FAQ Documentation Download/win32 namazu-re-index

htdocs: $(STAMPS)/htdocs

namazu-re-index: $(STAMPS)/namazu-re-index

# APA: Run linklint on the local working directory tree, including
# remote link checking (-net).
# Use -output_index site so that all files are reachable in directory
# and not hidden by index.html, which does not reference url*.html
# files.
linklint:
	$(LINKLINT) $(LINKLINT_CASE) -docbase http://www.xemacs.org \
		-net -limit 0 -db3 /@ -doc $(LINKLINT_OUTDIR) \
		$(LINKLINT_IGNORESET) -output_index site -timeout 30

# APA: To be run after initial checkout of module.
# Create directory for commit logs.
# Create compatibility link faq.
# configure and build Texi2html.
# Build the genpage documentation.
checkconfig:
	if test ! -d $(STAMPS); then $(MKDIR) $(STAMPS); fi
	if test ! -d logs; then mkdir logs; fi
	if test ! -d $(LINKLINT_OUTDIR); then mkdir $(LINKLINT_OUTDIR); fi
	if test ! -e faq; then ln -s FAQ faq; fi
	cd genpage; $(MAKE) gp
	cd Texi2html; \
	if test configure -nt Makefile; then bash configure; fi; \
	$(MAKE)
	cd FAQ; $(MAKE)
	@if test -z "${XEMACS_WEBSITE_BASE}"; then \
	  echo Computation of XEMACS_WEBSITE_BASE failed.; \
	  echo You may want to define XEMACS_WEBSITE_BASE in Local.rules.; \
	  exit -10; \
	fi
	make Local.rules

Local.rules: ${XEMACS_WEBSITE_BASE}/Local.rules
.PHONY: Local.rules

${XEMACS_WEBSITE_BASE}/Local.rules: ${XEMACS_WEBSITE_BASE}/Local.rules.template
	$(error Your "$(notdir $@)" is out-of-date or non-existent.)

# APA: When contentdir and outputdir are the same then, and only then,
# genpage depends only on content files.  Copying of all other files
# (from contentdir to outputdir) is not necessary in this case.
# See $(GENPAGE_CONF).
$(STAMPS)/htdocs: $(CONTENT_FILES) \
	template.html \
	template-de.html \
	template-ja.html \
	Releases/core-stable.txt \
	Releases/core-beta.txt \
	Releases/packages-official.txt \
	Releases/packages-pre-release.txt \
	Download/win32/netinstall-win32.txt \
	Download/win32/innosetup-win32.txt \
	Download/win32/installshield-win32.txt
	perl ./genpage/bin/genpage -p $(GENPAGE_CONF) -o "."
	touch $(STAMPS)/htdocs

# APA: Validate only files younger than time-stamp file created by
# previous validation
# See batch-psgml-validate.el for details, in particular ...
# (defun batch-psgml-validate (&optional file-or-dir)
# (defun batch-psgml-validate-file (file &optional insert-result indent)
# (defun batch-psgml-validate-buffer (&optional insert-result indent)

# stephen: $(VALIDATE_HTML_FILES) *must* be evaluated when Make creates
# its dependency graph, so that will happen before htdocs is made in the
# toplevel make.  So we use a recursive make to ensure that htdocs has
# already made all the needed HTML by the time the arguments to
# batch-psgml-validate are computed.
# The conditional is to avoid doing the find in the toplevel make.
# APA: Must touch $(STAMPS)/htdocs as well since validation updates
# dependencies of $(STAMPS)/htdocs
$(STAMPS)/validate: $(VALIDATE_HTML_FILES)
	rm -f VALIDATE_HTML_FILES.txt
	touch VALIDATE_HTML_FILES.txt
	for i in $?; do \
		echo $$i >> VALIDATE_HTML_FILES.txt; \
	done
	cat VALIDATE_HTML_FILES.txt | xargs $(XEMACS) $(FLAGS) \
		-l ./batch-psgml-validate.elc -f batch-psgml-validate
	touch $(STAMPS)/validate

# APA: Touch index.html for index template files to be re-generated.
# www.xemacs.org has a patched mknmz that will update index files,
# unless they are newer than the associated template.
# APA: Must touch $(STAMPS)/... as well since indexing updates
# dependencies of $(STAMPS)/...
$(STAMPS)/namazu-re-index: $(VALIDATE_HTML_FILES)
	touch index.html
	if test -n "$(NAMAZU_INDEX_DIR)" -a -d "$(NAMAZU_INDEX_DIR)"; then \
		$(MKNMZ) --output-dir=$(NAMAZU_INDEX_DIR) . ; \
	fi;
	touch $(STAMPS)/namazu-re-index

# APA: Need to remove timestamp files as well!
clean:
	$(FIND) . \( -name "*.content" -o -name "*~" \) -print | perl -ne "{ chomp; s/\.content/.html/; unlink; }"
	rm -f $(STAMPS)/htdocs
	rm -f $(STAMPS)/validate

Documentation:
	cd $@ && $(MAKE) TEXI2HTML="$(TEXI2HTML)" all

FAQ:
	cd $@ && $(MAKE) TEXI2HTML="$(TEXI2HTML)" all

Download/win32:
	cd $@ && $(MAKE)

%.elc: %.el
	$(XEMACS) $(FLAGS) -f batch-byte-compile $<

# End of xemacsweb Makefile
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.