# Generated automatically from Makefile.in by configure.
# ------------------------------------------------------------------------
#       Makefile for demonstation shell with extension loader
# ------------------------------------------------------------------------

# ------------------------------------------------------------------------
#       C Compiler options 
# ------------------------------------------------------------------------

LDFLAGS      = 
DEFINES      = 
CDEBUGFLAGS  = -O -fwritable-strings 
CC 	     = gcc

TOPDIR	     = /home2/j-env
BINDIR       = /home2/j-env/bin

# ------------------------------------------------------------------------
#       Include directives for Tcl, Tk, and X include files 
# ------------------------------------------------------------------------

TCL_INCLUDE   = -I/home2/j-env/include
TK_INCLUDE    = -I/home2/j-env/include
X_INCLUDE     = 

# ------------------------------------------------------------------------
#       Libraries directives for Tcl, Tk, and X11
# ------------------------------------------------------------------------

X_LIB        =  -lX11
TK_LIB       = -L/home2/j-env/tcl-jp/tk3.6jp -ltk
TCL_LIB      = -L/home2/j-env/lib -ltcl
EXTRA_LIBS   =  -lnsl -lm -ldl

# ------------------------------------------------------------------------
#       Don't edit anything beyond this point
# ------------------------------------------------------------------------

OBJS	     = han_init.o H_roma2han.o kcode.o
SOBJS		 = han_init.so H_roma2han.so kcode.so

program      = wish 
INCLUDES     = -I. $(TK_INCLUDE) $(TCL_INCLUDE) $(X_INCLUDE)
CFLAGS 	     = $(CDEBUGFLAGS) $(DEFINES) $(INCLUDES)
LIBRARIES    = $(TK_LIB) $(TCL_LIB) $(X_LIB) $(EXTRA_LIBS)
INSTALL      = /usr/bin/install -c
RANLIB 	     = @RANLIB@
SHELL 	     = /bin/sh
RM 	     = rm -f
MAN_SECT     = n
TOPDIR       = /home2/j-env
MANDIR       = /home2/j-env/man
SECT_DIR     = $(MANDIR)/man$(MAN_SECT)
srcdir	     = .

all: libhinput.a libhinput.so.1.0 $(program) 

$(program): libhinput.a tkAppInit.o
	$(CC) $(LDFLAGS) $(CFLAGS) -L. -lhinput tkAppInit.o -o $(program) $(LIBRARIES)
	@echo "make finished on `date`"

libhinput.a:	$(OBJS)
	rm -f libhinput.a
	ar cr libhinput.a $(OBJS)
	ranlib libhinput.a

libhinput.so.1.0:	$(SOBJS)
	rm -f libhinput.so.1.0
	ld -assert pure-text -o libhinput.so.1.0 $(SOBJS)

tkAppInit.o:	tkAppInit.c
	$(CC) -c $(CFALGS) tkAppInit.c

han_init.o:	han_init.c H_roma2han.h H_index.h H_define.h
	$(CC) -c $(CFALGS) han_init.c

H_roma2han.o:	H_roma2han.c H_roma2han.h H_index.h H_define.h
	$(CC) -c $(CFALGS) H_roma2han.c

kcode.o:	kcode.c
	$(CC) -c $(CFALGS) kcode.c

han_init.so:	han_init.c H_roma2han.h H_index.h H_define.h
	$(CC) -c $(CFALGS) -fpic han_init.c
	mv han_init.o han_init.so

H_roma2han.so:	H_roma2han.c H_roma2han.h H_index.h H_define.h
	$(CC) -c $(CFALGS) -fpic H_roma2han.c
	mv H_roma2han.o H_roma2han.so

kcode.so:	kcode.c
	$(CC) -c $(CFALGS) -fpic kcode.c
	mv kcode.o kcode.so

install: install-dirs $(program) install-man
	chmod 0755 $(program)
	$(INSTALL) $(program) $(BINDIR)
	$(INSTALL) libhinput.so.1.0 $(TOPDIR)/lib/libhinput.so.1.0
	$(INSTALL) hentry.tcl $(TOPDIR)/lib/hinput/hentry.tcl
	$(INSTALL) htext.tcl $(TOPDIR)/lib/hinput/htext.tcl
	

install-man: install-dirs
	@for i in $(srcdir)/*.man ; do \
	    file=$(SECT_DIR)/`basename $$i .man`.$(MAN_SECT) ; \
	    echo "installing manual $$file" ; \
	    rm -f $$file ; \
	    sed -e "/man\.macros/r $(srcdir)/man.macros" -e '/man\.macros/d' \
		$$i > $$file ; \
	    chmod 444 $$file; \
	done 

install-dirs:
	@for i in $(TOPDIR) $(TOPDIR)/lib/hinput $(BINDIR) $(MANDIR) $(SECT_DIR) ; do \
	    if test ! -d $$i ; then \
		mkdir $$i ; \
	    fi ; \
        done

clean:
	$(RM) $(program) $(OBJS) $(SOBJS) tkAppInit.o *\~ "#"*

GENERATED_FILES = config.status Makefile 

distclean: clean
	$(RM) $(GENERATED_FILES)
