Automatically fill version info in index.html
This commit is contained in:
6
Makefile
6
Makefile
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user