Files
dokku/common.mk
Jose Diaz-Gonzalez 02d653a1aa refactor: omit DWARF symbol table and debug information from go binaries
This will reduce the size of binaries in exchange for worse debugging output. This is acceptable for our users and worth it to save money on packagecloud package hosting - which is currently free under a given repository size.
2019-11-27 21:12:16 -05:00

42 lines
1.0 KiB
Makefile

GO_ARGS ?= -a
GO_REPO_ROOT := /go/src/github.com/dokku/dokku
BUILD_IMAGE := golang:1.12
.PHONY: build-in-docker build clean src-clean
build: $(BUILD)
build-in-docker: clean
mkdir -p /tmp/dokku-go-build-cache
docker run --rm \
-v $$PWD/../..:$(GO_REPO_ROOT) \
-v /tmp/dokku-go-build-cache:/root/.cache/go-build \
-e PLUGIN_NAME=$(PLUGIN_NAME) \
-w $(GO_REPO_ROOT)/plugins/$(PLUGIN_NAME) \
$(BUILD_IMAGE) \
bash -c "GO_ARGS='$(GO_ARGS)' make -j4 build" || exit $$?
clean:
rm -rf commands subcommands triggers
find . -xtype l -delete
commands: **/**/commands.go
go build -ldflags="-s -w" $(GO_ARGS) -o commands src/commands/commands.go
subcommands:
go build -ldflags="-s -w" $(GO_ARGS) -o subcommands/subcommands src/subcommands/subcommands.go
$(MAKE) $(SUBCOMMANDS)
subcommands/%:
ln -sf subcommands $@
src-clean:
rm -rf .gitignore src vendor Makefile *.go glide.*
triggers:
go build -ldflags="-s -w" $(GO_ARGS) -o triggers src/triggers/triggers.go
$(MAKE) $(TRIGGERS)
triggers/%:
ln -sf triggers $(shell echo $@ | cut -d '/' -f2)