cli/Makefile
Mislav Marohnić 39431a101d Port select portions of Makefile to script/build.go
This is to enable build tasks on Windows.
2021-01-08 22:35:57 +01:00

62 lines
1.5 KiB
Makefile

CGO_CPPFLAGS ?= ${CPPFLAGS}
export CGO_CPPFLAGS
CGO_CFLAGS ?= ${CFLAGS}
export CGO_CFLAGS
CGO_LDFLAGS ?= $(filter -g -L% -l% -O%,${LDFLAGS})
export CGO_LDFLAGS
.PHONY: bin/gh
bin/gh: script/build
@script/build bin/gh
script/build: script/build.go
go build -o script/build script/build.go
.PHONY: clean
clean: script/build
@script/build clean
.PHONY: manpages
manpages: script/build
@script/build manpages
.PHONY: test
test:
go test ./...
site:
git clone https://github.com/github/cli.github.com.git "$@"
.PHONY: site-docs
site-docs: site
git -C site pull
git -C site rm 'manual/gh*.md' 2>/dev/null || true
go run ./cmd/gen-docs --website --doc-path site/manual
rm -f site/manual/*.bak
git -C site add 'manual/gh*.md'
git -C site commit -m 'update help docs' || true
.PHONY: site-bump
site-bump: site-docs
ifndef GITHUB_REF
$(error GITHUB_REF is not set)
endif
sed -i.bak -E 's/(assign version = )".+"/\1"$(GITHUB_REF:refs/tags/v%=%)"/' site/index.html
rm -f site/index.html.bak
git -C site commit -m '$(GITHUB_REF:refs/tags/v%=%)' index.html
DESTDIR :=
prefix := /usr/local
bindir := ${prefix}/bin
mandir := ${prefix}/share/man
.PHONY: install
install: bin/gh manpages
install -d ${DESTDIR}${bindir}
install -m755 bin/gh ${DESTDIR}${bindir}/
install -d ${DESTDIR}${mandir}/man1
install -m644 ./share/man/man1/* ${DESTDIR}${mandir}/man1/
.PHONY: uninstall
uninstall:
rm -f ${DESTDIR}${bindir}/gh ${DESTDIR}${mandir}/man1/gh.1 ${DESTDIR}${mandir}/man1/gh-*.1