# Makefile for compiling SKK 9.6 and Emacs 19
# Mikio Nakajima <gy2m-nkjm@asahi-net.or.jp> created on May 27, 1996.
# Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp> modified on Dec 19, 1996.
#
SHELL = /bin/sh
@SET_MAKE@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

CC = @CC@
CFLAGS = @CFLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libexecdir = @libexecdir@
datadir = @datadir@
infodir = @infodir@

EMACS = @EMACS@
TEXI2DVI = texi2dvi
ELISPDIR = $(datadir)/emacs/site-lisp
SKKDIR = $(datadir)/skk

## SKK JISYO which skkserv uses
JISYO = @JISYO@
JISYODIR = $(datadir)/skk

SUBDIRS = lisp skkserv jisyo-tools doc etc

MDEFINES = CC='$(CC)' CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS)' \
	EMACS='$(EMACS)' JISYO='$(JISYO)' JISYODIR='$(JISYODIR)' \
	ELISPDIR='$(ELISPDIR)' SKKDIR='$(SKKDIR)' TEXI2DVI='$(TEXI2DVI)'

all: config.h
	for subdir in $(SUBDIRS); do \
	  echo making $@ in $$subdir; \
	  (cd $$subdir && $(MAKE) $(MDEFINES) $@) || exit 1; \
	done

install: config.h
	for subdir in $(SUBDIRS); do \
	  echo making $@ in $$subdir; \
	  (cd $$subdir && $(MAKE) $(MDEFINES) $@) || exit 1; \
	done
	$(INSTALL_DATA) jisyo/$(JISYO) $(JISYODIR)/$(JISYO)

clean:
	cd lisp; $(MAKE) clean
	cd skkserv; $(MAKE) clean
	cd jisyo-tools; $(MAKE) clean

distclean: clean
	rm -f etc/Makefile doc/Makefile skkserv/Makefile jisyo-tools/Makefile
	rm -f config.cache config.log config.status config.h Makefile

TAGS: $(SRCS)
	cd lisp; $(MAKE) TAGS
	cd skkserv; $(MAKE) TAGS
	cd jisyo-tools; $(MAKE) TAGS

.PHONY: clean
# Makefile ends here.
