-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
43 lines (35 loc) · 1.28 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
BUILD_ARMV6 := GOOS=linux GOARCH=arm GOARM=6 go build
BUILD_ARMV7 := GOOS=linux GOARCH=arm GOARM=7 go build
VERSION_FLAGS := -ldflags "-X main.version=$(shell date +'%Y%m%dt%H%M%S')-$(shell git rev-parse --verify --short HEAD)"
OUT_DIR := out
all: proto server cli makereq web
.PHONY: server
server:
go build -o $(OUT_DIR)/$@ ./cmd/$@
$(BUILD_ARMV7) $(VERSION_FLAGS) -o $(OUT_DIR)/armv7/$@ ./cmd/$@
$(BUILD_ARMV6) $(VERSION_FLAGS) -o $(OUT_DIR)/armv6/$@ ./cmd/$@
.PHONY: cli
cli:
go build -o $(OUT_DIR)/$@ ./cmd/$@
$(BUILD_ARMV7) -o $(OUT_DIR)/armv7/$@ ./cmd/$@
$(BUILD_ARMV6) -o $(OUT_DIR)/armv6/$@ ./cmd/$@
.PHONY: makereq
makereq:
go build -o $(OUT_DIR)/$@ ./cmd/$@
$(BUILD_ARMV7) -o $(OUT_DIR)/armv7/$@ ./cmd/$@
$(BUILD_ARMV6) -o $(OUT_DIR)/armv6/$@ ./cmd/$@
.PHONY: web
web:
go build -o $(OUT_DIR)/$@ ./$@
.PHONY: proto
proto:
# Get protoc from https://github.com/protocolbuffers/protobuf/releases
# Install the Go and Go gRPC plugins like this:
# go install google.golang.org/protobuf/cmd/protoc-gen-go
# go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
protoc --go_out=module=github.com/mtraver/rpi-ir-remote:. \
irremotepb/irremote.proto
protoc --go_out=module=github.com/mtraver/rpi-ir-remote:. \
cmd/server/configpb/config.proto
clean:
rm -rf $(OUT_DIR)