-
Notifications
You must be signed in to change notification settings - Fork 6
/
makefile
32 lines (24 loc) · 1.14 KB
/
makefile
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
.DEFAULT_GOAL := default
APP := dotnet-appsettings-env
VERSION := $(shell git describe --tags)
VERSION := $(if $(VERSION:-=),$(VERSION),unknown)
GOCMD := $(shell which go)
GOCGO := 0
LDFLAGS := -ldflags "-s -w -X main.version=$(VERSION)"
MAKEFLAGS += --silent
clean:
$(GOCMD) clean -cache
rm -rf build/$(APP)-*
fmt:
$(GOCMD) fmt ./...
vet:
$(GOCMD) vet ./...
compile:
CGO_ENABLED=$(GOCGO) GOOS=linux GOARCH=amd64 $(GOCMD) build $(LDFLAGS) -o build/$(APP)-linux-amd64 .
CGO_ENABLED=$(GOCGO) GOOS=linux GOARCH=arm64 $(GOCMD) build $(LDFLAGS) -o build/$(APP)-linux-arm64 .
CGO_ENABLED=$(GOCGO) GOOS=windows GOARCH=386 $(GOCMD) build $(LDFLAGS) -o build/$(APP)-windows-386.exe .
CGO_ENABLED=$(GOCGO) GOOS=windows GOARCH=amd64 $(GOCMD) build $(LDFLAGS) -o build/$(APP)-windows-amd64.exe .
CGO_ENABLED=$(GOCGO) GOOS=windows GOARCH=arm64 $(GOCMD) build $(LDFLAGS) -o build/$(APP)-windows-arm64.exe .
CGO_ENABLED=$(GOCGO) GOOS=darwin GOARCH=amd64 $(GOCMD) build $(LDFLAGS) -o build/$(APP)-darwin-amd64 .
CGO_ENABLED=$(GOCGO) GOOS=darwin GOARCH=arm64 $(GOCMD) build $(LDFLAGS) -o build/$(APP)-darwin-arm64 .
default: clean fmt vet compile;