From 47ef2d48af8d9efc23b65f13546528e061bad13d Mon Sep 17 00:00:00 2001 From: xengineering Date: Sun, 30 May 2021 12:41:12 +0200 Subject: Update Makefile with complete Installation Instructions --- Makefile | 19 +++++++++++++++---- 1 file 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 -- cgit v1.2.3-70-g09d2