Skip to content
Snippets Groups Projects
Makefile.documentation 3.39 KiB
##########################################################################
#                                                                        #
#  This file is part of Frama-C.                                         #
#                                                                        #
#  Copyright (C) 2007-2024                                               #
#    CEA (Commissariat à l'énergie atomique et aux énergies              #
#         alternatives)                                                  #
#                                                                        #
#  you can redistribute it and/or modify it under the terms of the GNU   #
#  Lesser General Public License as published by the Free Software       #
#  Foundation, version 2.1.                                              #
#                                                                        #
#  It is distributed in the hope that it will be useful,                 #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of        #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         #
#  GNU Lesser General Public License for more details.                   #
#                                                                        #
#  See the GNU Lesser General Public License version 2.1                 #
#  for more details (enclosed in the file licenses/LGPLv2.1).            #
#                                                                        #
##########################################################################

##########################################################################
#                                                                        #
# Frama-C Documentation targets                                          #
#                                                                        #
##########################################################################

.PHONY: doc

doc:
	dune build @doc
	@echo "Generated Documentation:"
	@echo "   file:///$(PWD)/_build/default/_doc/_html/index.html"

ifneq (${DOCDIR},)

install:: doc
	@mkdir -p ${DOCDIR}/frama-c
	@cp -r _build/default/_doc/_html/* ${DOCDIR}/frama-c

endif

##########################################################################
#                                                                        #
# Generate Documentation for Server Requests and Protocols.              #
#                                                                        #
##########################################################################

.PHONY: server-doc-md server-doc-html server-doc

ifeq (${NO_BUILD_FRAMAC},yes)
# Make sure that Frama-C is not rebuilt essentially for CI purpose
server-doc-md:
else
server-doc-md: all
endif
	$(PRINT) 'Generating Markdown server documentation'
	@rm -fr doc/server
	@mkdir -p doc/server
	./bin/frama-c -server-doc doc/server

server-doc-html: server-doc-md
	$(PRINT) 'Generating HTML server documentation'
	@find doc/server -name "*.md" -print -exec pandoc \
			--standalone --toc --toc-depth=2 --to html \
			--template doc/pandoc/template.html \
			--metadata-file {}.json \
			--lua-filter doc/pandoc/href.lua \
			{} -o {}.html \;
	@cp -f doc/pandoc/style.css doc/server/
	$(PRINT) 'Server Documentation Generated'
	$(PRINT) '  file://$(PWD)/doc/server/readme.md.html'

server-doc: server-doc-html

##########################################################################