2017-08-28 22:39:18 +08:00
|
|
|
AUTOTAGS := $(shell ./btrfs_tag.sh) $(shell ./libdm_tag.sh) $(shell ./ostree_tag.sh) $(shell ./selinux_tag.sh)
|
2017-07-21 01:41:51 +08:00
|
|
|
TAGS := seccomp
|
2017-04-14 20:48:53 +08:00
|
|
|
PREFIX := /usr/local
|
2017-03-30 03:06:36 +08:00
|
|
|
BINDIR := $(PREFIX)/bin
|
2017-03-29 03:20:37 +08:00
|
|
|
BASHINSTALLDIR=${PREFIX}/share/bash-completion/completions
|
2017-04-04 05:43:57 +08:00
|
|
|
BUILDFLAGS := -tags "$(AUTOTAGS) $(TAGS)"
|
2017-10-03 02:49:22 +08:00
|
|
|
GO := go
|
2017-01-27 23:55:04 +08:00
|
|
|
|
2017-06-22 23:47:20 +08:00
|
|
|
GIT_COMMIT := $(shell git rev-parse --short HEAD)
|
|
|
|
BUILD_INFO := $(shell date +%s)
|
|
|
|
|
2017-07-21 01:41:51 +08:00
|
|
|
RUNC_COMMIT := c5ec25487693612aed95673800863e134785f946
|
2017-07-22 05:42:10 +08:00
|
|
|
LIBSECCOMP_COMMIT := release-2.3
|
2017-07-21 01:41:51 +08:00
|
|
|
|
2017-06-22 23:47:20 +08:00
|
|
|
LDFLAGS := -ldflags '-X main.gitCommit=${GIT_COMMIT} -X main.buildInfo=${BUILD_INFO}'
|
|
|
|
|
2017-06-29 02:34:41 +08:00
|
|
|
all: buildah imgtype docs
|
2017-01-27 23:55:04 +08:00
|
|
|
|
2017-06-02 00:05:17 +08:00
|
|
|
buildah: *.go imagebuildah/*.go cmd/buildah/*.go docker/*.go util/*.go
|
2017-10-03 02:49:22 +08:00
|
|
|
$(GO) build $(LDFLAGS) -o buildah $(BUILDFLAGS) ./cmd/buildah
|
2017-01-27 23:55:04 +08:00
|
|
|
|
2017-06-29 02:34:41 +08:00
|
|
|
imgtype: *.go docker/*.go util/*.go tests/imgtype.go
|
2017-10-03 02:49:22 +08:00
|
|
|
$(GO) build $(LDFLAGS) -o imgtype $(BUILDFLAGS) ./tests/imgtype.go
|
2017-06-29 02:34:41 +08:00
|
|
|
|
2017-01-27 23:55:04 +08:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2017-07-12 23:09:33 +08:00
|
|
|
$(RM) buildah imgtype
|
2017-03-29 03:37:24 +08:00
|
|
|
$(MAKE) -C docs clean
|
2017-01-27 23:55:04 +08:00
|
|
|
|
2017-03-29 03:37:24 +08:00
|
|
|
.PHONY: docs
|
|
|
|
docs: ## build the docs on the host
|
2017-04-12 03:34:36 +08:00
|
|
|
$(MAKE) -C docs
|
2017-03-29 03:37:24 +08:00
|
|
|
|
|
|
|
# For vendoring to work right, the checkout directory must be such that our top
|
2017-03-16 22:43:50 +08:00
|
|
|
# level is at $GOPATH/src/github.com/projectatomic/buildah.
|
2017-01-27 23:55:04 +08:00
|
|
|
.PHONY: gopath
|
|
|
|
gopath:
|
2017-03-16 22:43:50 +08:00
|
|
|
test $(shell pwd) = $(shell cd ../../../../src/github.com/projectatomic/buildah ; pwd)
|
2017-01-27 23:55:04 +08:00
|
|
|
|
2017-01-28 12:59:37 +08:00
|
|
|
# We use https://github.com/lk4d4/vndr to manage dependencies.
|
2017-01-27 23:55:04 +08:00
|
|
|
.PHONY: deps
|
|
|
|
deps: gopath
|
|
|
|
env GOPATH=$(shell cd ../../../.. ; pwd) vndr
|
2017-03-29 03:20:37 +08:00
|
|
|
|
2017-04-04 05:43:57 +08:00
|
|
|
.PHONY: validate
|
|
|
|
validate:
|
|
|
|
@./tests/validate/gofmt.sh
|
2017-05-04 02:50:55 +08:00
|
|
|
@./tests/validate/govet.sh
|
2017-04-04 05:43:57 +08:00
|
|
|
@./tests/validate/git-validation.sh
|
|
|
|
@./tests/validate/gometalinter.sh . cmd/buildah
|
|
|
|
|
|
|
|
.PHONY: install.tools
|
|
|
|
install.tools:
|
2017-10-03 02:49:22 +08:00
|
|
|
$(GO) get -u $(BUILDFLAGS) github.com/cpuguy83/go-md2man
|
|
|
|
$(GO) get -u $(BUILDFLAGS) github.com/vbatts/git-validation
|
|
|
|
$(GO) get -u $(BUILDFLAGS) gopkg.in/alecthomas/gometalinter.v1
|
2017-04-04 05:43:57 +08:00
|
|
|
gometalinter.v1 -i
|
|
|
|
|
2017-07-21 01:41:51 +08:00
|
|
|
.PHONY: runc
|
|
|
|
runc: gopath
|
|
|
|
rm -rf ../../opencontainers/runc
|
|
|
|
git clone https://github.com/opencontainers/runc ../../opencontainers/runc
|
2017-10-03 02:49:22 +08:00
|
|
|
cd ../../opencontainers/runc && git checkout $(RUNC_COMMIT) && $(GO) build -tags "$(AUTOTAGS) $(TAGS)"
|
2017-07-21 01:41:51 +08:00
|
|
|
ln -sf ../../opencontainers/runc/runc
|
|
|
|
|
2017-07-22 05:42:10 +08:00
|
|
|
.PHONY: install.libseccomp.sudo
|
|
|
|
install.libseccomp.sudo: gopath
|
|
|
|
rm -rf ../../seccomp/libseccomp
|
|
|
|
git clone https://github.com/seccomp/libseccomp ../../seccomp/libseccomp
|
|
|
|
cd ../../seccomp/libseccomp && git checkout $(LIBSECCOMP_COMMIT) && ./autogen.sh && ./configure --prefix=/usr && make all && sudo make install
|
|
|
|
|
2017-04-12 03:34:36 +08:00
|
|
|
.PHONY: install
|
2017-03-29 03:20:37 +08:00
|
|
|
install:
|
2017-04-14 20:48:53 +08:00
|
|
|
install -D -m0755 buildah $(DESTDIR)/$(BINDIR)/buildah
|
2017-03-29 03:37:24 +08:00
|
|
|
$(MAKE) -C docs install
|
|
|
|
|
2017-03-29 03:20:37 +08:00
|
|
|
.PHONY: install.completions
|
|
|
|
install.completions:
|
2017-04-14 20:48:53 +08:00
|
|
|
install -m 644 -D contrib/completions/bash/buildah $(DESTDIR)/${BASHINSTALLDIR}/buildah
|