mirror of
https://github.com/jimeh/ozu.io.git
synced 2026-02-19 08:06:39 +00:00
Update Makefile
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
bin
|
bin
|
||||||
pkg
|
releases
|
||||||
ozuio_database
|
ozuio_database
|
||||||
vendor/*/
|
vendor/*/
|
||||||
|
|||||||
25
Makefile
25
Makefile
@@ -7,10 +7,12 @@ DEV_DEPS = github.com/kardianos/govendor \
|
|||||||
BINNAME = ozuio
|
BINNAME = ozuio
|
||||||
BINARY = bin/${BINNAME}
|
BINARY = bin/${BINNAME}
|
||||||
DOCKERBIN = bin/ozuio_linux_amd64
|
DOCKERBIN = bin/ozuio_linux_amd64
|
||||||
|
DOCKERREPO = jimeh/ozu.io
|
||||||
BINDIR = $(shell dirname ${BINARY})
|
BINDIR = $(shell dirname ${BINARY})
|
||||||
SOURCES = $(shell find . -name '*.go' -o -name 'VERSION')
|
SOURCES = $(shell find . -name '*.go' -o -name 'VERSION')
|
||||||
VERSION = $(shell cat VERSION)
|
VERSION = $(shell cat VERSION)
|
||||||
OSARCH = "linux/amd64 darwin/amd64"
|
OSARCH = "darwin/386 darwin/amd64 linux/386 linux/amd64 linux/arm"
|
||||||
|
RELEASEDIR = releases
|
||||||
|
|
||||||
.DEFAULT_GOAL: test
|
.DEFAULT_GOAL: test
|
||||||
|
|
||||||
@@ -70,12 +72,19 @@ web-generate:
|
|||||||
web-debug-bindata:
|
web-debug-bindata:
|
||||||
cd web && go-bindata -debug -pkg web static/... templates/...
|
cd web && go-bindata -debug -pkg web static/... templates/...
|
||||||
|
|
||||||
.PHONY: package
|
.PHONY: release-build
|
||||||
package: dev-deps generate
|
release-build:
|
||||||
gox -output "pkg/${VERSION}/${BINNAME}_${VERSION}_{{.OS}}_{{.Arch}}" \
|
gox -output "${RELEASEDIR}/${BINNAME}_${VERSION}_{{.OS}}_{{.Arch}}" \
|
||||||
-osarch=${OSARCH} \
|
-osarch=${OSARCH} \
|
||||||
-ldflags "-X main.Version=${VERSION}" \
|
-ldflags "-X main.Version=${VERSION}"
|
||||||
&& gzip -9 pkg/${VERSION}/${BINNAME}_*
|
|
||||||
|
.SILENT: release
|
||||||
|
.PHONY: release
|
||||||
|
release: release-build
|
||||||
|
$(eval BINS := $(shell cd ${RELEASEDIR} && find . \
|
||||||
|
-name "${BINNAME}_${VERSION}_*" -not -name "*.tar.gz"))
|
||||||
|
cd $(RELEASEDIR); \
|
||||||
|
$(foreach BIN,$(BINS),tar -cvzf $(BIN).tar.gz $(BIN) && rm $(BIN);)
|
||||||
|
|
||||||
$(DOCKERBIN): $(SOURCES)
|
$(DOCKERBIN): $(SOURCES)
|
||||||
CGO_ENABLED=0 GOOS=linux ARCH=amd64 go build \
|
CGO_ENABLED=0 GOOS=linux ARCH=amd64 go build \
|
||||||
@@ -83,5 +92,5 @@ $(DOCKERBIN): $(SOURCES)
|
|||||||
|
|
||||||
.PHONY: build-docker
|
.PHONY: build-docker
|
||||||
build-docker: $(DOCKERBIN)
|
build-docker: $(DOCKERBIN)
|
||||||
docker build -t "jimeh/ozu.io:latest" . \
|
docker build -t "${DOCKERREPO}:latest" . \
|
||||||
&& docker tag "jimeh/ozu.io:latest" "jimeh/ozu.io:${VERSION}"
|
&& docker tag "${DOCKERREPO}:latest" "${DOCKERREPO}:${VERSION}"
|
||||||
|
|||||||
Reference in New Issue
Block a user