[go: up one dir, main page]

File: man.mk

package info (click to toggle)
daps 3.3.2%2Bcleaned1-6.1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,484 kB
  • sloc: xml: 9,773; sh: 3,059; python: 1,322; lisp: 380; makefile: 240
file content (68 lines) | stat: -rw-r--r-- 2,167 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright (C) 2012-2020 SUSE Software Solutions Germany GmbH
#
# Author:
# Frank Sundermeyer <fsundermeyer at opensuse dot org>
#
# ASCII generation for DAPS
#
# Please submit feedback or patches to
# <fsundermeyer at opensuse dot org>
#

# includes are set in selector.mk
# include $(DAPSROOT)/make/setfiles.mk
# include $(DAPSROOT)/make/profiling.mk
# include $(DAPSROOT)/make/validate.mk
# include $(DAPSROOT)/make/misc.mk
#

STYLEMAN      := $(firstword $(wildcard $(addsuffix \
			/manpages/docbook.xsl, $(STYLE_ROOTDIRS))))

MANSTRINGS := --stringparam "man.output.base.dir=$(MAN_DIR)/" \
	      --param "refentry.meta.get.quietly=1" \
	      --param "man.output.in.separate.dir=1"

ifeq "$(MAN_SUBDIRS)" "yes"
  MANSTRINGS  += --param "man.output.subdirs.enabled=1"
else
  MANSTRINGS  += --param "man.output.subdirs.enabled=0"
endif

MAN_RESULTS = $(shell $(XSLTPROC) $(MANSTRINGS) $(PARAMS) $(STRINGPARAMS) \
		 $(XSLTPARAM) \
	         --stylesheet $(DAPSROOT)/daps-xslt/common/get-manpage-filename.xsl \
		 --file $(BIGFILE) $(XSLTPROCESSOR) 2>/dev/null)

#--------------
# MAN pages
#
# No need to do a file based generation of the man pages - $STYLEMAN
# generates all of them in one go
#
# The check on $MAN_RESULTS cannot be performed by make itself, because this
# variable is evaluated late. Therefore we test it within the recipe
#
.PHONY: man
man: | $(MAN_DIR)
man: $(PROFILES) $(PROFILEDIR)/.validate
man: $(BIGFILE)
        # only checking firstword, because if $MAN_RESULTS is very long,
        # the test expression will throw an error
	if [ -z $(firstword $(MAN_RESULTS)) ]; then \
	  ccecho "error" "Fatal error: Cannot create man pages, because the XML sources do not\ncontain refentry sections which define man pages." && false; \
	else \
	  $(XSLTPROC) $(ROOTSTRING) $(MANSTRINGS) $(DAPSSTRINGS) \
	    $(XSLTPARAM) $(PARAMS) $(STRINGPARAMS) --stylesheet $(STYLEMAN) \
	    --file $< $(XSLTPROCESSOR) $(ERR_DEVNULL); \
	fi
  ifneq "$(GZIP_MAN)" "no"
	for MANFILE in $$(find $(MAN_DIR) ! -name "*.gz" -type f); do \
	  gzip -f $$MANFILE; \
	done
  endif
	@ccecho "result" "Find the man page(s) at:\n$(MAN_DIR)"


$(MAN_DIR):
	mkdir -p $@