Makefile: install locale in /usr/share

This commit is contained in:
zvon 2020-04-01 14:53:16 +02:00
parent e68adb3100
commit d36ed1b2ac

View File

@ -4,6 +4,8 @@ CFLAGS ?= -O2 -Wall -Wextra -std=c++11
PREFIX ?= /usr/local/bin PREFIX ?= /usr/local/bin
APPDIR ?= /usr/share/applications APPDIR ?= /usr/share/applications
ICONDIR ?= /usr/share/icons/hicolor ICONDIR ?= /usr/share/icons/hicolor
LOCALES = locale/cs/LC_MESSAGES/tv_rename.mo\
locale/en_US/LC_MESSAGES/tv_rename.mo
GTKFLAGS = `pkg-config gtkmm-3.0 --cflags` GTKFLAGS = `pkg-config gtkmm-3.0 --cflags`
GTKLIBS = `pkg-config gtkmm-3.0 --libs` GTKLIBS = `pkg-config gtkmm-3.0 --libs`
@ -19,6 +21,9 @@ clean:
install: tv_rename install: tv_rename
install -d $(PREFIX)/ install -d $(PREFIX)/
install -m 755 tv_rename $(PREFIX)/ install -m 755 tv_rename $(PREFIX)/
for f in locale/* ; do install -m 644 "$${f}/LC_MESSAGES/tv_rename.mo"\
"/usr/share/$${f}/LC_MESSAGES/"\
; done
.PHONY: install_gui .PHONY: install_gui
install_gui: gui install_gui: gui
@ -29,6 +34,9 @@ install_gui: gui
install -d $(ICONDIR) install -d $(ICONDIR)
install -m 644 tv_rename.svg $(ICONDIR)/scalable/apps/ install -m 644 tv_rename.svg $(ICONDIR)/scalable/apps/
gtk-update-icon-cache -f $(ICONDIR) gtk-update-icon-cache -f $(ICONDIR)
for f in locale/* ; do install -m 644 "$${f}/LC_MESSAGES/tv_rename.mo"\
"/usr/share/$${f}/LC_MESSAGES/"\
; done
.PHONY: uninstall .PHONY: uninstall
uninstall: uninstall:
@ -41,7 +49,8 @@ uninstall_gui:
rm $(ICONDIR)/scalable/apps/tv_rename.svg rm $(ICONDIR)/scalable/apps/tv_rename.svg
gtk-update-icon-cache -f $(ICONDIR) gtk-update-icon-cache -f $(ICONDIR)
tv_rename: functions.o filesystem.o network.o tv_rename.o progress.o main.o tv_rename: functions.o filesystem.o network.o tv_rename.o progress.o main.o\
$(LOCALES)
$(CXX) $(CFLAGS) -o tv_rename main.o tv_rename.o functions.o\ $(CXX) $(CFLAGS) -o tv_rename main.o tv_rename.o functions.o\
filesystem.o network.o progress.o -lcurl -lsqlite3 filesystem.o network.o progress.o -lcurl -lsqlite3
strip tv_rename strip tv_rename
@ -65,7 +74,7 @@ gui: tv_rename_gui
tv_rename_gui: gui.o mainwindow.o seasonwindow.o databasewindow.o\ tv_rename_gui: gui.o mainwindow.o seasonwindow.o databasewindow.o\
searchwindow.o gtkfunctions.o network.o functions_gui.o\ searchwindow.o gtkfunctions.o network.o functions_gui.o\
filesystem_u_gui.o tv_rename_gui.o progress_gui.o\ filesystem_u_gui.o tv_rename_gui.o progress_gui.o\
progresswindow.o progresswindow.o $(LOCALES)
$(CXX) $(CFLAGS) -o $@ $^ $(GTKFLAGS) $(GTKLIBS) -lcurl -lsqlite3 $(CXX) $(CFLAGS) -o $@ $^ $(GTKFLAGS) $(GTKLIBS) -lcurl -lsqlite3
strip tv_rename_gui strip tv_rename_gui
@ -123,3 +132,10 @@ tv_rename.res: tv_rename.rc
tv_rename_stringtable.res: tv_rename_stringtable.rc tv_rename_stringtable.res: tv_rename_stringtable.rc
rc $^ rc $^
locale/%/LC_MESSAGES:
mkdir -p $@
locale/%/LC_MESSAGES/tv_rename.mo: %.po locale/%/LC_MESSAGES
msgfmt -c $< -o $<.mo
mv $<.mo $@