1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-11-23 22:24:39 +02:00
Files
chroma/Makefile

43 lines
1.4 KiB
Makefile
Raw Normal View History

.PHONY: chromad upload all
VERSION ?= $(shell git describe --tags --dirty --always)
2023-01-11 14:43:47 -05:00
export GOOS ?= linux
export GOARCH ?= amd64
all: README.md tokentype_string.go
README.md: lexers/*.go lexers/embedded/*.xml
GOOS= GOARCH= ./table.py
tokentype_string.go: types.go
go generate
2025-07-01 10:16:32 +10:00
.PHONY: format-js
format-js:
biome format --write cmd/chromad/static/{index.js,chroma.js}
2025-04-03 20:47:45 +11:00
.PHONY: chromad
chromad: build/chromad
2025-06-30 15:31:55 +10:00
build/chromad: $(shell find cmd/chromad -name '*.go' -o -name '*.html' -o -name '*.css' -o -name '*.js') \
cmd/chromad/static/wasm_exec.js \
cmd/chromad/static/chroma.wasm
rm -rf build
2025-06-30 15:31:55 +10:00
esbuild --platform=node --bundle cmd/chromad/static/index.js --minify --outfile=cmd/chromad/static/index.min.js
2023-01-11 14:43:47 -05:00
esbuild --bundle cmd/chromad/static/index.css --minify --outfile=cmd/chromad/static/index.min.css
2025-04-03 20:47:45 +11:00
(export CGOENABLED=0 ; go build -C cmd/chromad -ldflags="-X 'main.version=$(VERSION)'" -o ../../build/chromad .)
2025-06-30 15:31:55 +10:00
cmd/chromad/static/wasm_exec.js: $(shell tinygo env TINYGOROOT)/targets/wasm_exec.js
install -m644 $< $@
cmd/chromad/static/chroma.wasm: $(shell git ls-files | grep '\.go|\.xml')
if type tinygo > /dev/null; then \
tinygo build -no-debug -target wasm -o $@ cmd/libchromawasm/main.go; \
else \
GOOS=js GOARCH=wasm go build -o $@ cmd/libchromawasm/main.go; \
fi
2025-06-30 15:31:55 +10:00
upload: build/chromad
scp build/chromad root@swapoff.org: && \
ssh root@swapoff.org 'install -m755 ./chromad /srv/http/swapoff.org/bin && service chromad restart'