-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (30 loc) · 777 Bytes
/
Makefile
File metadata and controls
37 lines (30 loc) · 777 Bytes
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
32
33
34
35
36
37
VERSION ?= $(shell git describe --tags)
BUILD ?= $(shell git rev-parse --short HEAD)
PROJECTNAME := goslice
TARGET := .target
GOFILES := ./cmd/goslice
PREFIX := /usr/local
DESTDIR :=
BIN := goslice
# Use linker flags to provide version/build settings
LDFLAGS=-ldflags "-X=main.Version=$(VERSION) -X=main.Build=$(BUILD)"
## build: Compile the binary.
build: clean
@mkdir -p $(TARGET)
@GOPATH=$(GOPATH) \
GOBIN=$(GOBIN) \
GOARM=$(GOARM) \
go build $(LDFLAGS) $(GOFLAGS) -o $(TARGET) $(GOFILES)
## clean the build folder
clean:
@rm -Rf .target
@rm -f .test_stl/*.gcode
test:
@go test ./...
.PHONY: install
install: build
install -Dm755 $(TARGET)/$(BIN) $(DESTDIR)$(PREFIX)/bin/${BIN}
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/${BIN}
all: build