projects/sencrypt

changeset 13:5a992d873084

Use a symlink for the manpage alias instead of a soelim stub
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Tue Sep 13 19:50:38 2016 +0200 (2016-09-13)
parents 14e58decdf87
children a779ed022a87
files Makefile
line diff
     1.1 --- a/Makefile	Tue Sep 13 18:37:25 2016 +0200
     1.2 +++ b/Makefile	Tue Sep 13 19:50:38 2016 +0200
     1.3 @@ -37,28 +37,35 @@
     1.4  #MAKEDEPEND.c =	makedepend -f- -Y -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) --
     1.5  LINK.c =	$(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(XCPPFLAGS) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
     1.6  LINK.o =	$(CC) $(LDFLAGS) $(XLDFLAGS) $(TARGET_ARCH)
     1.7 +CP :=		cp
     1.8  INSTALL :=	install
     1.9  INSTALL.exec :=	$(INSTALL) -D -m 0755
    1.10  INSTALL.data :=	$(INSTALL) -D -m 0644
    1.11 +INSTALL.link :=	$(CP) -f -P
    1.12  PAX :=		pax
    1.13  GZIP :=		gzip
    1.14  SED :=		sed
    1.15  XSLTPROC :=	xsltproc
    1.16  DOCBOOK5_MANPAGES_STYLESHEET =	http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
    1.17 +DOCBOOK5_MANPAGES_FLAGS =	--stringparam man.authors.section.enabled 0 \
    1.18 +				--stringparam man.copyright.section.enabled 0
    1.19  
    1.20  define generate-manpage-rule =
    1.21 -%.$(1): %.$(1).xml
    1.22 +$(addsuffix .%,$(basename $1)): $(addsuffix .%.xml,$(basename $(firstword $1))) docbook-update-source-data.xsl
    1.23  	$$(XSLTPROC) \
    1.24  	    --xinclude \
    1.25  	    --stringparam package $$(PACKAGE) \
    1.26 -	    --stringparam version $$(VERSION)\
    1.27 +	    --stringparam version $$(VERSION) \
    1.28  	    docbook-update-source-data.xsl $$< | \
    1.29  	    $$(XSLTPROC) \
    1.30  	    --xinclude \
    1.31 +	    --output $(firstword $1) \
    1.32  	    $$(DOCBOOK5_MANPAGES_FLAGS) \
    1.33 -	    --output $$@ \
    1.34  	    $$(DOCBOOK5_MANPAGES_STYLESHEET) \
    1.35  	    -
    1.36 +	for alias in $(wordlist 2,$(words $1),$1); do \
    1.37 +	    ln -sf $(notdir $(firstword $1)) $$$$alias; \
    1.38 +	done
    1.39  endef
    1.40  
    1.41  DESTDIR ?=
    1.42 @@ -81,9 +88,8 @@
    1.43  endif
    1.44  
    1.45  OBJS =		sencrypt.o
    1.46 +
    1.47  MANPAGES =	$(PACKAGE).1 $(DECRYPT_ALIAS).1
    1.48 -DOCBOOK5_MANPAGES_FLAGS =	--stringparam man.authors.section.enabled 0 \
    1.49 -				--stringparam man.copyright.section.enabled 0
    1.50  
    1.51  .DEFAULT_TARGET = all
    1.52  
    1.53 @@ -103,7 +109,7 @@
    1.54  $(PACKAGE): $(OBJS)
    1.55  	$(LINK.o) $^ $(LDLIBS) -o $@
    1.56  
    1.57 -$(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
    1.58 +$(eval $(call generate-manpage-rule,$(MANPAGES)))
    1.59  
    1.60  %.o: %.c
    1.61  	$(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
    1.62 @@ -113,8 +119,13 @@
    1.63  	$(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
    1.64  	ln -f $(PACKAGE) "$(DESTDIR)$(bindir)/$(DECRYPT_ALIAS)"
    1.65  	for manpage in $(MANPAGES); do \
    1.66 -	    $(INSTALL.data) $${manpage} \
    1.67 -	        "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
    1.68 +	    if [ -L $${manpage} ]; then \
    1.69 +	        $(INSTALL.link) $${manpage} \
    1.70 +	            "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
    1.71 +	    else \
    1.72 +	        $(INSTALL.data) $${manpage} \
    1.73 +	            "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
    1.74 +	    fi \
    1.75  	done
    1.76  
    1.77  clean: