forked from gotomicro/egoctl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
36 lines (25 loc) · 970 Bytes
/
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
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
build:build.linux build.darwin
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"
install:
go get $(GOFLAGS) ./...
test: install
go test $(GOFLAGS) ./...
bench: install
go test -run=NONE -bench=. $(GOFLAGS) ./...
clean:
go clean $(GOFLAGS) -i ./...