-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
48 lines (36 loc) · 1.14 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#####################################################
# strict mode: https://tech.davis-hansson.com/p/make/
SHELL := bash
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
.DELETE_ON_ERROR:
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
#####################################################
BIN := ./node_modules/.bin
BUILD := ./build
BANNER := $(BUILD)/mk-banner.bash
ESBUILD := esbuild --bundle --charset=utf8 --format=iife --legal-comments=inline --log-level=warning --outdir=./dist
SOURCES := $(wildcard src/*.user.ts)
TARGETS := $(patsubst src/%.ts,dist/%.js,$(SOURCES))
.PHONY: build
build: $(TARGETS)
.PHONY: build-doc
build-doc: README.md
$(BIN)/toc-md README.md
dist/%.js: src/%.ts $(BANNER)
@banner=$$($(BANNER) $<)$$'\n'
command="$(ESBUILD) --banner:js=\"\$$banner\" $<"
echo $$command
eval $$command
.PHONY: clean
clean:
rm -rf ./dist
.PHONY: rebuild
rebuild: clean build
.PHONY: typecheck
typecheck:
$(BIN)/tsc-files --noEmit --noImplicitAny --noUnusedLocals --noUnusedParameters --strict src/**/*.ts
# http://blog.melski.net/2010/11/30/makefile-hacks-print-the-value-of-any-variable/
print-%:
@echo '$*=$($*)'