PACKAGE=heblatex
VERSION=2.3f
SOURCES=hebrew.ins hebrew.fdd hebrew.dtx hebinp.dtx heb209.dtx
INSTALL_FILE=hebrew.ins
FILES_TO_COPY=*.sty *.def *.fd *.ldf 
CLEAN=$(FILES_TO_COPY) $(DOC_FILES) *.log *~ *.dvi *.aux *.toc *.glo \
      *.idx *.gls *.ilg

DTX_FILES=hebrew
DOC_FILES=$(DTX_FILES:%=%.ps)
# hebrew.ins creates many files. I choose hebtech, which is the last of them,
# to represent them all. This is not very robust...
# this is the last file created in hebrew.ins
SAMPLE_TARGET=hebrew_oldcode.sty
TARGETS=$(SAMPLE_TARGET) doc

# for the packaging:
PACKAGE_FILES_LIST = BUGS.txt Makefile README.1st README.txt README.html\
heb209.dtx hebinp.dtx hebrew.dtx hebrew.fdd hebrew.ins hebtech.dtx
TAR_BALL_DIR=$(PACKAGE)-$(VERSION)
TAR_BALL=$(TAR_BALL_DIR).tar.gz

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

doc: $(DOC_FILES)

# the nodo 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)

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

do_install: $(SAMPLE_TARGET) $(DOC_FILES)
	$(MKDIR) -p $(HEBREW_TARGET_DIR)
	$(CP) $(FILES_TO_COPY) $(HEBREW_TARGET_DIR)
	$(MKDIR) -p $(HEBREW_TARGET_DOC_DIR)
	$(CP) $(DOC_FILES) $(HEBREW_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)

