summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile19
1 files changed, 15 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index de52702..447434f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,16 @@
# vim: shiftwidth=4 tabstop=4 noexpandtab
-PREFIX=/usr
+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 ./...
@@ -13,8 +21,11 @@ debug:
go run ./... data/L.stl
install: all
- mkdir -p $(PREFIX)/bin
- install -m 755 build/stlscope $(PREFIX)/bin
+ mkdir -p $(DESTDIR)$(PREFIX)/bin
+ install -m 755 build/stlscope $(DESTDIR)$(PREFIX)/bin
-.PHONY: all clean debug install
+tests: all
+ go test ./...
+
+.PHONY: all clean debug install tests