git: 989bbd57fa - main - Makefiles: Add a conditional check on HOSTNAME variable
Daniel Ebdrup Jensen
debdrup at FreeBSD.org
Sun Feb 14 21:51:48 UTC 2021
The branch main has been updated by debdrup:
URL: https://cgit.FreeBSD.org/doc/commit/?id=989bbd57fa03b4efe7d920aeadeb0952c5960dda
commit 989bbd57fa03b4efe7d920aeadeb0952c5960dda
Author: Daniel Ebdrup Jensen <debdrup at FreeBSD.org>
AuthorDate: 2021-02-14 21:39:20 +0000
Commit: Daniel Ebdrup Jensen <debdrup at FreeBSD.org>
CommitDate: 2021-02-14 21:50:52 +0000
Makefiles: Add a conditional check on HOSTNAME variable
In order for hugo to build all links correctly, it is necessary to
define baseURL - but in order to do this, we need some way of adding a
hostname. This change adds the HOSTNAME variable to accomplish this.
Another advantage is that if HOSTNAME is set to something other than
localhost, hugo can be run on a different (more powerful) machine which
can shorten the time it takes to build.
A note about this will need to be added to the FDP later.
---
documentation/Makefile | 8 +++++++-
website/Makefile | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/documentation/Makefile b/documentation/Makefile
index 57472063dd..3b5c1cfd65 100644
--- a/documentation/Makefile
+++ b/documentation/Makefile
@@ -19,6 +19,12 @@ PYTHON_CMD = /usr/local/bin/python3.7
HUGO_CMD = /usr/local/bin/hugo
LANGUAGES = en,es,pt-br,de,ja,zh-cn,zh-tw,ru,el,hu,it,mn,nl,pl,fr
+.ifndef HOSTNAME
+.HOST+=localhost
+.else
+.HOST+=$(HOSTNAME)
+.endif
+
.ORDER: all run
.ORDER: starting-message generate-books-toc
@@ -41,7 +47,7 @@ generate-books-toc: .PHONY
${PYTHON_CMD} ./tools/books-toc-examples-creator.py -l ${LANGUAGES}
run-local: .PHONY
- ${HUGO_CMD} server -D
+ ${HUGO_CMD} server -D --baseURL="http://$(.HOST):1313"
build: .PHONY
${HUGO_CMD} --minify
diff --git a/website/Makefile b/website/Makefile
index 6337692942..2294db8838 100644
--- a/website/Makefile
+++ b/website/Makefile
@@ -18,6 +18,12 @@ MAINTAINER=carlavilla at FreeBSD.org
PYTHON_CMD = /usr/local/bin/python3.7
HUGO_CMD = /usr/local/bin/hugo
+.ifndef HOSTNAME
+.HOST+=localhost
+.else
+.HOST+=$(HOSTNAME)
+.endif
+
.ORDER: all run
.ORDER: starting-message generate-releases
@@ -36,7 +42,7 @@ generate-releases: .PHONY
${PYTHON_CMD} ./tools/releases-toml.py -p ./shared/releases.adoc
run-local: .PHONY
- ${HUGO_CMD} server -D
+ ${HUGO_CMD} server -D --baseURL="http://$(.HOST):1313"
build: .PHONY
${HUGO_CMD}
More information about the dev-commits-doc-all
mailing list