## @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@/*.qrc.in @srcdir@/*.png
# @srcdir@/*.ui

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

QMAKE_PROJECT = qmake.pro

QMAKE_TARGET = qbrowserlib-swisswebview qbrowserlib-buttonlineedit
TARGETS = ${QMAKE_TARGET}
QMAKE_MAKEFILE = ${QMAKE_TARGET:%=makefile.qmake.%}

all: ${TARGETS} $
#$(LANGS:%=@PACKAGENAME@_%.ts)

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

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


# @PACKAGENAME@_%.qm: @srcdir@/@PACKAGENAME@_%.ts
# 	${LRELEASE} $< -qm $@

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

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

${QMAKE_MAKEFILE}: ${QMAKE_PROJECT} ${ALL_SRC}
	${QMAKE} -o $@ $< CONFIG+=${@:makefile.qmake.%=%}

# $(LANGS:%=@PACKAGENAME@_%.qm)
${QMAKE_TARGET}: ${QMAKE_MAKEFILE} ${ALL_SRC}
	make -f makefile.qmake.$@

install-data-local: ${QMAKE_MAKEFILE}
	${mkinstalldirs} ${DESTDIR}${QT_INSTALL_PLUGINS}
	for file in ${QMAKE_TARGET:%=lib%*}; do \
	  if test -e $$file; then \
	    ${INSTALL} $$file ${DESTDIR}${QT_INSTALL_PLUGINS}; \
	  fi; \
	done

uninstall-local:
	-rm -r ${QMAKE_TARGET:%=${DESTDIR}${QT_INSTALL_PLUGINS}/lib%*}

clean-local:
	-rm -r ${QMAKE_TARGET:%=lib%*}

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