summaryrefslogtreecommitdiff
path: root/doc/CMakeLists.txt
blob: 070357034166942a193e040273b01a59a59c0aac (plain)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
#######
# @licence make begin@
# SPDX license identifier: MPL-2.0
#
# Copyright (C) 2011-2015, BMW AG
#
# This file is part of GENIVI Project DLT - Diagnostic Log and Trace.
#
# This Source Code Form is subject to the terms of the
# Mozilla Public License (MPL), v. 2.0.
# If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# For further information see http://www.genivi.org/.
# @licence end@
#######

if(WITH_DOC)
    find_package(Doxygen)

    configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen.cfg.cmake ${CMAKE_BINARY_DIR}/doc/doxygen.cfg @ONLY)

	add_custom_target (doc ALL
  		COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_BINARY_DIR}/doc/doxygen.cfg
  		WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
	)

	add_custom_target (doc-manuals ALL
		COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc/manuals
		COMMAND mkdir -p ${CMAKE_BINARY_DIR}/doc/manuals/images
		COMMAND cp ${CMAKE_SOURCE_DIR}/doc/images/* ${CMAKE_BINARY_DIR}/doc/manuals/images
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/INSTALL.html ${CMAKE_SOURCE_DIR}/INSTALL
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/README.html ${CMAKE_SOURCE_DIR}/README.md
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/ReleaseNotes.html ${CMAKE_SOURCE_DIR}/ReleaseNotes.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_user_manual.html ${CMAKE_SOURCE_DIR}/doc/dlt_user_manual.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_cheatsheet.html ${CMAKE_SOURCE_DIR}/doc/dlt_cheatsheet.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_design_specification.html ${CMAKE_SOURCE_DIR}/doc/dlt_design_specification.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_filetransfer.html ${CMAKE_SOURCE_DIR}/doc/dlt_filetransfer.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt-daemon.1.html ${CMAKE_SOURCE_DIR}/doc/dlt-daemon.1.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt-system.1.html ${CMAKE_SOURCE_DIR}/doc/dlt-system.1.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt-receive.1.html ${CMAKE_SOURCE_DIR}/doc/dlt-receive.1.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt-convert.1.html ${CMAKE_SOURCE_DIR}/doc/dlt-convert.1.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt-sortbytimestamp.1.html ${CMAKE_SOURCE_DIR}/doc/dlt-sortbytimestamp.1.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt.conf.5.html ${CMAKE_SOURCE_DIR}/doc/dlt.conf.5.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt-system.conf.5.html ${CMAKE_SOURCE_DIR}/doc/dlt-system.conf.5.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_book.html ${CMAKE_SOURCE_DIR}/doc/dlt_book.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_extended_network_trace.html ${CMAKE_SOURCE_DIR}/doc/dlt_extended_network_trace.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_howto_debug.html ${CMAKE_SOURCE_DIR}/doc/dlt_howto_debug.txt
  		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_offline_logstorage.html ${CMAKE_SOURCE_DIR}/doc/dlt_offline_logstorage.txt
        COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt_multinode.html ${CMAKE_SOURCE_DIR}/doc/dlt_multinode.txt
		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt-kpi.html ${CMAKE_SOURCE_DIR}/doc/dlt_kpi.txt
		COMMAND asciidoc -a TOC1 -o ${CMAKE_BINARY_DIR}/doc/manuals/dlt-cdh.html ${CMAKE_SOURCE_DIR}/doc/dlt_cdh.txt
  		WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
	)

	add_custom_target (doc-man
  		WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/doc
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt-daemon.1.txt
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt-system.1.txt
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt-receive.1.txt
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt-convert.1.txt
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt-sortbytimestamp.1.txt
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt.conf.5.txt
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt-system.conf.5.txt
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt-logstorage-ctrl.1.txt
		COMMAND a2x --doctype manpage --format manpage ${CMAKE_SOURCE_DIR}/doc/dlt-passive-node-ctrl.1.txt
	)

endif(WITH_DOC)

if(WITH_MAN)
	# Compress the man pages and install to proper place
	FIND_PROGRAM(GZIP_TOOL
	             NAMES gzip
	             PATHS /bin
	                   /usr/bin
	                   /usr/local/bin)

	if(NOT GZIP_TOOL)
	  MESSAGE(FATAL_ERROR "Could not find gzip for man page compression.")
	endif(NOT GZIP_TOOL)

	FIND_PROGRAM(PANDOC_TOOL
				 NAMES pandoc
				 PATHS /bin
					   /usr/bin
					   /usr/local/bin)


    if(NOT PANDOC_TOOL)
      MESSAGE(FATAL_ERROR "Could not find pandoc for man page generation.")
    endif(NOT PANDOC_TOOL)

	set(MAN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
	set(MAN_BUILD_DIR ${CMAKE_BINARY_DIR}/doc)

	set(MD_SRC
				${MAN_SRC_DIR}/dlt.conf.5.md
				${MAN_SRC_DIR}/dlt-system.conf.5.md
				${MAN_SRC_DIR}/dlt-convert.1.md
				${MAN_SRC_DIR}/dlt-sortbytimestamp.1.md
				${MAN_SRC_DIR}/dlt-daemon.1.md
				${MAN_SRC_DIR}/dlt-receive.1.md
				${MAN_SRC_DIR}/dlt-system.1.md
				${MAN_SRC_DIR}/dlt-logstorage-ctrl.1.md
				${MAN_SRC_DIR}/dlt-passive-node-ctrl.1.md)
	set(MAN_SRC
				${MAN_SRC_DIR}/dlt.conf.5
				${MAN_SRC_DIR}/dlt-system.conf.5
				${MAN_SRC_DIR}/dlt-convert.1
				${MAN_SRC_DIR}/dlt-sortbytimestamp.1
				${MAN_SRC_DIR}/dlt-daemon.1
				${MAN_SRC_DIR}/dlt-receive.1
				${MAN_SRC_DIR}/dlt-system.1
				${MAN_SRC_DIR}/dlt-logstorage-ctrl.1
				${MAN_SRC_DIR}/dlt-passive-node-ctrl.1)
	set(MAN_BUILD_SRC
				${MAN_BUILD_DIR}/dlt.conf.5
				${MAN_BUILD_DIR}/dlt-system.conf.5
				${MAN_BUILD_DIR}/dlt-convert.1
				${MAN_BUILD_DIR}/dlt-sortbytimestamp.1
				${MAN_BUILD_DIR}/dlt-daemon.1
				${MAN_BUILD_DIR}/dlt-receive.1
				${MAN_BUILD_DIR}/dlt-system.1
				${MAN_BUILD_DIR}/dlt-logstorage-ctrl.1
				${MAN_BUILD_DIR}/dlt-passive-node-ctrl.1)
	set(MAN_BUILD_GZ
				${MAN_BUILD_DIR}/dlt.conf.5.gz
				${MAN_BUILD_DIR}/dlt-system.conf.5.gz
				${MAN_BUILD_DIR}/dlt-convert.1.gz
				${MAN_BUILD_DIR}/dlt-sortbytimestamp.1.gz
				${MAN_BUILD_DIR}/dlt-daemon.1.gz
				${MAN_BUILD_DIR}/dlt-receive.1.gz
				${MAN_BUILD_DIR}/dlt-system.1.gz
				${MAN_BUILD_DIR}/dlt-logstorage-ctrl.1.gz
				${MAN_BUILD_DIR}/dlt-passive-node-ctrl.1.gz)

	add_custom_target(generate_man ALL
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt.conf.5.md -o ${MAN_BUILD_DIR}/dlt.conf.5
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt-system.conf.5.md -o ${MAN_BUILD_DIR}/dlt-system.conf.5
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt-convert.1.md -o ${MAN_BUILD_DIR}/dlt-convert.1
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt-sortbytimestamp.1.md -o ${MAN_BUILD_DIR}/dlt-sortbytimestamp.1
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt-daemon.1.md -o ${MAN_BUILD_DIR}/dlt-daemon.1
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt-receive.1.md -o ${MAN_BUILD_DIR}/dlt-receive.1
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt-system.1.md -o ${MAN_BUILD_DIR}/dlt-system.1
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt-logstorage-ctrl.1.md -o ${MAN_BUILD_DIR}/dlt-logstorage-ctrl.1
				COMMAND ${PANDOC_TOOL} -s -t man ${MAN_SRC_DIR}/dlt-passive-node-ctrl.1.md -o ${MAN_BUILD_DIR}/dlt-passive-node-ctrl.1

				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt.conf.5 > ${MAN_BUILD_DIR}/dlt.conf.5.gz
				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt-system.conf.5 > ${MAN_BUILD_DIR}/dlt-system.conf.5.gz
				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt-convert.1  > ${MAN_BUILD_DIR}/dlt-convert.1.gz
				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt-sortbytimestamp.1  > ${MAN_BUILD_DIR}/dlt-sortbytimestamp.1.gz
				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt-daemon.1 > ${MAN_BUILD_DIR}/dlt-daemon.1.gz
				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt-receive.1 > ${MAN_BUILD_DIR}/dlt-receive.1.gz
				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt-system.1 > ${MAN_BUILD_DIR}/dlt-system.1.gz
				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt-logstorage-ctrl.1 > ${MAN_BUILD_DIR}/dlt-logstorage-ctrl.1.gz
				COMMAND ${GZIP_TOOL} -c ${MAN_BUILD_DIR}/dlt-passive-node-ctrl.1 > ${MAN_BUILD_DIR}/dlt-passive-node-ctrl.1.gz)

	# If user has not set the base dir for man pages, use a default location
	set(MAN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/man)

	install(FILES
			${MAN_BUILD_DIR}/dlt.conf.5.gz
			${MAN_BUILD_DIR}/dlt-system.conf.5.gz
		DESTINATION ${MAN_INSTALL_DIR}/man5
	)

	install(FILES
			${MAN_BUILD_DIR}/dlt-convert.1.gz
			${MAN_BUILD_DIR}/dlt-sortbytimestamp.1.gz
			${MAN_BUILD_DIR}/dlt-daemon.1.gz
			${MAN_BUILD_DIR}/dlt-receive.1.gz
			${MAN_BUILD_DIR}/dlt-system.1.gz
			${MAN_BUILD_DIR}/dlt-logstorage-ctrl.1.gz
			${MAN_BUILD_DIR}/dlt-passive-node-ctrl.1.gz
		DESTINATION ${MAN_INSTALL_DIR}/man1
	)
endif(WITH_MAN)