1From 3c16d0b7bf809a56affd6e1a4c0998027968b91a Mon Sep 17 00:00:00 2001
2From: Ulf Samuelsson <ulf.samuelsson@atmel.com>
3Date: Mon, 8 Feb 2016 23:03:48 +0100
4Subject: [PATCH] Makefile: provide an option to not build manpages
5
6The process of generating the vpnc.8 man page consists in running the
7vpnc tool itself, and parse its --long-help output. While this is
8perfectly fine when building natively, it fails completely when
9cross-compiling: the vpnc binary that was built cannot be executed on
10the build machine.
11
12In order to support such situations with minimal changes, this patch
13adjusts the Makefile to make it understand a MANS variable. By
14default, it's defined to "vpnc.8", which means the manpage continues
15to be built as usual. However, if it's overriden to be empty, then no
16manpage is built.
17
18Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
19---
20
21 Makefile | 5 ++++-
22 1 file changed, 4 insertions(+), 1 deletion(-)
23
24diff --git a/Makefile b/Makefile
25index 7ac225a..ea2cd41 100644
26--- a/Makefile
27+++ b/Makefile
28@@ -54,6 +54,7 @@ endif
29 SRCS = sysdep.c vpnc-debug.c isakmp-pkt.c tunip.c config.c dh.c math_group.c supp.c decrypt-utils.c crypto.c $(CRYPTO_SRCS)
30 BINS = vpnc cisco-decrypt test-crypto
31 OBJS = $(addsuffix .o,$(basename $(SRCS)))
32+MANS ?= vpnc.8
33 CRYPTO_OBJS = $(addsuffix .o,$(basename $(CRYPTO_SRCS)))
34 BINOBJS = $(addsuffix .o,$(BINS))
35 BINSRCS = $(addsuffix .c,$(BINS))
36@@ -76,7 +77,7 @@ ifneq (,$(findstring Apple,$(shell $(CC) --version)))
37 override CFLAGS += -fstrict-aliasing -freorder-blocks -fsched-interblock
38 endif
39
40-all : $(BINS) vpnc.8
41+all : $(BINS) $(MANS)
42
43 vpnc : $(OBJS) vpnc.o
44 	$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
45@@ -136,7 +137,9 @@ install-common: all
46 	install -m600 vpnc.conf $(DESTDIR)$(ETCDIR)/default.conf
47 	install -m755 vpnc-disconnect $(DESTDIR)$(SBINDIR)
48 	install -m755 pcf2vpnc $(DESTDIR)$(BINDIR)
49+ifneq ($(MANS),)
50 	install -m644 vpnc.8 $(DESTDIR)$(MANDIR)/man8
51+endif
52 	install -m644 pcf2vpnc.1 $(DESTDIR)$(MANDIR)/man1
53 	install -m644 cisco-decrypt.1 $(DESTDIR)$(MANDIR)/man1
54 	install -m644 COPYING $(DESTDIR)$(DOCDIR)
55--
562.6.4
57
58