#
# Makefile for xa+cv-0.5
# By Yuan-Chung Cheng <platin@ms31.hinet.net>
# 
# * Sat Apr 17 1999 Yuan-Chung Cheng <platin@ms31.hinet.net>
# - frist build this file.
#

CC = gcc
CFLAGS = -fPIC -O2
SHAREFLAGES = -shared
SHARELIBS = -ldl
INSTALL = /usr/bin/install -c

DESTDIR = /usr/locale/lib
CONGDIR = /etc/chinese/xa+cv
INCLUDEDIR = -I/usr/include -I/usr/X11R6/include

all: wrap.so

%.o : %.c
	$(CC) -c $(CFLAGS) $(INCLUDEDIR) $< -o $@

wrap.so: cli_xcin.o wrap.o select_mode.o config.h
	$(CC) $(SHAREFLAGES) $(SHARELIBS) -o wrap.so cli_xcin.o \
		wrap.o select_mode.o
	strip wrap.so

debug: cli_xcin.o select_mode.o config.h
	rm -f wrap.o
	$(CC) -DXA_DEBUG -c $(CFLAGS) $(INCLUDEDIR) -o wrap.o wrap.c
	$(CC) $(SHAREFLAGES) $(SHARELIBS) -DXA_DEBUG -o wrap.so cli_xcin.o \
		wrap.o select_mode.o
	strip wrap.so

clean:
	rm -f *.o *.so core

install: all
	$(INSTALL) -m 755 wrap.so $(DESTDIR)
	mkdir -p /etc/chinese/xa+cv && \
		$(INSTALL) -m 644 xa+cv.config $(CONGDIR)/config

