diff options
Diffstat (limited to '')
-rw-r--r-- | Makefile | 43 |
1 files changed, 35 insertions, 8 deletions
@@ -24,16 +24,22 @@ GOLDFLAGS = -L $(GOLIBDIR) .SUFFIXES: -.SUFFIXES: .go .a .bin .bin-check +.SUFFIXES: .go .a .bin .bin-check .adoc .po .mo .go.a: go tool compile -I $(@D) $(GOCFLAGS) -o $@ -p $(*F) \ `find $< $$(if [ $(*F) != main ]; then \ - echo src/$(NAME).go src/version.go; fi) | uniq` + echo src/$(NAME).go src/meta.go; fi) | uniq` .a.bin: go tool link -L $(@D) $(GOLDFLAGS) -o $@ --extldflags '$(LDLIBS)' $< +.adoc: + asciidoctor -b manpage -o $@ $< + +.po.mo: + msgfmt -c -o $@ $< + all: @@ -46,19 +52,23 @@ 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) sources = \ src/$(NAME).go \ - src/version.go \ + src/meta.go \ src/main.go \ derived-assets = \ - src/version.go \ + src/meta.go \ $(libs.a) \ $(mains.a) \ $(mains.bin) \ $(NAME).bin \ + $(manpages.N) \ + $(sources.mo) \ side-assets = \ tests/fuzz/corpus/ \ @@ -72,15 +82,18 @@ all: $(derived-assets) $(libs.a): Makefile deps.mk -$(libs.a): src/$(NAME).go src/version.go +$(libs.a): src/$(NAME).go src/meta.go $(fuzz-targets/lib.a): go tool compile $(GOCFLAGS) -o $@ -p $(NAME) -d=libfuzzer \ - $*.go src/$(NAME).go src/version.go + $*.go src/$(NAME).go src/meta.go -src/version.go: Makefile - echo 'package $(NAME); const Version = "$(VERSION)"' > $@ +src/meta.go: Makefile + echo 'package $(NAME)' > $@ + echo 'const Version = "$(VERSION)"' >> $@ + echo 'const Name = "$(NAME)"' >> $@ + echo 'const LOCALEDIR = "$(LOCALEDIR)"' >> $@ $(NAME).bin: src/main.bin ln -fs src/main.bin $@ @@ -137,6 +150,17 @@ bench: $(benchmarks/main.bin-check) +i18n-doc: + po4a po/doc/po4a.cfg + +i18n-code: + gotext src/$(NAME).go > po/$(NAME)/$(NAME).pot + po4a po/$(NAME)/po4a.cfg + +i18n: i18n-doc i18n-code + + + ## Remove *all* derived artifacts produced during the build. ## A dedicated test asserts that this is always true. clean: @@ -154,6 +178,7 @@ install: all cp $(NAME).bin '$(DESTDIR)$(BINDIR)'/$(NAME) cp src/$(NAME).a '$(DESTDIR)$(GOLIBDIR)' cp $(sources) '$(DESTDIR)$(SRCDIR)' + mandir install '$(DESTDIR)$(MANDIR)' $(manpages.N) ## Uninstalls from $(DESTDIR)$(PREFIX). This is a perfect mirror ## of the "install" target, and removes *all* that was installed. @@ -164,6 +189,8 @@ uninstall: '$(DESTDIR)$(GOLIBDIR)'/$(NAME).a \ '$(DESTDIR)$(SRCDIR)' \ + mandir uninstall '$(DESTDIR)$(MANDIR)' $(manpages.N) + ALWAYS: |