## @file
##
## $Id: makefile.am 7 2010-03-01 14:55:44Z marc $
##
##       1         2         3         4         5         6         7         8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890

include_HEADERS = 

if !MINGW32
if MAC
AM_CPPFLAGS += -I/opt/local/include
# -I/Library/OpenSC/include
AM_LDFLAGS = -L/opt/local/lib
# -F/System/Library/Frameworks/PCSC.framework
else
# AM_CPPFLAGS += -I/usr/include/PCSC
endif
endif

EXTRA_DIST = @srcdir@/*.[ch]xx @srcdir@/*.ui @srcdir@/*.ts @srcdir@/languages.qrc.in

LANGS = en de fr it
ALL_SRC = @srcdir@/*.[ch]xx	\
          languages.qrc	\
          @srcdir@/*.ui

QMAKE_PROJECT = @srcdir@/qmake.pro
QMAKE_MAKEFILE = makefile.qmake

QMAKE_TARGET = qbrowserlib

TARGETS = ${QMAKE_TARGET}

all: ${TARGETS} $(LANGS:%=@srcdir@/qbrowserlib_%.ts)

rebuild-ts: $(LANGS)
	${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}

${LANGS}: ${ALL_SRC}
	-rm qbrowserlib_$@.qm
	svn revert @srcdir@/qbrowserlib_$@.ts
	mv @srcdir@/qbrowserlib_$@.ts translation.old
	${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}
	mv @srcdir@/qbrowserlib_$@.ts translation.new
	echo '<?xml version="1.0" encoding="utf-8"?>' > @srcdir@/qbrowserlib_$@.ts
	echo '<!DOCTYPE TS>' >> @srcdir@/qbrowserlib_$@.ts
	echo '<TS version="2.0" language="'$@'">' >> @srcdir@/qbrowserlib_$@.ts
	xqilla merge-translation.xquery >> @srcdir@/qbrowserlib_$@.ts
	echo '</TS>' >> @srcdir@/qbrowserlib_$@.ts
	rm translation.old translation.new

print:
	@echo "LANGS=${LANGS}"
	@echo "ALL_SRC=${ALL_SRC}"
	@echo "QMAKE=${QMAKE}"
	@echo "QMAKE_OPTIONS=${QMAKE_OPTIONS}"
	@echo "QMAKE_MAKEFILE=${QMAKE_MAKEFILE}"
	@echo "QMAKE_TARGET=${QMAKE_TARGET}"
	@echo "TARGETS=${TARGETS}"


qbrowserlib_%.qm: @srcdir@/qbrowserlib_%.ts
	${LRELEASE} $< -qm $@

%.xpm: resources/%.png
	convert $< $@ || cp $< $@

@srcdir@/%.ts: ${ALL_SRC}
	${LUPDATE} @LUPDATE_ARGS@ ${QMAKE_PROJECT}

${QMAKE_MAKEFILE}: ${QMAKE_PROJECT} ${ALL_SRC}
	${QMAKE} -o $@ $<

${QMAKE_TARGET}: ${QMAKE_MAKEFILE} ${ALL_SRC} $(LANGS:%=qbrowserlib_%.qm)
	make -f ${QMAKE_MAKEFILE}

install-data-local:
	${mkinstalldirs} ${DESTDIR}${libdir}
	for file in *${QMAKE_TARGET}{*.a,*.la,.so*,*.dylib,*.dll}; do \
	  if test -e $$file; then \
	    ${INSTALL} $$file ${DESTDIR}${libdir}; \
	  fi; \
	done

uninstall-local:
	-rm -r ${DESTDIR}${libdir}/*${QMAKE_TARGET}*

clean-local:
	-rm -r *${QMAKE_TARGET}{.so*,*.dylib,*.dll}

CLEANFILES = ${TARGETS} ${TARGETS:%=%.exe} $(LANGS:%=qbrowserlib_%.qm) \
             *.o *.obj qrc_*.cpp ui_*.h moc_*.cpp *.qrc *.dll  \
	     ${QMAKE_TARGET}* \
MAINTAINERCLEANFILES = makefile.in ${QMAKE_MAKEFILE}
