hare

[hare] The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit d0b004b58759c21a682219e7fde750b1095ffd48
parent 784046b5f1786d3da4c7b44769d94a53d1ea9bbe
Author: Sebastian <sebastian@sebsite.pw>
Date:   Mon, 10 Oct 2022 17:26:36 -0400

scripts/gen-docs.sh: use $(BINOUT)/haredoc

This way, HTML docs can be generated without running `make install`.

This makes `make docs/html` the correct way to generate docs, and
calling the shell script itself is now incorrect. Because of this, the
file has been renamed from gen-docs to gen-docs.sh, and its mode changed
from 755 to 644.

Signed-off-by: Sebastian <sebastian@sebsite.pw>

Diffstat:
M.builds/alpine.yml | 2+-
MMakefile | 6+++---
Dscripts/gen-docs | 33---------------------------------
Ascripts/gen-docs.sh | 32++++++++++++++++++++++++++++++++
4 files changed, 36 insertions(+), 37 deletions(-)

diff --git a/.builds/alpine.yml b/.builds/alpine.yml @@ -45,6 +45,6 @@ tasks: exit fi cd hare - ./scripts/gen-docs + make docs/html tar -C docs/html -cvz . > docs.tar.gz acurl -f https://pages.sr.ht/publish/docs.harelang.org -Fcontent=@docs.tar.gz diff --git a/Makefile b/Makefile @@ -80,8 +80,8 @@ $(BINOUT)/haredoc: $(BINOUT)/hare $(haredoc_srcs) @env HAREPATH=. HAREC=$(HAREC) QBE=$(QBE) $(BINOUT)/hare build \ $(HARE_DEFINES) -o $(BINOUT)/haredoc ./cmd/haredoc -docs/html: $(BINOUT)/haredoc scripts/gen-docs - ./scripts/gen-docs +docs/html: $(BINOUT)/haredoc scripts/gen-docs.sh + BINOUT=$(BINOUT) $(SHELL) ./scripts/gen-docs.sh docs/hare.1: docs/hare.scd docs/haredoc.1: docs/haredoc.scd @@ -94,7 +94,7 @@ clean: check: $(BINOUT)/hare-tests @$(BINOUT)/hare-tests -scripts/gen-docs: scripts/gen-stdlib +scripts/gen-docs.sh: scripts/gen-stdlib scripts/gen-stdlib: scripts/gen-stdlib.sh all: $(BINOUT)/hare $(BINOUT)/harec2 $(BINOUT)/haredoc diff --git a/scripts/gen-docs b/scripts/gen-docs @@ -1,33 +0,0 @@ -#!/bin/sh -# Yes, I am entirely aware that this is a hack -srcdir="$(dirname "$0")" -getmods() ( - DOCS=1 - . $srcdir/gen-stdlib - IFS=" -" - for module in $modules; do - if [ -z "$(echo "$module" | cut -sf1)" ] - then - echo "$module" - else - module="$(echo "$module" | cut -sf1)" - echo $module - fi - done - # Not listed in the stdlib for various reasons: - echo crypto::keystore - echo mime -) -modules="$(getmods)" - -mkdir -p docs/html/ - -haredoc -Fhtml > docs/html/index.html -for mod in $modules format encoding math crypto hare rt -do - echo $mod - path="$(echo $mod | sed -e 's?::?/?g')" - mkdir -p docs/html/$path - haredoc -Fhtml $mod >docs/html/$path/index.html -done diff --git a/scripts/gen-docs.sh b/scripts/gen-docs.sh @@ -0,0 +1,32 @@ +# Yes, I am entirely aware that this is a hack +srcdir="$(dirname "$0")" +getmods() ( + DOCS=1 + . $srcdir/gen-stdlib + IFS=" +" + for module in $modules; do + if [ -z "$(echo "$module" | cut -sf1)" ] + then + echo "$module" + else + module="$(echo "$module" | cut -sf1)" + echo $module + fi + done + # Not listed in the stdlib for various reasons: + echo crypto::keystore + echo mime +) +modules="$(getmods)" + +mkdir -p docs/html/ + +"$BINOUT"/haredoc -Fhtml > docs/html/index.html +for mod in $modules format encoding math crypto hare rt +do + echo $mod + path="$(echo $mod | sed -e 's?::?/?g')" + mkdir -p docs/html/$path + "$BINOUT"/haredoc -Fhtml $mod > docs/html/$path/index.html +done