Automatically fill version info in index.html

This commit is contained in:
2025-12-26 10:34:45 -06:00
parent 12c303d0ab
commit 235d89ebb3
2 changed files with 7 additions and 2 deletions

View File

@@ -3,18 +3,23 @@
## Do not use it if that isn't your goal!
##
# # # Configuration Variables # # #
#
# Patch these to select a different build profile or target
# The target shouldn't change any time soon. WASM64, I guess. Other targets
# aren't aimed at the web, so you shouldn't be using this makefile.
CARGO_TARGET := wasm32-unknown-unknown
CARGO_PROFILE := tiny
# # # Automatic Variables # # #
SRC_DIR = ./src
SRCS := $(wildcard $(SRC_DIR)/**)
ASSET_SOURCE := $(wildcard assets/**)
ASSETS := $(patsubst assets/%.ogg, out/assets/%.ogg, $(ASSET_SOURCE))
CRATE_VERSION != sed -nre 's/^version = "(.*)"/\1/p' Cargo.toml
.PHONY: clean full-clean tarball tarball-standalone web web-standalone
# "Standalone" version. It includes an index.html to serve as-is
@@ -56,6 +61,7 @@ out/asteroids.js out/asteroids_bg.wasm.gz &: target/$(CARGO_TARGET)/$(CARGO_PROF
out/index.html: www/index.html
cp -a $< $@
rm -f out/asteroids.html
sed -i -e "s/#CRATE_VERSION_PLACEHOLDER#/$(CRATE_VERSION)/" $@
# Like `out/index.html`, but renames the page for use in a larger site.
out/asteroids.html: www/index.html

View File

@@ -118,8 +118,7 @@
</tr>
<tr>
<td>Program Version</td>
<!-- This version text is completely unchecked. I'll need to do something about that. -->
<td><code>v0.6.1</code></td>
<td><code>#CRATE_VERSION_PLACEHOLDER#</code></td>
</tr>
</table>
</article>