Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
# Makefile for http://angg.twu.net/, 2004dec01.

# (find-es "tourism")

# See: http://angg.twu.net/e/tourism.html

# This file is full of GNUmake-isms and if you're running BSD you need
# to use gmake on it instead of the default (p?)make; also you may
# have to pass a parameter like "TCLSH=tclsh8.2" (or other version)
# because the default tclsh there may be a boring script that tells
# you to invoke tclsh with an explicit version number.

# (find-es "make" "shell_functions")
# (find-es "escripts" "copy_of_edrxs_page")
# (find-fline "/freebsd/usr/local/bin/tclsh")

# (find-fline "Generate")
# (find-fline "Htmllib.tcl")
# (find-fline "Files.tcl")

# (find-es "make" "page")
# (find-node "(make)Conditional Example")
# (find-node "(make)Conditional Syntax")

# (find-es "make" "environment")
# (find-es "page" "test_unpacking")
# (find-es "page" "upload_changes")
# (find-angg ".zshrc" "minimakepage")
# (find-node "(make)Conditional Example")
# (find-node "(make)Conditional Syntax" "`ifdef VARIABLE-NAME'")
# (find-node "(bash)Bourne Shell Builtins" "`test'")
# (find-node "(bash)Conditional Constructs" "`if'")
# (find-node "(make)Call Function")
# (find-es "make" "call_function")
# (find-node "(make)Conditional Syntax" "To test for an empty value")
# (find-es "escripts" "home_from_pagetgz")

# «.Makefile.auto»	(to "Makefile.auto")
# «.NOTCL»		(to "NOTCL")


TCLSH		?= tclsh
CP		?= cp -av
#CP		?= function CP () { cp -av $$1 $$2 && touch $$2; }; CP

ifeq ($(COPYING),1)
 # As "THDIR ?= $(HOME)/TH" doesn't work in GNU make 3.77,
 ifeq ($(THDIR),)
  THDIR		= $(HOME)/TH
 endif
else
 THDIR		?= TH
endif

GENERATE	= $(TCLSH) $(THDIR)/Generate
FILESTCL	= $(THDIR)/Files.tcl
MAKEFILE	= $(THDIR)/Makefile
MAKEFILEAUTO	= TH/Makefile.auto
TGZ		?= edrx.tgz
HOMETGZ		?= $(HOME)/edrx.tgz      # beware: needs to be an absolute path
ES		?= e

# BLOGME	= lua50 $(THDIR)/blogme.lua
# BLOGME	= lua50 blogme/blogme.lua
BLOGME		= lua50 blogme/blogme2.lua
BLOGME3		= lua51 blogme3/blogme3.lua



default: page

page: dirs copies htmls
fullpage: page $(TGZ)



# (find-angg "TH/Files.tcl")
# (progn (text-mode) (setq fill-prefix "\tmkdir -p "))
# (progn (normal-mode) (setq fill-prefix nil))

dirs:
	mkdir -p .a2ps .eev .fvwm .lua50 .lua51 .ruby 4NT BUSYBOX C
	mkdir -p CRIM1 CV DANIEL DAVINCI EDRXPAGE EEG EEV/debian ETC
	mkdir -p EXPECT FISL FundComp HOWM HOWM4 ICON IMAGES LATEX
	mkdir -p LFORTH LILYPOND LINUX LUA/loadlib LUA/ldb MARCOS MTA
	mkdir -p OMNISYS PFORTH PHP PLURALL PYTHON SQL SWIG TCL
	mkdir -p TEXINFO TH WebWiki Wiki bin blogme blogme3 crim
	mkdir -p dednat dednat4 dednat4/downloads dednat4/examples
	mkdir -p diaglib dnc dynkin e elisp eev/debian eev/demo eev/e
	mkdir -p eev/libeeg eev/rcfiles eev/texts eev-current/anim
	mkdir -p eev-current/article eev-current/doc
	mkdir -p eev-current/examples eev-current/rcfiles
	mkdir -p eev-current/rcfiles/tmp eev-current/slides/
	mkdir -p eev-current/tmp flua lua-4.0/debian lua-4.0/doc
	mkdir -p lua-4.0/include lua-4.0/src/lua lua-4.0/src/libdllua
	mkdir -p miniforth miniforth/crim mktclapp-3.9/debian
	mkdir -p mktclapp-3.9/examples replace rubyforth/demos
	mkdir -p rubyforth/tools sisrot usrc/rcirc vtutil vtutil4
	mkdir -p windows-emacs



