summaryrefslogtreecommitdiff
path: root/vendor/github.com/checkpoint-restore/go-criu/Makefile
blob: ee44ee4486291b268c630fe6cf39341a2db61ad0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
GO ?= go
CC ?= gcc
ifeq ($(GOPATH),)
export GOPATH := $(shell $(GO) env GOPATH)
endif
FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH)))
GOBIN := $(shell $(GO) env GOBIN)
ifeq ($(GOBIN),)
	GOBIN := $(FIRST_GOPATH)/bin
endif

all: build test phaul phaul-test

lint:
	@golint . test phaul
build:
	@$(GO) build -v

test/piggie: test/piggie.c
	@$(CC) $^ -o $@

test/test: test/main.go
	@$(GO) build -v -o test/test test/main.go

test: test/test test/piggie
	mkdir -p image
	test/piggie
	test/test dump `pidof piggie` image
	test/test restore image
	pkill -9 piggie || :

phaul:
	@cd phaul; go build -v

test/phaul: test/phaul-main.go
	@$(GO) build -v -o test/phaul test/phaul-main.go

phaul-test: test/phaul test/piggie
	rm -rf image
	test/piggie
	test/phaul `pidof piggie`
	pkill -9 piggie || :

clean:
	@rm -f test/test test/piggie test/phaul
	@rm -rf image
	@rm -f rpc/rpc.proto

install.tools:
	if [ ! -x "$(GOBIN)/golint" ]; then \
		$(GO) get -u golang.org/x/lint/golint; \
	fi

rpc/rpc.proto:
	curl -s https://raw.githubusercontent.com/checkpoint-restore/criu/master/images/rpc.proto -o $@

rpc/rpc.pb.go: rpc/rpc.proto
	protoc --go_out=. $^

.PHONY: build test clean lint phaul