chiark / gitweb /
before make make run nailing-cargo
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 7 Jul 2020 23:32:34 +0000 (00:32 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 7 Jul 2020 23:32:34 +0000 (00:32 +0100)
Makefile [new file with mode: 0644]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..a181e0d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+SHELL=/bin/bash
+
+CARGO ?= cargo
+
+default: debug
+
+ifneq (,$(NAILINGCARGO_MANIFEST_DIR))
+vpath % $(NAILINGCARGO_MANIFEST_DIR)
+CARGO_FLAGS += $(addprefix --manifest-path=,$(NAILINGCARGO_MANIFEST_DIR)/Cargo.toml)
+CARGO_FLAGS += $(NAILINGCARGO_CARGO_OPTIONS)
+endif
+
+foo:
+       printenv | sort
+
+debug: target/debug/server templates/script.js
+
+.PHONY: target/debug/server
+
+target/debug/server:
+       $(CARGO) build $(CARGO_FLAGS)
+
+templates/script.js: templates/script.ts tsconfig.json
+       mkdir -p templates
+       test -f templates || ln -s $< templates/
+       tsc --outfile $@.tmp 2>&1 \
+       | perl -pe 's/\((\d+),(\d+)\):/:$$1:$$2:/'; \
+       test "$${PIPESTATUS[*]}" = "0 0"
+       mv -f $@.tmp $@
+
+clean:
+       rm -f templates/script.js
+       rm -rf target