summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile26
1 files changed, 19 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index f1f8ac7..daaf3bf 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,17 @@
-BINARY = sdns
+BINARY = linum
GO = go
-GOMOD = .
+MAIN = .
+OUTPUT = build/$(BINARY)
+LDFLAGS = -ldflags="-s -w -X main.version=$(VERSION)"
-.PHONY: default build test lint fmt clean run install fuzz race
+.PHONY: default build test lint fmt clean run install fuzz race \
+ build-linux
default: test lint build
build:
- $(GO) build -o $(BINARY) $(GOMOD)
+ $(GO) build $(LDFLAGS) -o $(OUTPUT) $(MAIN)
test:
$(GO) test -race -count=1 ./...
@@ -20,16 +23,25 @@ fmt:
gofmt -w .
clean:
- rm -f $(BINARY)
+ rm -f $(OUTPUT)
run: build
- ./$(BINARY)
+ ./$(OUTPUT)
install:
- $(GO) install $(GOMOD)
+ $(GO) install $(LDFLAGS) $(MAIN)
fuzz:
$(GO) test -fuzz=FuzzBuildResponse -fuzztime=30s ./internal/server/
+build-linux:
+ GOOS=linux GOARCH=amd64 $(GO) build $(LDFLAGS) -o build/$(BINARY)-linux-amd64 $(MAIN)
+
+build-darwin:
+ GOOS=darwin GOARCH=amd64 $(GO) build $(LDFLAGS) -o build/$(BINARY)-darwin-amd64 $(MAIN)
+
+build-arm:
+ GOOS=linux GOARCH=arm64 $(GO) build $(LDFLAGS) -o build/$(BINARY)-linux-arm64 $(MAIN)
+
race:
$(GO) test -race -count=1 ./...