# -*- mode: makefile; coding: sjis-unix; -*-
# Time-stamp: <2012-08-26 14:02:21 tfuruka1>
#
# cmd-modemakefileł
#
SHELL=/bin/sh
EMACS=/usr/local/emacs/bin/emacs.exe
DVIPDFMX=/usr/local/bin/dvipdfmx.exe

BASENAME=cmd-mode
INFONAME=cmd-mode.info

# ͊SɎlp̊ɈّĂ܂̂ŁAK؂ɏĉB
TARGET=~/.emacs.d/local/lisp/furukawa/$(BASENAME).el
INFOTGT=~/.emacs.d/local/info/$(INFONAME)

OBJ=$(BASENAME).el
GZFILE = $(BASENAME).tar.gz

# ȍ~ɂẮAC͕svƎv܂B
install : $(TARGET) $(INFOTGT) $(BASENAME).pdf

$(TARGET) : $(OBJ)
	rm -f $(TARGET)
	cp $(OBJ) $@

$(INFOTGT) : $(INFONAME)
	cp $(INFONAME) $@

$(INFONAME) : $(BASENAME).texinfo
	$(EMACS) -batch $(BASENAME).texinfo -e texinfo-format-buffer \
	-e basic-save-buffer

$(BASENAME).pdf : $(BASENAME).dvi
	$(DVIPDFMX) $(BASENAME).dvi

$(BASENAME).dvi : $(BASENAME).texinfo
	ptex $(BASENAME).texinfo
	#??  cmd-mode.elqbgĂ܂̂Łc
	texindex $(BASENAME).[!e][!l]
	ptex $(BASENAME).texinfo

clean :
	rm -f *.*~ *.bak
	rm -f makefile~
	rm -f $(BASENAME).aux
	rm -f $(BASENAME).cp
	rm -f $(BASENAME).cps
	rm -f $(BASENAME).dvi
	rm -f $(BASENAME).fn
	rm -f $(BASENAME).fns
	rm -f $(BASENAME).ky
	rm -f $(BASENAME).kys
	rm -f $(BASENAME).log
	rm -f $(BASENAME).pg
	rm -f $(BASENAME).pgs
	rm -f $(BASENAME).ps
	rm -f $(BASENAME).toc
	rm -f $(BASENAME).tp
	rm -f $(BASENAME).tps
	rm -f $(BASENAME).vr
	rm -f $(BASENAME).vrs
	rm -f ../$(GZFILE)
clean-all : clean
	rm -fr *.pdf *.info
tar : clean
	(cd ..; tar cvzf $(GZFILE) $(BASENAME) --exclude .git)
