# @(#$Id: Makefile.in,v 1.8 2006-11-09 17:38:13 dockes Exp $  (C) 2005 J.F.Dockes

prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
datadir = @datadir@
mandir = @mandir@

QMAKE = @QMAKE@
QTGUI = @QTGUI@

all: mk/sysconf common/rclversion.h
	cd lib; ${MAKE}
	cd bincimapmime; ${MAKE}
	cd index; ${MAKE} recollindex
	cd $(QTGUI); ${QMAKE} recoll.pro; ${MAKE} depth=.. 

mk/sysconf:
	@echo "You need to run configure first" ; exit 1

common/rclversion.h: VERSION
	echo 'static const char *rclversion = "'`cat VERSION`'";' \
	   > common/rclversion.h

static: mk/sysconf common/rclversion.h
	cd lib; ${MAKE}
	cd bincimapmime; ${MAKE}
	cd index; rm -f recollindex; \
	   ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic recollindex
	cd $(QTGUI); $(QMAKE) recoll.pro; \
	   rm -f recoll; \
	   ${MAKE} BSTATIC=-Wl,-Bstatic BDYNAMIC=-Wl,-Bdynamic depth=.. 

clean:
	cd common; ${MAKE} clean
	cd index; ${MAKE} clean
	cd lib; ${MAKE} clean
	cd bincimapmime; ${MAKE} clean
	cd query; ${MAKE} clean
	cd utils; ${MAKE} clean
        #cd doc/user; ${MAKE} clean
	@-cd $(QTGUI); ${MAKE} clean
	rm -f $(QTGUI)/Makefile $(QTGUI)/preview/Makefile $(QTGUI)/recoll

distclean: clean
	rm -f mk/sysconf mk/localdefs sampleconf/recoll.conf \
	   $(QTGUI)/recoll.pro Makefile config.log config.status \
	   recollinstall \
	   doc/user/*.html* doc/user/*.txt doc/user/HTML.manifest \
	  lib/*.dep

# recollinstall can be executed by the user and will compute 'normal'
# values for bindir etc., relative to the prefix argument.  When executed
# here, we pass a bunch of variables in the environment, the values will
# override the computed defaults.
install: all
	DESTDIR=${DESTDIR} bindir=${bindir} datadir=${datadir} \
	mandir=${mandir} \
	./recollinstall ${prefix}

.PHONY: all static clean distclean install
