• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# SPDX-License-Identifier: GPL-2.0-or-later
2# Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
3# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>
4
5top_srcdir		?= ..
6
7include $(top_srcdir)/include/mk/env_pre.mk
8include $(top_srcdir)/include/mk/functions.mk
9
10ifeq ($(METADATA_GENERATOR),asciidoctor)
11METADATA_GENERATOR_CMD := asciidoctor
12METADATA_GENERATOR_PARAMS := -d book metadata.txt
13METADATA_GENERATOR_PARAMS_HTML := -b xhtml
14METADATA_GENERATOR_PARAMS_PDF := -b pdf -r asciidoctor-pdf
15else ifeq ($(METADATA_GENERATOR),asciidoc)
16METADATA_GENERATOR_CMD := a2x
17METADATA_GENERATOR_PARAMS := --xsltproc-opts "--stringparam toc.section.depth 1" -d book -L  --resource="$(PWD)" metadata.txt
18METADATA_GENERATOR_PARAMS_HTML := -f xhtml
19METADATA_GENERATOR_PARAMS_PDF := -f pdf
20METADATA_GENERATOR_PARAMS_HTML_CHUNKED := -f chunked
21else ifeq ($(METADATA_GENERATOR),)
22$(error 'METADATA_GENERATOR' not not configured, run ./configure in the root directory)
23else
24$(error '$(METADATA_GENERATOR)' not supported, only asciidoctor and asciidoc are supported)
25endif
26
27ifdef VERBOSE
28METADATA_GENERATOR_PARAMS += -v
29endif
30
31CLEAN_TARGETS		:= *.css *.js *.txt
32
33ifeq ($(WITH_METADATA_HTML),yes)
34MAKE_TARGETS		+= metadata.html
35ifneq ($(METADATA_GENERATOR_PARAMS_HTML_CHUNKED),)
36MAKE_TARGETS		+= metadata.chunked
37endif
38endif
39
40ifeq ($(WITH_METADATA_PDF),yes)
41MAKE_TARGETS		+= metadata.pdf
42endif
43
44INSTALL_DIR = metadata
45INSTALL_TARGETS = *.css *.js
46
47ifndef METADATA_GENERATOR
48METADATA_GENERATOR := asciidoctor
49endif
50
51txt: ${abs_top_builddir}/metadata/ltp.json
52	$(abs_srcdir)/testinfo.pl $<
53
54ifeq ($(WITH_METADATA_HTML),yes)
55metadata.html: txt
56	$(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_HTML)
57
58ifneq ($(METADATA_GENERATOR_PARAMS_HTML_CHUNKED),)
59metadata.chunked: txt
60	$(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_HTML_CHUNKED)
61endif
62endif
63
64ifeq ($(WITH_METADATA_PDF),yes)
65metadata.pdf: txt
66	$(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_PDF)
67endif
68
69include $(top_srcdir)/include/mk/generic_leaf_target.mk
70