-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (31 loc) · 1.24 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
33
34
35
36
37
38
39
40
BINARY := nlmserver
SOURCE := $(wildcard **/*.go) go.mod go.sum
TEMPLATES := $(wildcard nlmserver/templates/*.html)
ARTICLES := $(wildcard articles/*.txt)
STATIC := $(wildcard nlmserver/static/*)
ALLSOURCE := $(SOURCE) $(TEMPLATES) $(ARTICLES) $(STATIC)
.PHONY: clean build test
.DEFAULT: build
build/darwin/$(BINARY): $(ALLSOURCE)
mkdir -p build/darwin
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o $@ ./$(BINARY)
build/darwinarm/$(BINARY): $(ALLSOURCE)
mkdir -p build/darwinarm
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o $@ ./$(BINARY)
build/linux/$(BINARY): $(ALLSOURCE)
mkdir -p build/linux
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o $@ ./$(BINARY)
build/linuxarmhf/$(BINARY): $(ALLSOURCE)
mkdir -p build/linuxarmhf
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -o $@ ./$(BINARY)
build/linuxarm64/$(BINARY): $(ALLSOURCE)
mkdir -p build/linuxarm64
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o $@ ./$(BINARY)
build/darwinuniversal/$(BINARY): build/darwin/$(BINARY) build/darwinarm/$(BINARY)
mkdir -p build/darwinuniversal
lipo -create -output $@ $^
build: build/darwinuniversal/$(BINARY) build/linux/$(BINARY) build/linuxarmhf/$(BINARY) build/linuxarm64/$(BINARY)
clean:
rm -rf build || true
test:
go test -cover .