Files
pythagoras/client/make.mk

61 lines
1.4 KiB
Makefile

CLIENT_PAGES := index.html
CLIENT_STYLES := style.css
CLIENT_SCRIPTS := script.js
CLIENT_ASSETS := fm_logo.svg zmp_logo.svg tul_logo.svg qr_ask.svg
CLIENT_TARGETS := $(CLIENT_PAGES:%=static/%) \
$(CLIENT_STYLES:%=static/%) \
$(CLIENT_SCRIPTS:%=static/%) \
$(CLIENT_ASSETS:%=static/%)
.PHONY: client_clean
client_clean:
rm -rf static
rm -rf client/node_modules
.PHONY: client_test
client_test:
bun test client
client/node_modules:
cd client && bun install
# specific files
static/script.js: \
client/script.ts \
client/ws.ts \
client/pythagoras_client.ts \
client/tools.ts \
client/presentationmgr.ts \
client/settings.ts \
client/scrolling_textbox.ts \
client/node_modules
@mkdir -p $(@D)
bun build $< --minify --outfile $@
# generic pages
static/%.html: client/%.html client/node_modules
@mkdir -p $(@D)
cat $< | \
bun run --cwd client html-minifier \
--collapse-inline-tag-whitespace \
--collapse-boolean-attributes \
--collapse-whitespace \
--remove-attribute-quotes \
--remove-comments \
--remove-redundant-attributes > $@
# generic styles
static/%.css: client/%.scss client/node_modules
@mkdir -p $(@D)
bun run --cwd client sass $(notdir $<) --style compressed > $@
# generic svgs
static/%.svg: assets/%.svg
@mkdir -p $(@D)
ln -f $< $@
# generic scripts
static/%.js: client/%.ts client/node_modules
@mkdir -p $(@D)
bun build $< --minify --outfile $@