prefix  = @ac_prefix@

name    = qjackctl

target  = src/$(name)

headers = \
	src/config.h \
	src/qjackctl.h \
	src/qjackctlAbout.h \
	src/qjackctlAlsaConnect.h \
	src/qjackctlAlsaGraph.h \
	src/qjackctlConnect.h \
	src/qjackctlAliases.h \
	src/qjackctlGraph.h \
	src/qjackctlGraphCommand.h \
	src/qjackctlInterfaceComboBox.h \
	src/qjackctlJackConnect.h \
	src/qjackctlJackGraph.h \
	src/qjackctlPatchbay.h \
	src/qjackctlPatchbayFile.h \
	src/qjackctlPatchbayRack.h \
	src/qjackctlSession.h \
	src/qjackctlSetup.h \
	src/qjackctlStatus.h \
	src/qjackctlSystemTray.h \
	src/qjackctlAboutForm.h \
	src/qjackctlConnectionsForm.h \
	src/qjackctlGraphForm.h \
	src/qjackctlMainForm.h \
	src/qjackctlMessagesStatusForm.h \
	src/qjackctlPatchbayForm.h \
	src/qjackctlSessionForm.h \
	src/qjackctlSetupForm.h \
	src/qjackctlPaletteForm.h \
	src/qjackctlSocketForm.h

sources = \
	src/qjackctl.cpp \
	src/qjackctlAlsaConnect.cpp \
	src/qjackctlAlsaGraph.cpp \
	src/qjackctlConnect.cpp \
	src/qjackctlAliases.cpp \
	src/qjackctlGraph.cpp \
	src/qjackctlGraphCommand.cpp \
	src/qjackctlInterfaceComboBox.cpp \
	src/qjackctlJackConnect.cpp \
	src/qjackctlJackGraph.cpp \
	src/qjackctlPatchbay.cpp \
	src/qjackctlPatchbayFile.cpp \
	src/qjackctlPatchbayRack.cpp \
	src/qjackctlSession.cpp \
	src/qjackctlSetup.cpp \
	src/qjackctlSystemTray.cpp \
	src/qjackctlAboutForm.cpp \
	src/qjackctlConnectionsForm.cpp \
	src/qjackctlGraphForm.cpp \
	src/qjackctlMainForm.cpp \
	src/qjackctlMessagesStatusForm.cpp \
	src/qjackctlPatchbayForm.cpp \
	src/qjackctlSessionForm.cpp \
	src/qjackctlSetupForm.cpp \
	src/qjackctlPaletteForm.cpp \
	src/qjackctlSocketForm.cpp

forms = \
	src/qjackctlAboutForm.ui \
	src/qjackctlConnectionsForm.ui \
	src/qjackctlGraphForm.ui \
	src/qjackctlMainForm.ui \
	src/qjackctlMessagesStatusForm.ui \
	src/qjackctlPatchbayForm.ui \
	src/qjackctlSessionForm.ui \
	src/qjackctlSetupForm.ui \
	src/qjackctlPaletteForm.ui \
	src/qjackctlSocketForm.ui

resources = \
	src/qjackctl.qrc

 
translations_sources = \
	src/translations/qjackctl_cs.ts \
	src/translations/qjackctl_de.ts \
	src/translations/qjackctl_es.ts \
	src/translations/qjackctl_fr.ts \
	src/translations/qjackctl_it.ts \
	src/translations/qjackctl_ja.ts \
	src/translations/qjackctl_nl.ts \
	src/translations/qjackctl_pt.ts \
	src/translations/qjackctl_ru.ts \
	src/translations/qjackctl_sk.ts

translations_targets = \
	src/translations/qjackctl_cs.qm \
	src/translations/qjackctl_de.qm \
	src/translations/qjackctl_es.qm \
	src/translations/qjackctl_fr.qm \
	src/translations/qjackctl_it.qm \
	src/translations/qjackctl_ja.qm \
	src/translations/qjackctl_nl.qm \
	src/translations/qjackctl_pt.qm \
	src/translations/qjackctl_ru.qm \
	src/translations/qjackctl_sk.qm


export datadir = @ac_datadir@
export mandir = @ac_mandir@

translations_dir = $(datadir)/$(name)/translations


export QMAKE = @ac_qmake@
export LUPDATE = @ac_lupdate@
export LRELEASE = @ac_lrelease@


all:	$(target)


$(target):	$(name).mak $(resources) ${forms} $(sources) $(headers)
	@$(MAKE) -f $(name).mak

$(name).mak:	$(name).pro
	@$(QMAKE) -o $(name).mak $(name).pro


translations_lupdate:	$(translations_sources)
	@$(LUPDATE) -verbose -no-obsolete -recursive src -ts $(translations_sources)

translations_lrelease:	translations_lupdate $(translations_targets)

%.qm:	%.ts
	@$(LRELEASE) -verbose $< -qm $@


install:	$(target) translations_lrelease $(name).1
	@$(MAKE) INSTALL_ROOT=$(DESTDIR) -f $(name).mak install
	@install -d -v -m 0755 $(DESTDIR)$(translations_dir)
	@install -v -m 0644 $(translations_targets) $(DESTDIR)$(translations_dir)
	@install -d -v -m 0755 $(DESTDIR)$(mandir)/man1
	@install -v -m 0644 $(name).1 $(DESTDIR)$(mandir)/man1/$(name).1
	@gzip -nvf $(DESTDIR)$(mandir)/man1/$(name).1
	@install -d -v -m 0755 $(DESTDIR)$(mandir)/fr/man1
	@install -v -m 0644 $(name).fr.1 $(DESTDIR)$(mandir)/fr/man1/$(name).1
	@gzip -nvf $(DESTDIR)$(mandir)/fr/man1/$(name).1

uninstall:	$(DESTDIR)$(prefix)/bin/$(name)
	@$(MAKE) INSTALL_ROOT=$(DESTDIR) -f $(name).mak uninstall
	@rm -rvf $(DESTDIR)$(translations_dir)
	@rm -vf $(DESTDIR)$(mandir)/man1/$(name).1.gz
	@rm -vf $(DESTDIR)$(mandir)/fr/man1/$(name).1.gz


clean:	$(name).mak
	@$(MAKE) -f $(name).mak distclean || true
	@rm -f $(target) $(target).mak $(name).mak
	@rm -rf *.cache *.log *.status $(translations_targets)

