summaryrefslogtreecommitdiff
path: root/Makefile
blob: 447434f207b18f805e9d2e3456e83c914d5724fc (plain)
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
# vim: shiftwidth=4 tabstop=4 noexpandtab

DESTDIR=""  # leave empty for the current system or provide a fakeroot here
PREFIX="/usr"

all:
	# some recommended options for Go building (https://wiki.archlinux.org/title/Go_package_guidelines)
	export CGO_CPPFLAGS="${CPPFLAGS}"
	export CGO_CFLAGS="${CFLAGS}"
	export CGO_CXXFLAGS="${CXXFLAGS}"
	export CGO_LDFLAGS="${LDFLAGS}"
	export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
	
	mkdir -p build
	go build -o build/stlscope ./...

clean:
	rm -rf build

debug:
	go run ./... data/L.stl

install: all
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	install -m 755 build/stlscope $(DESTDIR)$(PREFIX)/bin

tests: all
	go test ./...

.PHONY: all clean debug install tests