1
0
Fork 0
wiki/Makefile

80 lines
2.1 KiB
Makefile

GIT_COMMIT = $(shell git rev-parse HEAD)
BUILD_TIME = $(shell date -u +"%Y-%m-%dT%H:%M:%SZ" | tr -d '\n')
ASSETS=template static
CUR_DIR=$(shell pwd)
GOPATH=$(CUR_DIR)/build/
PARENT_PKG=amuz.es/go/
NAME=wiki
PKG=$(PARENT_PKG)$(NAME)
usage:
@echo ""
@echo "Task : Description"
@echo "----------------- : -------------------"
@echo "make setup : Install all necessary dependencies"
@echo "make dev : Generate development build"
@echo "make test : Run tests"
@echo "make build : Generate production build for current OS"
@echo "make bootstrap : Install cross-compilation toolchain"
@echo "make release : Generate binaries for all supported OSes"
@echo "make test : Execute test suite"
@echo "make test-all : Execute test suite on multiple PG versions"
@echo "make clean : Remove all build files and reset assets"
@echo "make assets : Generate production assets file"
@echo "make dev-assets : Generate development assets file"
@echo ""
test:
godep go test -cover ./...
test-all:
@./script/test_all.sh
assets-%: asset/%/
@echo "serialize $*"
@go-bindata -o bind/$*/handler.go -pkg $* -prefix $* -ignore=[.]gitignore -ignore=[.]gitkeep -prefix asset/$*/ $(BINDATA_OPTS) $<...
assets: $(addprefix assets-,${ASSETS})
dev-assets:
@$(MAKE) --no-print-directory assets BINDATA_OPTS="-debug"
dev:
godep go build
@echo "You can now execute ./$(NAME)"
dependency-save:
cd $(GOPATH)src/$(PKG) && go get && godep save && cd $(CUR_DIR)
dependency-restore:
godep restore
build: setup assets
godep go build
@echo "You can now execute ./$(NAME)"
release: assets
@$(MAKE) --no-print-directory dependency-save
@echo "Building binaries..."
@echo "\nPackaging binaries...\n"
@./script/package.sh
setup:
go get github.com/tools/godep
go get golang.org/x/tools/cmd/cover
godep get github.com/jteeuwen/go-bindata/...
mkdir -p $(GOPATH)src/$(PARENT_PKG)
ln -nsf $(CUR_DIR) $(GOPATH)src/$(PARENT_PKG)$(NAME)
@$(MAKE) --no-print-directory dependency-restore
clean:
rm -f ./$(NAME)
rm -rf ./build
rm -rf ./bind/*