# «Makefile.auto»  (to ".Makefile.auto")
# (find-angg "TH/Files.tcl" "makefile_template")
# (find-angg "TH/Files.tcl" "makeautomakefile")
# The difficult part: we may have to regenerate Makefile.auto (from
# the files in ~/TH/ if COPYING=1) before attempting to make any of
# the targets "copies", "htmls" or "$(TGZ)". The trick is that we
# first remake Makefile.auto and then call "make" a second time; only
# in that second time it will include the Makefile.auto, that will
# then be up-to-date.

MAKE2 = $(MAKE) -f $(THDIR)/Makefile NEEDMAKEFILEAUTO=1

ifeq ($(NEEDMAKEFILEAUTO),1)
include $(MAKEFILEAUTO)
LOADEDMAKEFILEAUTO = 1
endif

# «NOTCL»  (to ".NOTCL")
# (find-es "page" "NOTCL")
# 2008jun17 (for angg):
# NOTCL = 1
# 2008jan18:
ifeq ($(NOTCL),1)
TH_HTMLS :=
endif

ifeq ($(LOADEDMAKEFILEAUTO),1)
  copies: $(COPIES)
  htmls: $(COPIES) $(TH_HTMLS) $(A_HTMLS) $(E_HTMLS)
  $(TGZ): $(TGZFILES)
	# Running tar -czf $(TGZ) $$(TGZFILES) ...
	@tar -czf $(TGZ) $(TGZFILES)
	pwd; ls -lAF $(TGZ)
  $(HOMETGZ): $(TGZFILES)
	# Running cd; tar -czf $(TGZ0) $$(TGZFILES) ...
	@cd; tar -czf $(HOMETGZ) $(TGZFILES)
	pwd; ls -lAF $(HOMETGZ)
else
  FORCE:
  copies: $(MAKEFILEAUTO) FORCE
	$(MAKE2) copies
  htmls: $(MAKEFILEAUTO) FORCE
	$(MAKE2) htmls
  $(TGZ): $(MAKEFILEAUTO) FORCE
	$(MAKE2) $(TGZ)
  $(HOMETGZ): $(MAKEFILEAUTO) FORCE
	$(MAKE2) $(HOMETGZ)
endif

# 2007may06: commented out the old TH-based make-thing,
# and replaced it by something that is blogme3-based
# (but the "~/blogme3/blogme3.lua" is kind of dirty...)
#
#$(MAKEFILEAUTO): $(FILESTCL)
#	$(GENERATE) $(MAKEFILEAUTO) $(FILESTCL) "makeautomakefile "
#
#$(MAKEFILEAUTO): $(FILESTCL) $(HOME)/blogme3/anggmake.lua
$(MAKEFILEAUTO): $(HOME)/blogme3/anggmake.lua
	lua51 ~/blogme3/blogme3.lua -e 'require"anggmake"' > $@ 



ifeq ($(DEST),)
homedir:
	# You need to set DEST to be able to do a "make homedir".
	# Example:
	#	make DEST=/home/edrx homedir
	false
else
homedir: $(TGZ)
	mkdir -p $(DEST)
	tar -xvzf $(TGZ) -C $(DEST)
	# Now you should be able to log in your copy of edrx's home with:
	#
	#   HOME=$(DEST) zsh
	#
	# It is a good idea to set an alias for that in your ~/.bashrc
	# or ~/.zshrc; the syntax is:
	#
	#   alias edrxlog='HOME=$(DEST) zsh'
endif



#  Local Variables:
#  coding:               raw-text-unix
#  ee-anchor-format:     "«%s»"
#  ee-charset-indicator: "Ñ"
#  End: