sigs.k8s.io/cluster-api@v1.7.1/docs/book/Makefile (about)

     1  # Copyright 2019 The Kubernetes Authors.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  # Directories.
    16  ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
    17  TOOLS_DIR := $(realpath ../../hack/tools)
    18  TOOLS_BIN_DIR := $(TOOLS_DIR)/bin
    19  BIN_DIR := bin
    20  MDBOOK_INSTALL := $(realpath ../../scripts/ci-install-mdbook.sh)
    21  
    22  export PATH := $(TOOLS_BIN_DIR):$(PATH)
    23  
    24  # Binaries.
    25  TABULATE := $(TOOLS_BIN_DIR)/mdbook-tabulate
    26  $(TABULATE): $(TOOLS_DIR)/go.mod
    27  	cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/mdbook-tabulate ./mdbook/tabulate
    28  
    29  EMBED := $(TOOLS_BIN_DIR)/mdbook-embed
    30  $(EMBED): $(TOOLS_DIR)/go.mod
    31  	cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/mdbook-embed ./mdbook/embed
    32  
    33  RELEASELINK := $(TOOLS_BIN_DIR)/mdbook-releaselink
    34  $(RELEASELINK): $(TOOLS_DIR)/go.mod
    35  	cd $(TOOLS_DIR); go build -tags=tools -o $(BIN_DIR)/mdbook-releaselink ./mdbook/releaselink
    36  
    37  # Only set MDBOOK if it's not set as an environment variable
    38  MDBOOK ?= $(TOOLS_BIN_DIR)/mdbook
    39  $(MDBOOK):
    40  	$(MDBOOK_INSTALL) v0.4.11 $(TOOLS_BIN_DIR)
    41  
    42  RUNTIME_OPENAPI_GEN_BIN := runtime-openapi-gen
    43  RUNTIME_OPENAPI_GEN := $(abspath $(TOOLS_BIN_DIR)/$(RUNTIME_OPENAPI_GEN_BIN))
    44  
    45  runtimesdk-yaml:
    46  	$(MAKE) -C $(ROOT_DIR)/../../ $(RUNTIME_OPENAPI_GEN_BIN)
    47  	$(RUNTIME_OPENAPI_GEN) --version book --output-file ./src/tasks/experimental-features/runtime-sdk/runtime-sdk-openapi.yaml
    48  
    49  BOOK_DEPS := runtimesdk-yaml
    50  
    51  .PHONY: serve
    52  serve: $(MDBOOK) $(TABULATE) $(EMBED) $(RELEASELINK) runtimesdk-yaml
    53  	$(MDBOOK) serve
    54  
    55  .PHONY: build
    56  build: $(MDBOOK) $(TABULATE) $(EMBED) $(RELEASELINK) runtimesdk-yaml
    57  	$(MDBOOK) build