d2/Makefile

44 lines
827 B
Makefile
Raw Normal View History

.POSIX:
.PHONY: all
2025-01-12 14:41:58 +00:00
all: fmt gen js lint build test
.PHONY: fmt
fmt:
prefix "$@" ./ci/sub/bin/fmt.sh
2022-11-20 10:11:15 +00:00
.PHONY: gen
2023-02-28 01:43:53 +00:00
gen: fmt
2022-11-20 10:11:15 +00:00
prefix "$@" ./ci/gen.sh
.PHONY: lint
2023-02-28 01:43:53 +00:00
lint: fmt
prefix "$@" go vet --composites=false ./...
.PHONY: build
2023-02-28 01:43:53 +00:00
build: fmt
prefix "$@" go build ./...
.PHONY: test
2023-02-28 01:43:53 +00:00
test: fmt
prefix "$@" ./ci/test.sh
.PHONY: race
2023-02-28 01:43:53 +00:00
race: fmt
prefix "$@" ./ci/test.sh --race ./...
2025-01-12 14:41:58 +00:00
.PHONY: js
2025-01-13 04:43:03 +00:00
js: gen
cd d2js/js && NPM_VERSION="${NPM_VERSION}" prefix "$@" ./make.sh all
2025-04-02 19:02:20 +00:00
SVGDIR := testdata/examples/svg
SVGS = $(shell ./d2 themes | gawk -F':' '/^-/{ printf "$(SVGDIR)/themex-%03d.svg ",$$2 }' || :)
.PHONY: clean
clean:
rm -f $(SVGS) d2
2025-04-02 19:07:29 +00:00
rmdir $(SVGDIR)
2025-04-02 19:02:20 +00:00
.PHONY: themesdemo
themesdemo: $(SVGS) d2
$(SVGDIR)/themex-%.svg: testdata/examples/themex.d2
$(info Building $@ from $< ...)
./d2 -t $$(( 10#$* )) $< $@
2025-04-02 19:07:29 +00:00
d2: build