comparison Makefile @ 1:f0ceb0ad20e7 version-1

Add manpage
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Thu, 30 Jan 2014 00:00:13 +0100
parents 73af139d1a94
children 112d55c825b4
comparison
equal deleted inserted replaced
0:73af139d1a94 1:f0ceb0ad20e7
39 INSTALL.exec := $(INSTALL) -D -m 0755 39 INSTALL.exec := $(INSTALL) -D -m 0755
40 INSTALL.data := $(INSTALL) -D -m 0644 40 INSTALL.data := $(INSTALL) -D -m 0644
41 PAX := pax 41 PAX := pax
42 GZIP := gzip 42 GZIP := gzip
43 SED := sed 43 SED := sed
44 XSLTPROC := xsltproc
45 DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl
46
47 define generate-manpage-rule =
48 %.$(1): %.$(1).xml
49 $$(XSLTPROC) \
50 --xinclude \
51 --stringparam package $$(PACKAGE) \
52 --stringparam version $$(VERSION)\
53 docbook-update-source-data.xsl $$< | \
54 $$(XSLTPROC) \
55 --xinclude \
56 $$(DOCBOOK5_MANPAGES_FLAGS) \
57 --output $$@ \
58 $$(DOCBOOK5_MANPAGES_STYLESHEET) \
59 -
60 endef
44 61
45 DESTDIR ?= 62 DESTDIR ?=
46 prefix ?= /usr/local 63 prefix ?= /usr/local
47 bindir ?= $(prefix)/bin 64 bindir ?= $(prefix)/bin
48 datadir ?= $(prefix)/share 65 datadir ?= $(prefix)/share
66 mandir ?= $(datadir)/man
49 67
50 HAVE_ERR_H ?= 1 68 HAVE_ERR_H ?= 1
51 69
52 OBJS = sencrypt.o 70 OBJS = sencrypt.o
71 MANPAGES = $(PACKAGE).1 $(DECRYPT_ALIAS).1
72 DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \
73 --stringparam man.copyright.section.enabled 0
53 74
54 ifeq ($(HAVE_ERR_H),0) 75 ifeq ($(HAVE_ERR_H),0)
55 OBJS += err.o 76 OBJS += err.o
56 endif 77 endif
57 78
58 .DEFAULT_TARGET = all 79 .DEFAULT_TARGET = all
59 80
60 .PHONY: all clean clobber dist install 81 .PHONY: all clean clobber dist install
61 82
62 all: $(PACKAGE) 83 all: $(PACKAGE) $(MANPAGES)
63 84
64 $(PACKAGE): XCPPFLAGS := -DOPENSSL_LOAD_CONF 85 $(PACKAGE): XCPPFLAGS := -DOPENSSL_LOAD_CONF
65 ifeq ($(HAVE_ERR_H),1) 86 ifeq ($(HAVE_ERR_H),1)
66 $(PACKAGE): XCPPFLAGS += -DHAVE_ERR_H 87 $(PACKAGE): XCPPFLAGS += -DHAVE_ERR_H
67 endif 88 endif
69 $(PACKAGE): LDLIBS := -lcrypto 90 $(PACKAGE): LDLIBS := -lcrypto
70 $(PACKAGE): XLDFLAGS := $(shell getconf LFS_LDFLAGS) 91 $(PACKAGE): XLDFLAGS := $(shell getconf LFS_LDFLAGS)
71 $(PACKAGE): $(OBJS) 92 $(PACKAGE): $(OBJS)
72 $(LINK.o) $^ $(LDLIBS) -o $@ 93 $(LINK.o) $^ $(LDLIBS) -o $@
73 94
95 $(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section))))
96
74 %.o: %.c 97 %.o: %.c
75 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d 98 $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d
76 $(COMPILE.c) -o $@ $< 99 $(COMPILE.c) -o $@ $<
77 100
78 install: 101 install:
79 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)" 102 $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)"
80 ln -f $(PACKAGE) "$(DESTDIR)$(bindir)/$(DECRYPT_ALIAS)" 103 ln -f $(PACKAGE) "$(DESTDIR)$(bindir)/$(DECRYPT_ALIAS)"
104 for manpage in $(MANPAGES); do \
105 $(INSTALL.data) $${manpage} \
106 "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \
107 done
81 108
82 clean: 109 clean:
83 rm -f $(PACKAGE) $(OBJS) 110 rm -f $(PACKAGE) $(OBJS) $(MANPAGES)
84 111
85 clobber: clean 112 clobber: clean
86 rm -f $(patsubst %.o,%.d,$(OBJS)) 113 rm -f $(patsubst %.o,%.d,$(OBJS))
87 114
88 dist: clobber 115 dist: clobber