#C- This program is free software; you can redistribute it and/or 
#C- modify it under the terms of the GNU General Public License, 
#C- either version 2 or (at your option) any later version.
#C- The license should have accompanied the program or you may 
#C- obtain a copy of the license from the Free Software
#C- Foundation at http://www.fsf.org.
#C- 
#C- This program is distributed in the hope that it will be useful,
#C- but WITHOUT ANY WARRANTY; without even the implied warranty of
#C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#C- GNU General Public License for more details.


SHELL = /bin/sh

PACKAGE_NAME = djview
PACKAGE_VERSION = 4.5

srcdir = .
top_srcdir = ..
top_builddir = ..
prefix = /media/card/programs/djview4
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
datarootdir = ${prefix}/share
datadir = ${datarootdir}
libdir = ${exec_prefix}/lib
mandir = ${datarootdir}/man
plugindir = ${libdir}/netscape/plugins

CC = gcc
CXX = g++
RM = /scratchbox/tools/bin/rm
AR = ar
LN_S = ln -s
TOUCH = /scratchbox/tools/bin/touch
INSTALL = /scratchbox/tools/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
INSTALL_SHLIB = ${INSTALL} -m 644
LIBTOOL = $(SHELL) $(top_builddir)/libtool --tag=disable-static
OPTS = -DNDEBUG -Wall -O2
NSDEJAVU_LIBS = 
NSDEJAVU_CFLAGS = 
GLIB_CFLAGS = -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include  

INCS = \
 -I${srcdir} \
 -I${srcdir}/npsdk \
 -I${top_builddir}

CFLAGS =  ${OPTS} ${INCS} ${NSDEJAVU_CFLAGS} ${GLIB_CFLAGS}

LIBS =  ${NSDEJAVU_LIBS} 

all: nsdejavu.la nsdejavu.x nsdejavu.1

nsdejavu.lo: nsdejavu.c

nsdejavu.la: nsdejavu.lo
	${LIBTOOL} --mode=link ${CC} ${CFLAGS} nsdejavu.lo ${LIBS} \
	  -rpath ${plugindir} -module -o $@

nsdejavu.x: nsdejavu.la FORCE
	eval `grep '^dlname=' nsdejavu.la` && \
	  echo $${dlname} | sed -e 's/\([-.][0-9][0-9]*\)*//g' > $@ 
	-@if test -z "`cat nsdejavu.x`" ; then \
	   echo "-----------------------------------------------";\
	   echo "*** Libtool cannot build the plugin 'nsdejavu'.";\
	   echo "*** Did you configure with '--disable-shared'? ";\
	   echo "-----------------------------------------------";\
	  fi

nsdejavu.1: nsdejavu.1.in nsdejavu.x
	eval "nsdejavu=`cat nsdejavu.x`" && \
	  sed < ${srcdir}/nsdejavu.1.in > nsdejavu.1 \
	   -e 's,LIBDIR,${libdir},' -e "s,NSDEJAVUSO,$$nsdejavu,"

install: install-bin install-man

install-bin: nsdejavu.la FORCE
	${INSTALL} -d ${DESTDIR}${plugindir}	
	eval "nsdejavu=`cat nsdejavu.x`" && \
	  eval `grep '^dlname=' nsdejavu.la` && \
	    ${INSTALL_SHLIB} .libs/$$dlname ${DESTDIR}${plugindir}/$$nsdejavu

install-man: nsdejavu.1 FORCE
	${INSTALL} -d ${DESTDIR}${mandir}/man1
	${INSTALL_DATA} nsdejavu.1 ${DESTDIR}${mandir}/man1

clean: FORCE
	-${LIBTOOL} --mode=clean ${RM} 2>/dev/null *.lo *.la 
	-${RM} 2>/dev/null -rf *.lo *.la .libs
	-${RM} 2>/dev/null nsdejavu.x nsdejavu.1

distclean: clean 
	-${RM} -r 2>/dev/null Makefile *.rpo ii_files

FORCE:
.PHONY: FORCE
.SUFFIXES: .c .cpp .o .lo

.c.o:
	${CC} ${CFLAGS} -c $< -o $@

.c.lo:
	${LIBTOOL} --mode=compile ${CC} ${CFLAGS} -c $< -o $@

# Dependencies

nsdejavu.lo nsdejavu.o: nsdejavu.c 
nsdejavu.lo nsdejavu.o: npsdk/npapi.h npsdk/npupp.h npsdk/npruntime.h 
