2021-01-26 00:31:29 +01:00
|
|
|
# Generate the FreeBSD website
|
|
|
|
|
#
|
2026-02-19 11:28:04 +01:00
|
|
|
# Copyright (c) 2020-2026, The FreeBSD Documentation Project
|
|
|
|
|
# Copyright (c) 2020-2026, Sergio Carlavilla <carlavilla@FreeBSD.org>
|
2021-01-26 00:31:29 +01:00
|
|
|
#
|
2026-05-21 10:58:05 -04:00
|
|
|
# Targets intended for use on the command line:
|
2021-01-26 00:31:29 +01:00
|
|
|
#
|
2026-05-21 10:58:05 -04:00
|
|
|
# all (default) - Generate releases.toml and compile the website.
|
|
|
|
|
# run - Serve the built website for local browsing.
|
2021-01-27 22:22:48 -06:00
|
|
|
#
|
2026-05-21 10:58:05 -04:00
|
|
|
# The run target uses hugo's built-in webserver to make the built
|
|
|
|
|
# website available for local browsing. The website should have been
|
|
|
|
|
# built prior to attempting to use the `run` target. By default, hugo
|
|
|
|
|
# will start its webserver on port 1313.
|
2021-01-26 00:31:29 +01:00
|
|
|
|
|
|
|
|
MAINTAINER=carlavilla@FreeBSD.org
|
|
|
|
|
|
2021-06-30 12:39:33 +01:00
|
|
|
# List of all languages we have content for
|
2025-11-27 19:20:39 +01:00
|
|
|
ALL_LANGUAGES= en ru zh-tw
|
2021-06-30 12:39:33 +01:00
|
|
|
|
2021-12-12 14:35:56 +01:00
|
|
|
LOCALBASE?= /usr/local
|
|
|
|
|
|
|
|
|
|
RUBY_CMD = ${LOCALBASE}/bin/ruby
|
|
|
|
|
HUGO_CMD = ${LOCALBASE}/bin/hugo
|
2023-01-20 21:57:44 -03:00
|
|
|
HUGO_ARGS?=
|
2021-03-31 20:44:54 +02:00
|
|
|
RUBYLIB = ../shared/lib
|
|
|
|
|
.export RUBYLIB
|
2021-01-26 00:31:29 +01:00
|
|
|
|
2021-02-14 22:39:20 +01:00
|
|
|
.ifndef HOSTNAME
|
2021-06-05 17:25:46 -03:00
|
|
|
. ifdef BIND
|
|
|
|
|
.HOST=$(BIND)
|
|
|
|
|
. else
|
|
|
|
|
.HOST=localhost
|
|
|
|
|
. endif
|
2021-02-14 22:39:20 +01:00
|
|
|
.else
|
2021-06-05 17:25:46 -03:00
|
|
|
.HOST=$(HOSTNAME)
|
2021-02-14 22:39:20 +01:00
|
|
|
.endif
|
|
|
|
|
|
2021-06-30 12:39:33 +01:00
|
|
|
.if defined(DOC_LANG) && !empty(DOC_LANG)
|
|
|
|
|
LANGUAGES= ${DOC_LANG:S/,/ /g}
|
|
|
|
|
.if ${LANGUAGES:Men} == ""
|
|
|
|
|
.warning "Warning: cannot skip 'en'; adding it back"
|
|
|
|
|
LANGUAGES+= en
|
|
|
|
|
.endif
|
|
|
|
|
.else
|
|
|
|
|
LANGUAGES= ${ALL_LANGUAGES}
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
|
|
# Take the list of all languages, and take out the ones we have been
|
2026-05-21 10:58:05 -04:00
|
|
|
# asked for via DOC_LANG. We'll feed this to hugo.
|
2021-06-30 12:39:33 +01:00
|
|
|
SKIP_LANGS=
|
|
|
|
|
.for a in ${ALL_LANGUAGES}
|
|
|
|
|
.if ${LANGUAGES:M${a}} == ""
|
|
|
|
|
SKIP_LANGS+= ${a}
|
|
|
|
|
.endif
|
|
|
|
|
.endfor
|
|
|
|
|
|
2021-01-27 22:22:48 -06:00
|
|
|
.ORDER: all run
|
|
|
|
|
|
2021-01-28 21:51:18 -06:00
|
|
|
.ORDER: starting-message generate-releases
|
2021-01-27 10:05:58 -06:00
|
|
|
.ORDER: starting-message build
|
2021-01-28 21:51:18 -06:00
|
|
|
.ORDER: generate-releases build
|
2021-05-25 06:33:48 +00:00
|
|
|
.ORDER: build post-build
|
|
|
|
|
.ORDER: post-build end-message
|
2021-01-27 10:05:58 -06:00
|
|
|
|
2022-03-22 21:18:32 -03:00
|
|
|
all: starting-message generate-releases cgi-pre-permissions build post-build end-message
|
|
|
|
|
run: starting-message generate-releases cgi-pre-permissions run-local
|
2021-06-29 09:57:30 +01:00
|
|
|
clean: hugo-clean releases-clean
|
2021-01-26 00:31:29 +01:00
|
|
|
|
2021-01-27 10:09:02 -06:00
|
|
|
starting-message: .PHONY
|
2021-05-25 06:33:48 +00:00
|
|
|
@echo "---------------------------------------------------------------"
|
|
|
|
|
@echo "Building the website started on $$(date)"
|
2021-06-30 12:39:33 +01:00
|
|
|
@echo " included languages: ${LANGUAGES}"
|
|
|
|
|
@echo " excluded languages: ${SKIP_LANGS}"
|
2021-05-25 06:33:48 +00:00
|
|
|
@echo "---------------------------------------------------------------"
|
|
|
|
|
|
|
|
|
|
end-message: .PHONY
|
|
|
|
|
@echo "---------------------------------------------------------------"
|
|
|
|
|
@echo "Building the website completed on $$(date)"
|
|
|
|
|
@echo "---------------------------------------------------------------"
|
2021-01-26 00:31:29 +01:00
|
|
|
|
2021-06-29 09:57:30 +01:00
|
|
|
generate-releases: data/releases.toml
|
|
|
|
|
|
|
|
|
|
data/releases.toml:
|
2021-12-12 14:35:56 +01:00
|
|
|
${RUBY_CMD} ./tools/releases-toml.rb
|
2021-01-26 00:31:29 +01:00
|
|
|
|
2021-02-13 20:04:10 +01:00
|
|
|
run-local: .PHONY
|
2021-06-30 12:39:33 +01:00
|
|
|
HUGO_DISABLELANGUAGES="${SKIP_LANGS}" ${HUGO_CMD} server \
|
|
|
|
|
${HUGO_ARGS} -D $(BIND:D--bind=$(BIND)) --baseURL="http://$(.HOST):1313"
|
2021-01-26 00:31:29 +01:00
|
|
|
|
2021-01-27 10:09:02 -06:00
|
|
|
build: .PHONY
|
2021-06-30 12:39:33 +01:00
|
|
|
HUGO_DISABLELANGUAGES="${SKIP_LANGS}" ${HUGO_CMD} ${HUGO_ARGS}
|
2021-05-25 06:33:48 +00:00
|
|
|
|
|
|
|
|
post-build: cgi-permissions
|
|
|
|
|
|
2022-03-22 21:18:32 -03:00
|
|
|
cgi-pre-permissions:
|
|
|
|
|
.if exists(./public/cgi)
|
|
|
|
|
@chmod 755 ./public/cgi/*.cgi
|
|
|
|
|
.endif
|
|
|
|
|
|
2021-05-25 06:33:48 +00:00
|
|
|
cgi-permissions:
|
|
|
|
|
@chmod 555 ./public/cgi/*.cgi
|
|
|
|
|
|
2021-06-29 09:57:30 +01:00
|
|
|
hugo-clean:
|
|
|
|
|
rm -fr public resources
|
|
|
|
|
|
|
|
|
|
releases-clean:
|
|
|
|
|
rm -f data/releases.toml
|
2021-12-26 19:54:18 +01:00
|
|
|
|
|
|
|
|
generate-release:
|
2024-03-17 03:45:18 -07:00
|
|
|
.if empty(RELEASE)
|
|
|
|
|
@echo "Specify a release. Example RELEASE=14.1"
|
|
|
|
|
.else
|
|
|
|
|
${HUGO_CMD} new --kind release releases/${RELEASE}R/
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
|
|
generate-hardware-notes:
|
2025-04-04 15:49:07 -07:00
|
|
|
.if empty(RELEASE) && empty(STABLE) && empty(MAIN)
|
|
|
|
|
@echo "Specify a release or use stable or main. Example RELEASE=14.1 MAIN=true"
|
2021-12-26 19:54:18 +01:00
|
|
|
.else
|
|
|
|
|
.if exists(./tmp)
|
|
|
|
|
rm -fr ./tmp
|
|
|
|
|
.endif
|
|
|
|
|
@echo "---------------------------------------------------------------"
|
2022-07-14 14:17:59 +02:00
|
|
|
@echo "Generating the release, be patient"
|
2021-12-26 19:54:18 +01:00
|
|
|
@echo "---------------------------------------------------------------"
|
|
|
|
|
.if !empty(MAIN)
|
|
|
|
|
git clone --depth 1 --branch main https://git.FreeBSD.org/src.git tmp
|
2025-04-04 15:49:07 -07:00
|
|
|
.elif !empty(STABLE)
|
|
|
|
|
git clone --depth 1 --branch stable/${RELEASE:R} https://git.FreeBSD.org/src.git tmp
|
2021-12-26 19:54:18 +01:00
|
|
|
.elif !empty(RELEASE)
|
2022-01-04 16:44:36 +01:00
|
|
|
git clone --depth 1 --branch releng/${RELEASE} https://git.FreeBSD.org/src.git tmp
|
2021-12-26 19:54:18 +01:00
|
|
|
.endif
|
|
|
|
|
${RUBY_CMD} ./tools/hardware-notes-processor.rb content/en/releases/${RELEASE}R/hardware.adoc
|
|
|
|
|
rm -fr ./tmp
|
|
|
|
|
.endif
|