Merge pull request #145 from rhatdan/makefile

Fix up Makefile, to only build when needed
This commit is contained in:
Mrunal Patel 2016-10-14 14:04:24 -07:00 committed by GitHub
commit 91efd54e2b

View file

@ -13,6 +13,8 @@ GO_MD2MAN ?= $(shell which go-md2man)
export GOPATH := ${CURDIR}/vendor export GOPATH := ${CURDIR}/vendor
BUILDTAGS := selinux BUILDTAGS := selinux
all: binaries ocid.conf docs
default: help default: help
help: help:
@ -38,11 +40,12 @@ conmon:
pause: pause:
make -C $@ make -C $@
ocid: ${OCID_LINK} GO_SRC = $(shell find . -name \*.go)
go build --tags "$(BUILDTAGS)" -o ocid ./cmd/server/ ocid: $(GO_SRC) ${OCID_LINK}
go build --tags "$(BUILDTAGS)" -o $@ ./cmd/server/
ocic: ${OCID_LINK} ocic: $(GO_SRC)
go build -o ocic ./cmd/client/ go build -o $@ ./cmd/client/
ocid.conf: ocid ocid.conf: ocid
./ocid --config="" config --default > ocid.conf ./ocid --config="" config --default > ocid.conf
@ -51,11 +54,11 @@ clean:
rm -f ocid.conf rm -f ocid.conf
rm -f ocic ocid rm -f ocic ocid
rm -f ${OCID_LINK} rm -f ${OCID_LINK}
rm -f conmon/conmon.o conmon/conmon
rm -f pause/pause.o pause/pause
rm -f docs/*.1 docs/*.5{,.gz} docs/*.8{,.gz} rm -f docs/*.1 docs/*.5{,.gz} docs/*.8{,.gz}
find . -name \*~ -delete find . -name \*~ -delete
find . -name \#\* -delete find . -name \#\* -delete
make -C conmon clean
make -C pause clean
ocidimage: ocidimage:
docker build -t ${OCID_IMAGE} . docker build -t ${OCID_IMAGE} .
@ -73,7 +76,7 @@ integration: ocidimage
localintegration: binaries localintegration: binaries
./test/test_runner.sh ${TESTFLAGS} ./test/test_runner.sh ${TESTFLAGS}
binaries: ${OCID_LINK} ocid ocic conmon pause binaries: ocid ocic conmon pause
MANPAGES_MD = $(wildcard docs/*.md) MANPAGES_MD = $(wildcard docs/*.md)
@ -89,7 +92,7 @@ docs/%.5: docs/%.5.md
docs: $(MANPAGES_MD:%.md=%) docs: $(MANPAGES_MD:%.md=%)
install: ocid.conf install: all
install -D -m 755 ocid ${INSTALLDIR}/ocid install -D -m 755 ocid ${INSTALLDIR}/ocid
install -D -m 755 ocic ${INSTALLDIR}/ocic install -D -m 755 ocic ${INSTALLDIR}/ocic
install -D -m 755 conmon/conmon $(PREFIX)/libexec/ocid/conmon install -D -m 755 conmon/conmon $(PREFIX)/libexec/ocid/conmon
@ -102,8 +105,6 @@ install: ocid.conf
install -D -m 644 ocid.conf $(DESTDIR)/etc install -D -m 644 ocid.conf $(DESTDIR)/etc
uninstall: uninstall:
systemctl stop ocid.service
systemctl disable ocid.service
rm -f $(PREFIX)/lib/systemd/system/ocid.service rm -f $(PREFIX)/lib/systemd/system/ocid.service
rm -f ${INSTALLDIR}/{ocid,ocic} rm -f ${INSTALLDIR}/{ocid,ocic}
rm -f $(PREFIX)/libexec/ocid/{conmon,pause} rm -f $(PREFIX)/libexec/ocid/{conmon,pause}
@ -147,7 +148,5 @@ install.tools: .install.gitvalidation .install.gometalinter .install.md2man
help \ help \
install \ install \
lint \ lint \
ocic \
ocid \
pause \ pause \
uninstall uninstall