###
### Makefile for byte-compile
###                            (DO NOT EDIT THIS FILE)
###
### Author:  Kiyoka Nishiyama <kiyoka@netfort.gr.jp>
### Created: 11,Sep,2001
### Revised: 11,Feb,2002

srcdir   = @srcdir@
VPATH    = @srcdir@
prefix   = @prefix@
infodir  = @infodir@
EMACS    = @EMACS@
elispdir = @lispdir@/oneliner

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

OBJS =	oneliner.elc
SRCS =	oneliner.el
TEMPFILE = temp.el

DIST_COMMON    = oneliner.el TODO TODO.ja COPYING CREDITS CHANGELOG \
                 Makefile.in README.Meadow README README.ja\
                 configure.in install-sh config.sub config.guess aclocal.m4
DIST_INFO      = info/oneliner.texi info/install-info.wrapper info/Makefile.in
DIST_SCRIPTS   = scripts/el scripts/Makefile.in
DIST_DOC       = doc/readme.sdoc

CP = @CP@
RM = @RM@ -f
MV = @MV@
TAR = @TAR@
MKDIR = @MKDIR@ -p
RMDIR = @RMDIR@
SDOC = @SDOC@
# To save Emacses on Windows
PWD =
VER = @ONELINER_VER@

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

all: $(OBJS) info-en info-ja make-scripts
doc: doc-en doc-ja
install: install-el install-info-en install-info-ja install-scripts
uninstall: uninstall-elc uninstall-info-en uninstall-info-ja uninstall-scripts

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

$(OBJS): $(TEMPFILE) oneliner.el
	@echo 'Compiling EL files of Oneliner ... '
	@echo 'PLEASE IGNORE WARNINGS IF DISPLAYED. TAKE IT EASY!'
	$(EMACS) -batch -q -no-site-file -l ./$(TEMPFILE) -f oneliner-compile
	@echo 'Compiling EL files of Oneliner ... done'

$(TEMPFILE):
	@echo '(setq load-path (cons "." load-path))' > $(TEMPFILE)
	@echo '(defun oneliner-compile () (mapcar (function (lambda (x) (byte-compile-file x))) (list ' >> $(TEMPFILE)
	@echo $(OBJS) | sed -e 's/\(oneliner[^ ]*\.el\)c/"\1"/g'  >> $(TEMPFILE)
	@echo ')))' >> $(TEMPFILE)

install-el: $(OBJS)
	-@if [ ! -d $(elispdir) ]; then \
		$(MKDIR) $(elispdir); \
	fi
	$(CP) $(SRCS) $(elispdir)
	$(CP) $(OBJS) $(elispdir)

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


info-en:
	cd info; $(MAKE) info-en EMACS=$(EMACS)

install-info-en:
	cd info; $(MAKE) install-info-en infodir=$(infodir)

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


info-ja:
	cd info; $(MAKE) info-ja EMACS=$(EMACS) prefix=$(prefix)

install-info-ja:
	cd info; $(MAKE) install-info-ja infodir=$(infodir) prefix=$(prefix)

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

make-scripts:
	cd scripts; $(MAKE) all

install-scripts:
	cd scripts; $(MAKE) install

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

doc-en:
	cd doc; \
	$(SDOC) -masterLocale:en -locale:en -format:plain readme.sdoc; \
	$(MV) readme.txt ../README; \
	cd ..

doc-ja:
	cd doc; \
	$(SDOC) -locale:ja -format:plain readme.sdoc; \
	$(MV) readme_ja.txt ../README.ja; \
	cd ..


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

clean:
	$(RM) $(OBJS) $(TEMPFILE)
	cd info; $(MAKE) clean
	cd scripts; $(MAKE) clean

distclean: clean
	$(RM) Makefile scripts/Makefile info/Makefile
	$(RM) config.status config.log

realclean: distclean
	$(RM) README README.ja

################################################################
uninstall-elc:
	$(RM)    $(elispdir)/*
	$(RMDIR) $(elispdir)

uninstall-info-en:
	cd info; $(MAKE) uninstall-info-en infodir=$(infodir)	

uninstall-info-ja:
	cd info; $(MAKE) uninstall-info-ja infodir=$(infodir)	

uninstall-scripts:
	cd scripts; $(MAKE) uninstall

################################################################
distdir: doc
	$(MKDIR) oneliner-$(VER)/{doc,scripts,info}
	$(CP) $(DIST_COMMON) oneliner-$(VER)
	$(CP) $(DIST_SCRIPTS) oneliner-$(VER)/scripts
	$(CP) $(DIST_INFO) oneliner-$(VER)/info
	$(CP) $(DIST_DOC) oneliner-$(VER)/doc


#
# !! You must exec "make setup -f Makefile.in" before "make archive".
#
archive: distdir
	cd oneliner-$(VER) ; autoconf
	/bin/rm -rf oneliner-$(VER)/*.cache
	$(TAR) zcf oneliner-$(VER).tar.gz oneliner-$(VER)

setup:
	/bin/rm -rf *.cache
	aclocal
	autoconf
	configure
##
## End of Makefile
##
