mirror of
https://github.com/jimeh/casecmp.git
synced 2026-02-19 02:16:40 +00:00
initial commit
This commit is contained in:
70
Makefile
Normal file
70
Makefile
Normal file
@@ -0,0 +1,70 @@
|
||||
DEV_DEPS = github.com/kardianos/govendor \
|
||||
github.com/mitchellh/gox
|
||||
|
||||
BINNAME = casecmp
|
||||
BINARY = bin/${BINNAME}
|
||||
DOCKERREPO = jimeh/casecmp
|
||||
BINDIR = $(shell dirname ${BINARY})
|
||||
SOURCES = $(shell find . -name '*.go' -o -name 'VERSION')
|
||||
VERSION = $(shell cat VERSION)
|
||||
OSARCH = "darwin/386 darwin/amd64 linux/386 linux/amd64 linux/arm"
|
||||
RELEASEDIR = releases
|
||||
|
||||
$(BINARY): $(SOURCES)
|
||||
go build -o ${BINARY} -ldflags "-X main.Version=${VERSION}"
|
||||
|
||||
.PHONY: build
|
||||
build: $(BINARY)
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
if [ -f ${BINARY} ]; then rm ${BINARY}; fi; \
|
||||
if [ -d ${BINDIR} ]; then rmdir ${BINDIR}; fi
|
||||
|
||||
.PHONY: run
|
||||
run: $(BINARY)
|
||||
$(BINARY)
|
||||
|
||||
.PHONY: install
|
||||
install: dev-deps
|
||||
@govendor install +local +program
|
||||
|
||||
.PHONY: vendor-sync
|
||||
vendor-sync: dev-deps
|
||||
@govendor sync
|
||||
|
||||
.PHONY: vendor-fetch
|
||||
vendor-fetch: dev-deps
|
||||
@govendor fetch +external +missing
|
||||
|
||||
.PHONY: vendor-install
|
||||
vendor-install: dev-deps
|
||||
@govendor install +vendor
|
||||
|
||||
.PHONY: dev-deps
|
||||
dev-deps:
|
||||
@$(foreach DEP,$(DEV_DEPS),go get $(DEP);)
|
||||
|
||||
.PHONY: update-dev-deps
|
||||
update-dev-deps:
|
||||
@$(foreach DEP,$(DEV_DEPS),go get -u $(DEP);)
|
||||
|
||||
.PHONY: release-build
|
||||
release-build:
|
||||
gox -output "${RELEASEDIR}/${BINNAME}_${VERSION}_{{.OS}}_{{.Arch}}" \
|
||||
-osarch=${OSARCH} \
|
||||
-ldflags "-X main.Version=${VERSION}"
|
||||
|
||||
.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);)
|
||||
|
||||
.PHONY: build-docker
|
||||
build-docker: clean
|
||||
govendor sync \
|
||||
&& docker build -t "${DOCKERREPO}:latest" . \
|
||||
&& docker tag "${DOCKERREPO}:latest" "${DOCKERREPO}:${VERSION}"
|
||||
Reference in New Issue
Block a user