commit: 6dae2b34423f5c00971cc243c97697644c2da143
parent 8d8f8aad8ec4cbfd4f6119452fde2aa5c37f8242
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Fri, 12 Apr 2019 02:12:30 +0200
Makefile: Add building *.mo on compilation
Diffstat:
2 files changed, 21 insertions(+), 12 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,30 +1,39 @@
.POSIX:
-PREFIX = /usr/local
-BINDIR = $(PREFIX)/bin
-MANDIR = $(PREFIX)/share/man
+PREFIX = /usr/local
+BINDIR = $(PREFIX)/bin
+MANDIR = $(PREFIX)/share/man
+DATADIR = $(PREFIX)/share/badwolf
+PACKAGE = Badwolf
-DEPS = gtk+-3.0 webkit2gtk-4.0
-OBJS = badwolf
+DEPS = gtk+-3.0 webkit2gtk-4.0
+OBJS = badwolf
+TRANS = fr.mo
-CC = cc
-CFLAGS = -g -Wall -Wextra
-CDEPS = `pkg-config --cflags $(DEPS)`
-LIBS = `pkg-config --libs $(DEPS)`
+CC = cc
+CFLAGS = -g -Wall -Wextra
+CDEPS = `pkg-config --cflags $(DEPS)` -DDATADIR=\"$(DATADIR)\" -DPACKAGE=\"$(PACKAGE)\"
+LIBS = `pkg-config --libs $(DEPS)`
-all: $(OBJS)
+all: $(OBJS) $(TRANS)
+
+%.mo:
+ mkdir -p locale/$*/LC_MESSAGES
+ msgfmt -o locale/$*/LC_MESSAGES/$(PACKAGE).mo po/$*.po
.c:
$(CC) -std=c11 $(CFLAGS) $(CDEPS) -o $@ $< $(LDFLAGS) $(LIBS)
-install: badwolf
+install: all
mkdir -p $(DESTDIR)$(BINDIR)
cp -p badwolf $(DESTDIR)$(BINDIR)/badwolf
mkdir -p $(DESTDIR)$(MANDIR)/man1
cp -p badwolf.1 $(DESTDIR)$(MANDIR)/man1
+ mkdir -p $(DESTDIR)$(DATADIR)/locale
+ cp -r locale/ $(DESTDIR)$(DATADIR)
clean:
- rm $(OBJS)
+ rm -fr locale $(OBJS)
format: *.c *.h
clang-format -style=file -assume-filename=.clang-format -i *.c *.h
diff --git a/mo/.keep b/mo/.keep