mirror of
https://git.FreeBSD.org/doc.git
synced 2026-06-02 19:35:07 +00:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
+7
-1
@@ -18,6 +18,12 @@ MAINTAINER=carlavilla@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}
|
||||
|
||||
Reference in New Issue
Block a user