prefix = @prefix@
prgdir = @prefix@@PRGDIR@
imdir = @prefix@@IMDIR@
CC = gcc


CFLAGS =  -Wall -g -DFOR_PILOT_COMPAT -O2 -fno-strength-reduce 

INC = -I../include -I./IMdkit/include -I/usr/include @CHINPUT_CFLAGS@ 

LIB = @CHINPUT_LIBS@ ./IMdkit/lib/libXimd.a -L../unicon/client -L../unicon/server -limmclient -Wl,-rpath=$(imdir) -limm_server -ldl

SRC = chinput.c \
	  init.c \
	  server.c \
	  config.c \
	  color.c \
	  util.c \
	  convert.c \
	  ic.c \
	  xim.c \
	  focus.c \
	  root.c \
	  overspot.c \
	  onspot.c \
	  offspot.c \
	  keyboard.c \
	  loop.c \
	  enc.c \
	  dock_net.c \
	  docking.c

OBJ = $(SRC:.c=.o)

all: chinput

chinput: IMdkit/lib/libXimd.a $(OBJ) 
	g++ -o chinput $(OBJ) $(LIB) 

.c.o:
	$(CC) -c $(CFLAGS) $(INC) $<

IMdkit/lib/libXimd.a:
	cd IMdkit; make

install:
	cp -f chinput $(prefix)/bin

clean:
	cd IMdkit; make clean
	rm -f chinput *.o *.bak

distclean: clean
	rm -f Makefile config.h tips.h

