Skip to content

Commit

Permalink
Include po generation into Makefile
Browse files Browse the repository at this point in the history
Also document Makefile dedicated rule in README.
  • Loading branch information
rezib committed Dec 16, 2021
1 parent 5d8f38b commit 28603df
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
src/prown
tests/isolate
*~
*.mo
doc/**/*.1
21 changes: 16 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
CFLAGS ?= -Wall
EXEC = prown
PROWN_SRC = $(wildcard src/*.c)
TESTS_SRC = $(wildcard tests/*.c)
SRC = $(PROWN_SRC) $(TESTS_SRC)
Expand All @@ -14,21 +15,31 @@ INDENT_FLAGS = --no-tabs \
CHECK = cppcheck
CHECKFLAGS ?= -I /usr/include -I /usr/include/linux --enable=all --language=c
prefix = /usr/local
all:src/prown
doc:doc/man/prown.1

all:src/$(EXEC)
doc:doc/man/$(EXEC).1

src/prown: $(PROWN_SRC)
$(CC) $(CFLAGS) -o $@ $^ -lbsd -lacl

po: po/fr/$(EXEC).mo

po/fr/$(EXEC).mo: po/fr/$(EXEC).po
msgfmt --output-file=$@ $<

po/fr/$(EXEC).po: po/$(EXEC).pot
msgmerge --update $@ $<

po/$(EXEC).pot: $(PROWN_SRC)
xgettext --keyword=_ --language=C --add-comments --sort-output --package-name=$(EXEC) --output $@ $(PROWN_SRC)

install: src/prown
install -D src/prown \
$(DESTDIR)$(prefix)/bin/prown
%.1: %.1.md
pandoc --standalone --from markdown --to=man $^ --output $@

clean:
-rm -f src/prown tests/isolate */*~
-rm -f src/prown tests/isolate */*~ po/*/*.mo

indent:
indent $(INDENT_FLAGS) $(SRC)
Expand All @@ -48,4 +59,4 @@ distclean: clean
uninstall:
-rm -f $(DESTDIR)$(prefix)/bin/prown

.PHONY: all install clean distclean indent check uninstall tests
.PHONY: all po install clean distclean indent check uninstall tests
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,14 @@ make tests

Tests require `sudo` to prepare the testing environment as root.

### i18n

To update gettext pot and po file for translation, run this command:

```
make po
```

## Licence

**Prown** is distributed under the terms of the GPL v3 license.

0 comments on commit 28603df

Please sign in to comment.