PACKAGE=hebclass
VERSION=0.2
SOURCES=hebclass.ins hebtech.dtx 
INSTALL_FILE=hebclass.ins
FILES_TO_COPY=*.cls tcourse.sty
CLEAN=hebtech.cls hebthes.tex $(DOC_FILES) *.log *~ *.dvi *.aux *.toc \
      i*.glo *.idx *.gls *.ilg

TEX_SRC=iitcsw iitsmnr tcourse hebthes
DTX_FILES=hebtech
DOC_FILES=$(DTX_FILES:%=%.ps) 
SAMPLE_TARGET=hebtech.cls
TARGETS=$(SAMPLE_TARGET) doc

# for the packaging:
PACKAGE_FILES_LIST = $(SOURCES) iitcsw.cls iitcsw-course.sty \
  iitcsw-samplefig.eepic iitsmnr.cls Makefile README tcourse.sty \
  $(TEX_FILES:%=%.tex)
TAR_BALL_DIR=$(PACKAGE)-$(VERSION)
TAR_BALL=$(TAR_BALL_DIR).tar.gz

ROOT_DIR=../..
include $(ROOT_DIR)/ivritex.mk

doc: $(DOC_FILES)

# the nodoc target is useful if you wish to just re-create the class files from
# the sources and not waste time on typesetting the documentation
nodoc: $(SAMPLE_TARGET)

hebtech.cls hebthes.tex: hebtech.dtx

$(SAMPLE_TARGET): $(SOURCES)
	# Clean everything, otherwise latex will stop to ask questions
	$(RM) $(CLEAN)
	$(LATEX) $(INSTALL_FILE)

do_install: $(SAMPLE_TARGET) $(DOC_FILES)
	$(MKDIR) -p $(HEBCLASS_TARGET_DIR)
	$(CP) $(FILES_TO_COPY) $(HEBCLASS_TARGET_DIR)
	$(MKDIR) -p $(HEBCLASS_TARGET_DOC_DIR)
	$(CP) $(DOC_FILES) $(HEBCLASS_TARGET_DOC_DIR)

pack: $(TAR_BALL)

$(TAR_BALL): $(PACKAGE_FILES_LIST)
	if [ -e $(TAR_BALL_DIR) ] ; then \
	  $(RM) -rf $(TAR_BALL_DIR);     \
	fi
	$(MKDIR) $(TAR_BALL_DIR)
	$(CP) $(PACKAGE_FILES_LIST) $(TAR_BALL_DIR)
	$(TAR) cvzf $(TAR_BALL) $(TAR_BALL_DIR)

