-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
77 lines (64 loc) · 2.6 KB
/
Copy pathMakefile
File metadata and controls
77 lines (64 loc) · 2.6 KB
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
# zh/10/Makefile
REPO_ROOT := $(abspath $(CURDIR)/../..)
DOC_VERSION := $(notdir $(CURDIR))
PG_VERSION ?= 10.23
# Fixed official release package for this archive reconstruction.
PGDOC_SOURCE_ARCHIVE ?= $(REPO_ROOT)/.cache/upstream/postgresql-10.23.tar.bz2
PGDOC_SOURCE_SHA256 ?= 94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9
export PGDOC_SOURCE_ARCHIVE PGDOC_SOURCE_SHA256
# PG10 uses DocBook SGML 4.2 and OpenSP before the shared XML/XSL pipeline.
PGDOC_SGML_DEPS := $(REPO_ROOT)/deps/sgml
OSX ?= osx
NSGMLS ?= onsgmls
SGML_CATALOG_FILES ?= $(PGDOC_SGML_DEPS)/sgml-unicode.catalog
SP_ENCODING ?= UTF-8
SP_CHARSET_FIXED ?= YES
export OSX NSGMLS SGML_CATALOG_FILES SP_ENCODING SP_CHARSET_FIXED
DOC_LANG := $(notdir $(abspath $(CURDIR)/..))
BUILD_SCRIPT := $(REPO_ROOT)/bin/build_standalone_docsrc.sh
PDF_SCRIPT := $(REPO_ROOT)/bin/build_standalone_pdfsrc.sh
DEFAULT_BUILD_OUT := $(CURDIR)/html
BUILD_OUT ?= $(DEFAULT_BUILD_OUT)
PAPER ?= A4
PDF_OUT ?= $(REPO_ROOT)/tmp/pdf/$(DOC_LANG)/postgresql-$(DOC_VERSION)-$(DOC_LANG)-$(PAPER).pdf
PYTHON ?= python3
HOST ?= 127.0.0.1
PORT ?= 8000
# Files generated during build (not checked into repo)
GENERATED_FILES := version.sgml pgdoccn-notes.sgml postgres-full.xml
.PHONY: all html pdf clean clean-pdf distclean s serve check-deps show-config
all: html
html:
@"$(BUILD_SCRIPT)" "$(CURDIR)" "$(DOC_LANG)" "$(PG_VERSION)" "$(BUILD_OUT)"
pdf:
@"$(PDF_SCRIPT)" "$(CURDIR)" "$(DOC_LANG)" "$(PG_VERSION)" "$(PDF_OUT)" "$(PAPER)"
distclean: clean clean-pdf
s: serve
serve:
@echo "Serving $(BUILD_OUT) at http://$(HOST):$(PORT)/"
@cd "$(BUILD_OUT)" && "$(PYTHON)" -m http.server "$(PORT)" --bind "$(HOST)"
c: clean
clean:
rm -rf "$(BUILD_OUT)"
clean-pdf:
rm -f "$(PDF_OUT)"
check-deps:
@echo "Checking build dependencies ..."
@command -v xmllint >/dev/null 2>&1 || { echo "MISSING: xmllint (brew install libxml2)"; exit 1; }
@command -v xsltproc >/dev/null 2>&1 || { echo "MISSING: xsltproc (brew install libxslt)"; exit 1; }
@command -v rsync >/dev/null 2>&1 || { echo "MISSING: rsync"; exit 1; }
@command -v java >/dev/null 2>&1 || { echo "MISSING: java"; exit 1; }
@command -v fc-match >/dev/null 2>&1 || { echo "MISSING: fc-match (brew install fontconfig)"; exit 1; }
@echo "All dependencies found."
show-config:
@echo "doc_dir=$(CURDIR)"
@echo "lang=$(DOC_LANG)"
@echo "version=$(DOC_VERSION)"
@echo "pg_version=$(PG_VERSION)"
@echo "pgdoc_source_archive=$(PGDOC_SOURCE_ARCHIVE)"
@echo "pgdoc_source_sha256=$(PGDOC_SOURCE_SHA256)"
@echo "build_out=$(BUILD_OUT)"
@echo "pdf_out=$(PDF_OUT)"
@echo "paper=$(PAPER)"
@echo "host=$(HOST)"
@echo "port=$(PORT)"