-
Notifications
You must be signed in to change notification settings - Fork 13
/
Makefile
50 lines (38 loc) · 1.63 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
APP_PATH := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
APP_NAME := $(shell basename $(APP_PATH))
APP_PKG := $(shell go list -m)
SCRIPT_PATH := $(APP_PATH)/scripts
COMPILE_OUT:=$(APP_PATH)/bin/$(APP_NAME)
.PHONY: all test clean build install
GOFLAGS ?= $(GOFLAGS:)
all: install test
install: install.go
build: build.ui build.linux build.darwin
install.go:
@echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>making $@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
@go get $(GOFLAGS) ./...
@echo -e "\n"
build.ui:
@echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>making $@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
@cd $(APP_PATH)/webui && yarn install --frozen-lockfile && yarn run build
@echo -e "\n"
build.linux:
@echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>make $@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
@export GOOS=linux && $(SCRIPT_PATH)/build/gobuild.sh $(APP_NAME) $(COMPILE_OUT)-$${GOOS} $(APP_PKG)
@echo -e "\n"
build.darwin:
@echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>make $@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
@export GOOS=darwin && $(SCRIPT_PATH)/build/gobuild.sh $(APP_NAME) $(COMPILE_OUT)-$${GOOS} $(APP_PKG)
@echo -e "\n"
test: install
@echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>making $@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
@go test $(GOFLAGS) ./...
@echo -e "\n"
bench: install
@echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>making $@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
@go test -run=NONE -bench=. $(GOFLAGS) ./...
@echo -e "\n"
clean:
@echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>making $@<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
@go clean $(GOFLAGS) -i ./...
@echo -e "\n"