Skip to content

Commit

Permalink
Merge pull request containers#661 from rhatdan/install
Browse files Browse the repository at this point in the history
Add ability to install man pages
  • Loading branch information
rhatdan authored Jul 24, 2019
2 parents 8c5dd5b + caf4c50 commit f3091b0
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ BUILDFLAGS := -tags "$(BUILDTAGS)"
PACKAGES := $(shell go list $(BUILDFLAGS) ./... | grep -v github.com/containers/image/vendor)
SOURCE_DIRS = $(shell echo $(PACKAGES) | awk 'BEGIN{FS="/"; RS=" "}{print $$4}' | uniq)

PREFIX ?= ${DESTDIR}/usr
MANINSTALLDIR=${PREFIX}/share/man
GOMD2MAN ?= $(shell command -v go-md2man || echo '$(GOBIN)/go-md2man')
MANPAGES_MD = $(wildcard docs/*.5.md)
MANPAGES ?= $(MANPAGES_MD:%.md=%)

# On macOS, (brew install gpgme) installs it within /usr/local, but /usr/local/include is not in the default search path.
# Rather than hard-code this directory, use gpgme-config. Sadly that must be done at the top-level user
# instead of locally in the gpgme subpackage, because cgo supports only pkg-config, not general shell scripts,
Expand All @@ -31,6 +37,17 @@ build: vendor build-internal
build-internal:
$(GPGME_ENV) go build $(BUILDFLAGS) $(PACKAGES)

$(MANPAGES): %: %.md
$(GOMD2MAN) -in $< -out $@

docs: $(MANPAGES)

install-docs: docs
install -d -m 755 ${MANINSTALLDIR}/man5
install -m 644 docs/*.5 ${MANINSTALLDIR}/man5/

install: install-docs

cross: vendor
GOOS=windows $(MAKE) build-internal BUILDTAGS="$(BUILDTAGS) $(BUILD_TAGS_WINDOWS_CROSS)"
GOOS=darwin $(MAKE) build-internal BUILDTAGS="$(BUILDTAGS) $(BUILD_TAGS_DARWIN_CROSS)"
Expand All @@ -56,7 +73,7 @@ vendor: tools.timestamp vendor.conf
@touch vendor

clean:
rm -rf vendor tools.timestamp
rm -rf vendor tools.timestamp $(MANPAGES)

test: vendor
@$(GPGME_ENV) go test $(BUILDFLAGS) -cover $(PACKAGES)
Expand Down

0 comments on commit f3091b0

Please sign in to comment.