2018-04-16 23:49:28 +08:00
|
|
|
SHELL = bash
|
|
|
|
|
2018-04-17 00:20:55 +08:00
|
|
|
BUILD_DIR = build
|
|
|
|
DEVEL_BUILD_DIR = $(BUILD_DIR)/devel
|
|
|
|
PROD_BUILD_DIR = $(BUILD_DIR)/prod
|
2018-04-16 23:49:28 +08:00
|
|
|
|
2018-04-17 00:20:55 +08:00
|
|
|
GO_SRC_DIR = .
|
|
|
|
GO_SRC_FILES = $(wildcard $(GO_SRC_DIR)/*.go)
|
|
|
|
GO_DEVEL_BUILD_DIR = $(DEVEL_BUILD_DIR)
|
|
|
|
GO_DEVEL_BUILD_BINARY = $(GO_DEVEL_BUILD_DIR)/commento-ce
|
|
|
|
GO_PROD_BUILD_DIR = $(PROD_BUILD_DIR)
|
|
|
|
GO_PROD_BUILD_BINARY = $(GO_PROD_BUILD_DIR)/commento-ce
|
2018-04-16 23:49:28 +08:00
|
|
|
|
2018-04-17 00:20:55 +08:00
|
|
|
devel: devel-go
|
2018-04-16 23:49:28 +08:00
|
|
|
|
2018-04-17 00:20:55 +08:00
|
|
|
prod: prod-go
|
2018-04-16 23:49:28 +08:00
|
|
|
|
2018-06-11 03:49:41 +08:00
|
|
|
test: test-go
|
|
|
|
|
2018-04-16 23:49:28 +08:00
|
|
|
clean:
|
2018-04-17 00:20:55 +08:00
|
|
|
rm -rf $(BUILD_DIR)
|
|
|
|
|
|
|
|
# There's really no difference between the prod and devel binaries in Go, but
|
|
|
|
# for consistency sake, we'll use separate targets (maybe this will be useful
|
|
|
|
# later down the line).
|
|
|
|
|
|
|
|
devel-go:
|
2018-06-08 16:22:41 +08:00
|
|
|
go get .
|
2018-04-17 00:20:55 +08:00
|
|
|
go build -i -v -o $(GO_DEVEL_BUILD_BINARY)
|
|
|
|
|
|
|
|
prod-go:
|
2018-06-08 16:22:41 +08:00
|
|
|
go get .
|
2018-04-17 00:20:55 +08:00
|
|
|
go build -i -v -o $(GO_PROD_BUILD_BINARY)
|
|
|
|
|
2018-06-10 22:32:12 +08:00
|
|
|
test-go:
|
|
|
|
go get .
|
|
|
|
go test -v .
|
|
|
|
|
2018-04-17 00:20:55 +08:00
|
|
|
$(shell mkdir -p $(GO_DEVEL_BUILD_DIR) $(GO_PROD_BUILD_DIR))
|