Makefile 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. VERSION=0.1
  2. VALAC=valac
  3. CFLAGS=--pkg gtk+-3.0
  4. LDFLAGS=-X -lm
  5. GETTEXT_PACKAGE=gtk-theme-config
  6. LOCALES_DIR=/usr/share/locale
  7. VALAFLAGS=-X -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\"
  8. SOURCE=gtk-theme-config.vala
  9. BINARY=gtk-theme-config
  10. ICON=gtk-theme-config.svg
  11. DESKTOPFILE=gtk-theme-config.desktop
  12. GTK_UPDATE_ICON_CACHE=gtk-update-icon-cache -f -t
  13. CLEAN=rm -f
  14. INSTALL=install
  15. INSTALL_PROGRAM=$(INSTALL) -Dpm 0755
  16. INSTALL_DATA=$(INSTALL) -Dpm 0644
  17. all: $(BINARY)
  18. $(BINARY): $(SOURCE)
  19. $(VALAC) $(VALAFLAGS) $(CFLAGS) $(LDFLAGS) $(SOURCE) -o $(BINARY)
  20. clean:
  21. $(CLEAN) $(BINARY)
  22. install: all mo
  23. $(INSTALL_PROGRAM) $(BINARY) $(DESTDIR)/usr/bin/$(BINARY)
  24. $(INSTALL_DATA) $(ICON) $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/$(ICON)
  25. $(INSTALL_DATA) $(DESKTOPFILE) $(DESTDIR)/usr/share/applications/$(DESKTOPFILE)
  26. @-if test -z $(DESTDIR); then $(GTK_UPDATE_ICON_CACHE) $(DESTDIR)/usr/share/icons/hicolor; fi
  27. uninstall:
  28. $(CLEAN) $(DESTDIR)/usr/bin/$(BINARY)
  29. $(CLEAN) $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/$(ICON)
  30. $(CLEAN) $(DESTDIR)/usr/share/applications/$(DESKTOPFILE)
  31. @-if test -z $(DESTDIR); then $(GTK_UPDATE_ICON_CACHE) $(DESTDIR)/usr/share/icons/hicolor; fi
  32. for folder in $(LOCALES_DIR)/*; do \
  33. file=$$folder/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
  34. if [ -f $$file ]; then \
  35. rm $$file; \
  36. echo "Removing $$file"; \
  37. fi \
  38. done
  39. pot:
  40. xgettext -d $(GETTEXT_PACKAGE) -o po/$(GETTEXT_PACKAGE).pot $(SOURCE) --keyword="_" \
  41. --from-code=UTF-8 --package-name=$(GETTEXT_PACKAGE) --package-version=$(VERSION)
  42. mo: pot
  43. if [ -f po/*.po ]; then \
  44. for po_file in po/*.po; do \
  45. out_file=$(LOCALES_DIR)/$$(echo $$po_file | sed "s/^po\/\(.*\)\.po/\1/")/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
  46. msgfmt -o $$out_file $$po_file; \
  47. echo "Installing $$out_file"; \
  48. done \
  49. fi