2014-01-28 01:21:47 +04:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
BUILDREF := $(shell git log --pretty=format:'%h' -n 1)
|
|
|
|
BUILDDATE := $(shell date +%Y%m%d%H%M)
|
|
|
|
BUILDREV := $(BUILDREF)-$(BUILDDATE)
|
|
|
|
|
|
|
|
# Supported OSes: linux darwin freebsd windows
|
|
|
|
# Supported ARCHes: 386 amd64
|
|
|
|
OS := linux
|
|
|
|
ARCH := amd64
|
|
|
|
|
|
|
|
PREFIX := /usr/local/
|
|
|
|
DESTDIR := /
|
|
|
|
GPGMEDIR := src/mig/pgp/sign
|
|
|
|
BINDIR := bin/$(OS)/$(ARCH)
|
|
|
|
|
|
|
|
GCC := gcc
|
|
|
|
CFLAGS :=
|
|
|
|
LDFLAGS :=
|
|
|
|
GOOPTS :=
|
|
|
|
GO := GOPATH=$(shell go env GOROOT)/bin:$(shell pwd) GOOS=$(OS) GOARCH=$(ARCH) go
|
|
|
|
GOGETTER := GOPATH=$(shell pwd) go get
|
|
|
|
GOLDFLAGS := -ldflags "-X main.version $(BUILDREV)"
|
|
|
|
GOCFLAGS :=
|
|
|
|
MKDIR := mkdir
|
|
|
|
INSTALL := install
|
|
|
|
|
2014-01-29 09:07:51 +04:00
|
|
|
all: mig-agent mig-scheduler mig-action-generator
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2014-01-29 09:07:51 +04:00
|
|
|
mig-agent:
|
2014-01-28 01:21:47 +04:00
|
|
|
$(MKDIR) -p $(BINDIR)
|
2014-01-29 09:07:51 +04:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-agent $(GOLDFLAGS) mig/agent
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2014-01-29 09:07:51 +04:00
|
|
|
mig-scheduler:
|
2014-01-28 01:21:47 +04:00
|
|
|
$(MKDIR) -p $(BINDIR)
|
2014-01-29 09:07:51 +04:00
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-scheduler $(GOLDFLAGS) mig/scheduler
|
2014-01-28 01:21:47 +04:00
|
|
|
|
2014-01-29 09:07:51 +04:00
|
|
|
mig-action_generator: gpgme
|
2014-01-28 01:21:47 +04:00
|
|
|
$(MKDIR) -p $(BINDIR)
|
|
|
|
# XXX this could be nicer
|
2014-01-29 09:07:51 +04:00
|
|
|
ln -sf src/mig/pgp/sign/libmig-gpgme.a ./
|
|
|
|
$(GO) build $(GOOPTS) -o $(BINDIR)/mig-action-generator $(GOLDFLAGS) mig/client
|
2014-01-28 01:21:47 +04:00
|
|
|
|
|
|
|
go_get_deps:
|
|
|
|
$(GOGETTER) code.google.com/p/go.crypto/openpgp
|
|
|
|
$(GOGETTER) github.com/streadway/amqp
|
|
|
|
$(GOGETTER) github.com/howeyc/fsnotify
|
|
|
|
$(GOGETTER) labix.org/v2/mgo/bson
|
|
|
|
$(GOGETTER) code.google.com/p/gcfg
|
|
|
|
|
2014-01-29 09:07:51 +04:00
|
|
|
install: gpgme mig-agent mig-scheduler
|
|
|
|
$(INSTALL) -p $(BINDIR)/mig-agent $(DESTDIR)$(PREFIX)/bin/mig-agent
|
|
|
|
$(INSTALL) -p $(BINDIR)/mig-scheduler $(DESTDIR)$(PREFIX)/bin/mig-scheduler
|
2014-01-28 01:21:47 +04:00
|
|
|
make -C $(GPGMEDIR) install
|
|
|
|
|
|
|
|
gpgme:
|
|
|
|
make -C $(GPGMEDIR)
|
|
|
|
|
2014-01-29 09:07:51 +04:00
|
|
|
tests: mig-agent
|
|
|
|
$(BINDIR)/mig-agent -m=filechecker '{"1382464331517679238": {"Path":"/etc/passwd", "Type": "contains", "Value":"root"}, "1382464331517679239": {"Path":"/etc/passwd", "Type": "contains", "Value":"ulfr"}, "1382464331517679240": {"Path":"/bin/ls", "Type": "md5", "Value": "eb47e6fc8ba9d55217c385b8ade30983"}}' > /dev/null
|
2014-01-28 01:21:47 +04:00
|
|
|
|
|
|
|
clean:
|
|
|
|
make -C $(GPGMEDIR) clean
|
|
|
|
rm -f libmig_gpgme.a
|
|
|
|
rm -rf bin
|
|
|
|
|
|
|
|
clean-all: clean
|
|
|
|
rm -rf pkg
|
|
|
|
|
|
|
|
.PHONY: clean clean-all gpgme
|