commento/api/Makefile
WGH 6e22d10b02 api/Makefile: remove -i flag to fix cross-compilation
When -i (install) flag is passed to `go build`, it attempts
to install dependencies of the target.

This will usually fail during cross-compilation due to GOROOT being
not writeable to non-root users:

    runtime/internal/sys
    go build runtime/internal/sys: mkdir /usr/lib/go/pkg/linux_arm: permission denied

Installing dependencies makes no sense in recent Go versions,
because compilation is cached anyway (see `go help cache`).
2019-06-05 20:45:03 -07:00

40 lines
895 B
Makefile

SHELL = bash
BUILD_DIR = build
DEVEL_BUILD_DIR = $(BUILD_DIR)/devel
PROD_BUILD_DIR = $(BUILD_DIR)/prod
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
GO_PROD_BUILD_DIR = $(PROD_BUILD_DIR)
GO_PROD_BUILD_BINARY = $(GO_PROD_BUILD_DIR)/commento
devel: devel-go
prod: prod-go
test: test-go
clean:
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:
dep ensure
go build -v -o $(GO_DEVEL_BUILD_BINARY)
prod-go:
dep ensure
go build -v -o $(GO_PROD_BUILD_BINARY)
test-go:
dep ensure
go test -v .
$(shell mkdir -p $(GO_DEVEL_BUILD_DIR) $(GO_PROD_BUILD_DIR))