-
Notifications
You must be signed in to change notification settings - Fork 27
/
Makefile
51 lines (35 loc) · 1.67 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
41
42
43
44
45
46
47
48
49
50
51
TARGET_NAME=nray
all: prepare build-localarch
clean:
rm -rf ./build/
build-jobs: build-x86-linux build-x64-linux build-armv7-linux build-x64-windows build-x86-windows build-darwin
create-schemas:
protoc --go_out=. ./schemas/*.proto
prepare:
mkdir -p ./build
cp nray-conf.yaml ./build/
build-localarch:
go build -race -ldflags "-X main.server=127.0.0.1 -X main.port=8601" -o build/$(TARGET_NAME)_localhardcoded ./nray.go
go build -race -o build/$(TARGET_NAME) ./nray.go
build-x86-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w" -o build/$(TARGET_NAME)-x86-linux ./nray.go
build-x64-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o build/$(TARGET_NAME)-x64-linux ./nray.go
# raspberry pi
build-armv7-linux:
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w" -o build/$(TARGET_NAME)-armv7-linux ./nray.go
build-x64-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o build/$(TARGET_NAME)-x64-windows.exe ./nray.go
build-x86-windows:
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w" -o build/$(TARGET_NAME)-x86-windows.exe ./nray.go
build-darwin:
CGO_ENABLED=0 GOOS=darwin go build -ldflags "-s -w" -o build/$(TARGET_NAME)-macos ./nray.go
calculate-hashes:
cd build; sha256sum * > ./sha256sums.txt; cd ..
create-archive:
zip -r release.zip build/
release: clean prepare build-jobs calculate-hashes
.PHONY: docker
docker: build-x64-linux
docker build -t nrayscanner/nray-debian:1.0.1 -t nrayscanner/nray-debian:latest -f docker/dockerfile-debian .
docker build -t nrayscanner/nray-scratch:1.0.1 -t nrayscanner/nray-scratch:latest -f docker/dockerfile-scratch .