UpdateBuildDocs.gmk revision 2530:cda60babd152
1# 2# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4# 5# This code is free software; you can redistribute it and/or modify it 6# under the terms of the GNU General Public License version 2 only, as 7# published by the Free Software Foundation. Oracle designates this 8# particular file as subject to the "Classpath" exception as provided 9# by Oracle in the LICENSE file that accompanied this code. 10# 11# This code is distributed in the hope that it will be useful, but WITHOUT 12# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14# version 2 for more details (a copy is included in the LICENSE file that 15# accompanied this code). 16# 17# You should have received a copy of the GNU General Public License version 18# 2 along with this work; if not, write to the Free Software Foundation, 19# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20# 21# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22# or visit www.oracle.com if you need additional information or have any 23# questions. 24# 25 26default: all 27 28include $(SPEC) 29include MakeBase.gmk 30 31################################################################################ 32# This makefile updates the generated build html documentation. 33# 34################################################################################ 35 36ifeq ($(PANDOC), ) 37 $(info No pandoc executable was detected by configure) 38 $(error Cannot continue) 39endif 40 41################################################################################ 42# Setup make rules for converting a markdown file to html. 43# 44# Parameter 1 is the name of the rule. This name is used as variable prefix, 45# and the targets generated are listed in a variable by that name. 46# 47# Remaining parameters are named arguments. These include: 48# SOURCE_FILE The markdown source file 49# TARGET_DIR The directory where to store the generated html file 50# 51SetupMarkdownToHtml = $(NamedParamsMacroTemplate) 52define SetupMarkdownToHtmlBody 53 ifeq ($$($1_SOURCE_FILE), ) 54 $$(error SOURCE_FILE is missing in SetupMarkdownToHtml $1) 55 endif 56 57 ifeq ($$($1_TARGET_DIR), ) 58 $$(error TARGET_DIR is missing in SetupMarkdownToHtml $1) 59 endif 60 61 $1_BASENAME := $$(notdir $$(basename $$($1_SOURCE_FILE))) 62 $1_OUTPUT_FILE := $$($1_TARGET_DIR)/$$($1_BASENAME).html 63 64$$($1_OUTPUT_FILE): $$($1_SOURCE_FILE) 65 $$(call LogInfo, Converting $$(notdir $1) to html) 66 $$(call MakeDir, $$($1_TARGET_DIR) $$(MAKESUPPORT_OUTPUTDIR)/markdown) 67 $$(call ExecuteWithLog, $$(MAKESUPPORT_OUTPUTDIR)/markdown/$1, \ 68 $$(PANDOC) -f markdown -t html --standalone '$$<' -o '$$@') 69 TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` ; \ 70 if [ "x$$TOO_LONG_LINES" != x ]; then \ 71 $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \ 72 $$(ECHO) "The following lines are longer than 80 characters:" ; \ 73 $$(GREP) -E -e '^.{80}.+$$$$' $$< ; \ 74 fi 75 76 $1 := $$($1_OUTPUT_FILE) 77 78 TARGETS += $$($1) 79endef 80 81################################################################################ 82 83BUILD_DOCS_DIR := $(TOPDIR)/common/doc 84BUILD_DOCS_MD_FILE := building.md 85 86$(eval $(call SetupMarkdownToHtml, building, \ 87 SOURCE_FILE := $(BUILD_DOCS_DIR)/$(BUILD_DOCS_MD_FILE), \ 88 TARGET_DIR := $(BUILD_DOCS_DIR), \ 89)) 90 91################################################################################ 92 93$(eval $(call IncludeCustomExtension, , UpdateBuildDocs.gmk)) 94 95################################################################################ 96 97all: $(TARGETS) 98 99.PHONY: all default 100