# FILE. . . . . /home/hak/hlt/src/hlt/osfv2/Makefile
# EDIT BY . . . Hassan Ait-Kaci
# ON MACHINE. . Hak-Laptop
# STARTED ON. . Mon Sep 02 09:09:16 2013

# Last modified on Thu Mar 26 11:35:08 2015 by hak

########################################################################

HOME		= C:/cygwin/home/hak
HLT_HOME	= ${WIN_HOME}/hlt

HLT_CLASSES	= ${HLT_HOME}/classes
JDOM_CLASSES	= ${HLT_CLASSES}/jdom.jar

CLASSPATH	= ${HLT_CLASSES}#;${JDOM_CLASSES}

RESOURCES	= ${HLT_CLASSES}/resources

SOURCEROOT	= $(HLT_HOME)/src
SOURCES		= util/*.java exec/*.java base/*.java io/*.java 
#TEST		= 

DOCDIR		= ./doc
#IMAGES		= ${DOCDIR}/images
APIDIR		= $(HLT_HOME)/doc/hlt/api
OPTIONS		= -windowtitle "API documentation of hlt.osf packages" \
                  -author -version -public $(TAGS) \
                  -header "Author: <a href=\"http://www.hassan-ait-kaci.net\">Hassan A&iuml;t-Kaci</a>" \
                  -footer "Contact: <a href=\"mailto:hak@acm.org?subject=hlt.osf\">hak@acm.org</a>"
SYSTEM		= hlt.osf
PACKAGES	= $(SYSTEM).util\
		  $(SYSTEM).base\
		  $(SYSTEM).io\
		  $(SYSTEM).exec
HUSH		= > /dev/null #2> /dev/null

TRASH	= */,* */,.* */*~ */@*@ */.*~

JC		= @javac -classpath "$(CLASSPATH)" -O -d "$(HLT_CLASSES)" -Xlint:deprecation #-Xlint:unchecked

# Because eclipse is not aware what's defined in ~/.profile and ~/.cshrc
# all these commands must be preceded by ${BIN} if this makefile is to be used by eclipse; e.g.,
# SAY	= @${BIN}/echo "***"
# where:
# BIN		= C:/cygwin/bin		# 

MK	= @\make
ND	= @\mkdir -p
CP	= @\cp -f
CD	= @\cd
LS	= @\ls
MV	= @\mv -f
RM	= @\rm -rf

SAY	= @echo "***"

HL_OPS	= -! -c "${RESOURCES}/Hilite.Configuration"
HL	= @java -classpath "$(HLT_CLASSES)" hlt.language.tools.HiliteCommand \
	  -css $(HLT_CLASSES)/resources/Hilite.Style.css \
	  -con $(HLT_CLASSES)/resources/Hilite.Configuration.Jacc -s /

########################################################################

help:
	${SAY}
	${SAY} "This makefile manages the hlt.osf.* packages."
	${SAY} "You can 'make ...' where '...' is one of:"
	${SAY}
	${SAY} "    all:      same as 'classes doc api'"
	${SAY} "    classes:  compiles the hlt.osf.* java source files"
	${SAY} "    doc:      generates the hlt.osf.* source files documentation"
	${SAY} "    api:      generates  hlt.osf.* API javadoc documentation"
	${SAY} "    save:     saves the contents of this directory ($(shell pwd))"
	${SAY} "    tidy:     erases regeneratable files"
	${SAY} "    help:     prints this message"
	${SAY}

########################################################################

all:	classes doc api

########################################################################

classes: tidy
	${SAY} Removing existing hlt.osf.* class files
	${RM} ${HLT_CLASSES}/hlt/osf/*/*.class
	${SAY} Compiling hlt.osf.* package sources
	${JC} ${SOURCES}

########################################################################

api: tidy
	@make -C $(HLT_HOME)/src all	# This regenerates all the hlt.* API doc
#	$(SAY) Generating Javadoc API documentation for hlt.osf packages
#	@javadoc -J-Xmx128m -classpath "$(CLASSPATH)" -sourcepath "$(SOURCEROOT)"\
#		 -d "$(APIDIR)" $(OPTIONS) $(PACKAGES) # $(HUSH)
#	$(SAY) Wrote javadoc root file $(APIDIR)/index.html

########################################################################

doc: tidy
	${SAY} Removing old ${DOCDIR} documentation
	${RM} ${DOCDIR}/*.*
	${SAY} Generating HTML docs for osf hlt.osf source files
	${HL} -d ${DOCDIR} ${SOURCES}
	${MV} ${DOCDIR}/index.html ${DOCDIR}/000StartHere.html
	${SAY} See hilited HTML source code in ${DOCDIR}/000StartHere.html

########################################################################

save: tidy
	${SAY} Saving the contents of the current directories
	@tar cvf osf.tar * ${HUSH}
	@gzip osf.tar
	${MV} osf.tar.gz save/
	${SAY} Wrote save/osf.tar.gz

########################################################################

tidy:
	${SAY} "Tidying up trash"
	${RM} ${TRASH}

########################################################################