
SHELL = /bin/sh
VPATH = @srcdir@
exec_prefix = @exec_prefix@
prefix = @prefix@
bindir = @bindir@
srcdir = @srcdir@
libdir = @libdir@
subdir = jni
top_srcdir = @top_srcdir@
transform = @program_transform_name@

UNAC_DIR=@UNAC_DIR@

ENABLE_ACCENTFOLD = @ENABLE_ACCENTFOLD@
ifeq ($(ENABLE_ACCENTFOLD), 1)
AFLIBS = $(UNAC_DIR)/libunac.a 
AFINCLUDES = -I$(UNAC_DIR)
else
AFLIBS = 
AFINCLUDES =
endif


AR = ar
CC = @CC@
CXX = @CXX@
CFLAGS = @CFLAGS@ -ansi @ARCH_DEP_FLAGS@ -DSILENT -DSHORT_SUFFIX
CXXFLAGS = @CXXFLAGS@ @ARCH_DEP_FLAGS@ -DSILENT -DSHORT_SUFFIX
DEFS = @DEFS@
RANLIB = @RANLIB@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
LDFLAGS = @LDFLAGS@ @ARCH_DEP_FLAGS@
GSDLOS = @gsdlos@
#NOTE: libmgpptext.a needs to come before libmgpplib.a !!!

ifeq ($(GSDLOS),windows)
  QUERY_LIBS = ../text/libmgpptext.a   ../lib/libmgpplib.a $(AFLIBS) -static-libstdc++ ../../../packages/iconv/lib/libiconv.a @LIBS@
  PASSES_LIBS = ../text/libmgpppass.a ../lib/libmgpplib.a -static-libstdc++ @LIBS@
else ifeq ($(GSDLOS),darwin)
  QUERY_LIBS = ../text/libmgpptext.a   ../lib/libmgpplib.a $(AFLIBS) -liconv @LIBS@
  PASSES_LIBS = ../text/libmgpppass.a ../lib/libmgpplib.a @LIBS@
else
  QUERY_LIBS = ../text/libmgpptext.a   ../lib/libmgpplib.a $(AFLIBS) ../../../packages/iconv/lib/libiconv.a @LIBS@
  PASSES_LIBS = ../text/libmgpppass.a ../lib/libmgpplib.a @LIBS@
endif

TOUCH = echo timestamp >
AWK = @AWK@

JNICFLAGS=@JNICFLAGS@
JNILDFLAGS=@JNILDFLAGS@
JNIPREFIX=@JNIPREFIX@
JNISUFFIX=@JNISUFFIX@
JNIINC=@JNIINC@

datadir = $(prefix)/share
libexecdir = $(exec_prefix)/libexec
localedir = $(datadir)/locale
mandir = $(prefix)/man/man1

CXXCOMPILE = $(CXX) -c $(DEFS) $(INCLUDES) $(CXXFLAGS) $(JNICFLAGS)

.SUFFIXES:

.SUFFIXES: .cpp .o
.cpp.o:
	$(CXXCOMPILE) $<

INCLUDES = -I.. -I../lib -I../text $(JNIINC) $(AFINCLUDES)

all: compile link

compile:
	$(CXXCOMPILE) MGPPSearchWrapperImpl.cpp MGPPRetrieveWrapperImpl.cpp MGPPPassesWrapperImpl.cpp
link:
	$(CXX) $(LDFLAGS) $(JNILDFLAGS) -o $(JNIPREFIX)mgppretrievejni.$(JNISUFFIX) MGPPRetrieveWrapperImpl.o $(QUERY_LIBS)
	$(CXX) $(LDFLAGS) $(JNILDFLAGS) -o $(JNIPREFIX)mgppsearchjni.$(JNISUFFIX) MGPPSearchWrapperImpl.o $(QUERY_LIBS)
	$(CXX) $(LDFLAGS) $(JNILDFLAGS) -o $(JNIPREFIX)mgpppassjni.$(JNISUFFIX) MGPPPassesWrapperImpl.o $(PASSES_LIBS)

clean:
	rm -rf *.o $(JNIPREFIX)mgppretrievejni.$(JNISUFFIX) $(JNIPREFIX)mgppsearchjni.$(JNISUFFIX) $(JNIPREFIX)mgpppassjni.$(JNISUFFIX)

distclean: clean
	rm -f Makefile

install:
#	../mkinstalldirs $(libdir); \
#	cp $(JNIPREFIX)mgppjni.$(JNISUFFIX)  $(JNIPREFIX)mgpppassjni.$(JNISUFFIX)  $(libdir)/;



