1From 5368bd0cfd0640f5c0ca766d4fda1b3f71c1b013 Mon Sep 17 00:00:00 2001 2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 3Date: Wed, 30 Aug 2017 23:07:26 +0200 4Subject: [PATCH] Makefile, autoconf/makeinfo.in: support build/install without 5 gettext 6 7The gettext tool msgfmt may not be available to build the .mo files 8from the .po files, so we handle this case by disabling the 9build/installation of .po files in such a case. 10 11Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 12--- 13 Makefile | 17 ++++++++++++++--- 14 autoconf/makeinfo.in | 1 + 15 2 files changed, 15 insertions(+), 3 deletions(-) 16 17diff --git a/Makefile b/Makefile 18index a708046..3e83ca3 100644 19--- a/Makefile 20+++ b/Makefile 21@@ -7,11 +7,18 @@ OBJFILES := $(SRCFILES:%.c=%.o) 22 LANGS = fr ru es 23 MOS := $(addprefix po/, $(addsuffix .mo, $(LANGS))) 24 LOCALEDIR = $(INSTALL_PREFIX)/usr/share/locale 25- 26-all: pdmenu $(POTFILE) $(MOS) 27+TARGETS = pdmenu 28+INSTALL_TARGETS = install-pdmenu 29 30 include makeinfo 31 32+ifneq ($(MSGFMT),) 33+TARGETS += $(POTFILE) $(MOS) 34+INSTALL_TARGETS += install-pos 35+endif 36+ 37+all: $(TARGETS) 38+ 39 pdmenu: .dep $(OBJFILES) 40 ${CC} -o pdmenu $(OBJFILES) $(CFLAGS) $(LIBS) 41 42@@ -40,7 +47,9 @@ clean: 43 $(MAKE) $(POTFILE) # make sure translators' input is ready 44 rm -f $(OBJFILES) pdmenu $(MOS) 45 46-install: all 47+install: $(INSTALL_TARGETS) 48+ 49+install-pdmenu: 50 $(INSTALL) -d $(INSTALL_PREFIX)/$(BINDIR) \ 51 $(INSTALL_PREFIX)/$(MANDIR)/man1 \ 52 $(INSTALL_PREFIX)/$(MANDIR)/man5 \ 53@@ -56,6 +65,8 @@ install: all 54 $(INSTALL) examples/pdmenurc $(INSTALL_PREFIX)/$(SYSCONFDIR)/pdmenurc -m 0644 55 $(INSTALL) examples/showdir.pl $(INSTALL_PREFIX)/$(DATADIR)/pdmenu 56 cd $(INSTALL_PREFIX)/$(DATADIR)/pdmenu && $(LN_S) -f showdir.pl editdir.pl 57+ 58+install-pos: 59 for lang in $(LANGS); do \ 60 [ ! -d $(LOCALEDIR)/$$lang/LC_MESSAGES/ ] && mkdir -p $(LOCALEDIR)/$$lang/LC_MESSAGES/; \ 61 install -m 644 po/$$lang.mo $(LOCALEDIR)/$$lang/LC_MESSAGES/pdmenu.mo; \ 62diff --git a/autoconf/makeinfo.in b/autoconf/makeinfo.in 63index 6d58d77..069daf8 100644 64--- a/autoconf/makeinfo.in 65+++ b/autoconf/makeinfo.in 66@@ -8,6 +8,7 @@ DATADIR = @datadir@ 67 CC = @CC@ 68 INSTALL = @INSTALL@ 69 LN_S = @LN_S@ 70+MSGFMT = @MSGFMT@ 71 VER = @VER@ 72 DEFINES = -DETCDIR=\"${SYSCONFDIR}/\" -DVER=\"${VER}\" @DEFS@ \ 73 $(PROFILE) -D__USE_FIXED_PROTOTYPES__ -D_GNU_SOURCE \ 74-- 752.13.5 76 77