From 5b795296eefee45acedad9841e912dee05c34a01 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 15 May 2025 06:07:10 -0300 Subject: Revamp setup of i18n, now with gotext(0) --- Makefile | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 23d9063..7bc1dcc 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ DATE = 1970-01-01 VERSION = 0.1.0 NAME = gistatic NAME_UC = $(NAME) -LANGUAGES = en ## Installation prefix. Defaults to "/usr". PREFIX = /usr BINDIR = $(PREFIX)/bin @@ -38,7 +37,7 @@ GOLDFLAGS = -L $(GOLIBDIR) asciidoctor -b manpage -o $@ $< .po.mo: - msgfmt -c -o $@ $< + msgfmt -cfv -o $@ $< @@ -46,14 +45,15 @@ all: include deps.mk -libs.a = $(libs.go:.go=.a) -mains.a = $(mains.go:.go=.a) -mains.bin = $(mains.go:.go=.bin) -functional-tests/lib.a = $(functional-tests/lib.go:.go=.a) -fuzz-targets/lib.a = $(fuzz-targets/lib.go:.go=.a) -benchmarks/lib.a = $(benchmarks/lib.go:.go=.a) -manpages.N = $(manpages.N.adoc:.adoc=) -sources.mo = $(sources.po:.po=.mo) +libs.a = $(libs.go:.go=.a) +mains.a = $(mains.go:.go=.a) +mains.bin = $(mains.go:.go=.bin) +functional/lib.a = $(functional/lib.go:.go=.a) +fuzz/lib.a = $(fuzz/lib.go:.go=.a) +benchmarks/lib.a = $(benchmarks/lib.go:.go=.a) +manpages.N.adoc = $(manpages.en.N.adoc) $(manpages.XX.N.adoc) +manpages.N = $(manpages.N.adoc:.adoc=) +sources.mo = $(sources.po:.po=.mo) sources = \ src/$(NAME).go \ @@ -67,6 +67,7 @@ derived-assets = \ $(mains.a) \ $(mains.bin) \ $(NAME).bin \ + $(manpages.XX.N.adoc) \ $(manpages.N) \ $(sources.mo) \ @@ -85,7 +86,7 @@ $(libs.a): Makefile deps.mk $(libs.a): src/$(NAME).go src/meta.go -$(fuzz-targets/lib.a): +$(fuzz/lib.a): go tool compile $(GOCFLAGS) -o $@ -p $(NAME) -d=libfuzzer \ $*.go src/$(NAME).go src/meta.go @@ -98,11 +99,14 @@ src/meta.go: Makefile $(NAME).bin: src/main.bin ln -fs src/main.bin $@ +$(manpages.XX.N.adoc): po/doc/po4a.cfg + po4a --no-update --translate-only $@ po/doc/po4a.cfg + tests.bin-check = \ tests/main.bin-check \ - $(functional-tests/main.go:.go=.bin-check) \ + $(functional/main.go:.go=.bin-check) \ $(tests.bin-check): $(EXEC)$*.bin @@ -131,12 +135,12 @@ check: check-unit check-integration FUZZSEC=1 -fuzz-targets/main.bin-check = $(fuzz-targets/main.go:.go=.bin-check) -$(fuzz-targets/main.bin-check): +fuzz/main.bin-check = $(fuzz/main.go:.go=.bin-check) +$(fuzz/main.bin-check): $(EXEC)$*.bin --test.fuzztime=$(FUZZSEC)s \ --test.fuzz='.*' --test.fuzzcachedir=tests/fuzz/corpus -fuzz: $(fuzz-targets/main.bin-check) +fuzz: $(fuzz/main.bin-check) @@ -178,7 +182,8 @@ install: all cp $(NAME).bin '$(DESTDIR)$(BINDIR)'/$(NAME) cp src/$(NAME).a '$(DESTDIR)$(GOLIBDIR)' cp $(sources) '$(DESTDIR)$(SRCDIR)' - mandir install '$(DESTDIR)$(MANDIR)' $(manpages.N) + instool '$(DESTDIR)$(MANDIR)' install man $(manpages.N) + instool '$(DESTDIR)$(LOCALEDIR)' install mo $(sources.mo) ## Uninstalls from $(DESTDIR)$(PREFIX). This is a perfect mirror ## of the "install" target, and removes *all* that was installed. @@ -189,7 +194,8 @@ uninstall: '$(DESTDIR)$(GOLIBDIR)'/$(NAME).a \ '$(DESTDIR)$(SRCDIR)' \ - mandir uninstall '$(DESTDIR)$(MANDIR)' $(manpages.N) + instool '$(DESTDIR)$(MANDIR)' uninstall man $(manpages.N) + instool '$(DESTDIR)$(LOCALEDIR)' uninstall mo $(sources.mo) -- cgit v1.2.3