#---------- programs and config variables ----------
CARGO ?= cargo
-CARGO_TARGET_DIR ?= target
+TARGET_DIR ?= target
USVG ?= usvg
USVG_OPTIONS = "--sans-serif-family=DejaVu Sans"
DEPLOY_ARCH=x86_64-unknown-linux-musl
DEPLOY_RELEASE=debug
-DEPLOY_TARGET_DIR=$(CARGO_TARGET_DIR)/$(addsuffix /,$(DEPLOY_ARCH))$(DEPLOY_RELEASE)
+DEPLOY_TARGET_DIR=$(TARGET_DIR)/$(addsuffix /,$(DEPLOY_ARCH))$(DEPLOY_RELEASE)
#---------- nailing-cargo ----------
NAILING_CARGO = nailing-cargo
CARGO = $(NAILING_CARGO)
BUILD_SUBDIR ?= ../Build
-CARGO_TARGET_DIR = $(BUILD_SUBDIR)/$(notdir $(PWD))/target
+TARGET_DIR = $(BUILD_SUBDIR)/$(notdir $(PWD))/target
BUNDLE_SOURCES_CMD ?= $(NAILING_CARGO) --- $(BUNDLE_SOURCES)
USVG_CMD ?= $(NAILING_CARGO) --just-run -q --- $(USVG)
+WASM_PACK_CMD ?= $(NAILING_CARGO) --linkfarm=git --- $(WASM_PACK)
endif # Cargo.nail
BUILD_SUBDIR ?= ../Build
BUNDLE_SOURCES_CMD ?= $(BUNDLE_SOURCES)
-USVG_CMD ?= =$(USVG)
+USVG_CMD ?= $(USVG)
+WASM_PACK_CMD ?= $(WASM_PACK)
+
+WASM_PACKED=$(TARGET_DIR)/packed-wasm
#---------- local programs ----------
cargo-wasm: cargo-wasm-release
-assets: templates/script.js libraries $(FILEASSETS)
+wasm-pack: stamp/wasm-pack
+
+assets: js libraries $(FILEASSETS)
+
+js: templates/script.js
extra-debug:
extra-release: bundled-sources
WASM_ASSETS := $(addprefix otter_wasm,.js _bg.wasm)
WASM_OUTPUTS := $(addprefix otter_wasm,.d.ts)
-$(WASM_ASSETS) $(WASM_OUTPUTS): wasm-pack
-.PHONY: wasm-pack
-wasm-pack: cargo/wasm-release
-
-real/wasm-pack:
-
-wasm-pack:
- $(MAKE) real/$@
+$(addprefix $(WASM_PACKED)/,$(WASM_ASSETS) $(WASM_OUTPUTS)): stamp/wasm-pack
+stamp/wasm-pack: stamp/cargo.wasm-release
+ $(WASM_PACK_CMD) $(WASM_PACK_OPTIONS) build \
+ --out-dir=../target/packed-wasm wasm -t no-modules --release
+ $(stamp)
#---------- bundle-sources ----------
-bundled-sources: $(CARGO_TARGET_DIR)/bundled-sources
-$(CARGO_TARGET_DIR)/bundled-sources: $(BUNDLE_SOURCES)
+bundled-sources: $(TARGET_DIR)/bundled-sources
+$(TARGET_DIR)/bundled-sources: $(BUNDLE_SOURCES)
$(BUNDLE_SOURCES_CMD) --output $(abspath $@)
@echo Bundled sources.
-.PHONY: bundle-sources $(CARGO_TARGET_DIR)/bundled-sources
+.PHONY: bundle-sources $(TARGET_DIR)/bundled-sources
#---------- svg processing ----------
#---------- typescript ----------
TS_SRCS= script bigfloat
-TS_SRC_FILES= $(addprefix templates/,$(addsuffix .ts,$(TS_SRCS)))
+TS_SRC_FILES= \
+ ../webassembly-types/webassembly.d.ts \
+ $(addprefix $(WASM_PACKED)/,otter_wasm.d.ts) \
+ $(addprefix templates/,$(addsuffix .ts,$(TS_SRCS)))
LITFILES= LICENCE AGPLv3
TXTFILES= CC-BY-SA-3.0 CC-BY-SA-4.0
deploy: stamp/cargo.deploy-build bundled-sources
rsync -zv --progress $(addprefix $(DEPLOY_TARGET_DIR)/,$(PROGRAMS)) $(DEPLOY_BASE)/bin/
- rsync -rv --progress $(CARGO_TARGET_DIR)/bundled-sources/. $(DEPLOY_BASE)/bundled-sources
+ rsync -rv --progress $(TARGET_DIR)/bundled-sources/. $(DEPLOY_BASE)/bundled-sources
#---------- clean ----------