Makefile 2.44 KB
Newer Older
Loïck Bonniot's avatar
Loïck Bonniot committed
1
2
3
4
5
6
7
8
REVISION := $(shell git rev-parse HEAD || echo )
VERSION := $(shell git tag --points-at HEAD | grep -m1 v[0-9] | sed -e 's/^v//g' )
ifeq ($(VERSION),)
	VERSION := master
endif

.PHONY:

9
10
11
12
13
install: nocache
	go install ./dfssc
	go install ./dfssp
	go install ./dfsst

Loïck Bonniot's avatar
Loïck Bonniot committed
14
15
16
17
18
19
20
21
22
# install_all installs everything, including libraries. It's mandatory for linter, but should be improved in the future.
install_all: install
	git stash
	rm -rf gui
	rm -rf dfssd/gui
	rm -f dfssd/main.go
	go install ./...
	git reset --hard

Loïck Bonniot's avatar
Loïck Bonniot committed
23
24
release: clean build_all package

25
26
27
# prepare_gui builds a new container from the goqt image, adding DFSS dependencies for faster builds.
# call it once or after dependency addition.
prepare_gui: nocache
Loïck Bonniot's avatar
Loïck Bonniot committed
28
29
	docker run --name dfss-builder -v ${PWD}:/go/src/dfss -w /go/src/dfss lesterpig/goqt /bin/bash -c \
		"cp -r ../github.com/visualfc/goqt/bin . ; ./build/deps.sh"
30
31
32
33
34
	docker commit dfss-builder dfss:builder
	docker rm dfss-builder

# gui builds the gui component of the dfss project into a docker container, outputing the result in bin/ directory.
gui: nocache
Loïck Bonniot's avatar
Loïck Bonniot committed
35
36
37
	docker run --rm -v ${PWD}:/go/src/dfss -w /go/src/dfss/gui dfss:builder \
		../bin/goqt_rcc -go main -o application.qrc.go application.qrc
	docker run --rm -v ${PWD}:/go/src/dfss -w /go/src/dfss/gui dfss:builder \
38
39
		go build -ldflags "-r ." -o ../bin/gui

40
41
42
43
44
45
# dfssd builds the demonstrator into a docker container, outputing the result in bin/ directory
dfssd: nocache
	docker run --rm -v ${PWD}:/go/src/dfss -w /go/src/dfss/dfssd/gui dfss:builder \
		../../bin/goqt_rcc -go gui -o application.qrc.go application.qrc
	docker run --rm -v ${PWD}:/go/src/dfss -w /go/src/dfss/dfssd dfss:builder \
		go build -ldflags "-r ." -o ../bin/dfssd
46

47
48
49
50
51
52
53
54
protobuf:
	cd .. && \
	protoc --go_out=plugins=grpc:. dfss/dfssc/api/client.proto && \
	protoc --go_out=plugins=grpc:. dfss/dfssd/api/demonstrator.proto && \
	protoc --go_out=plugins=grpc:. dfss/dfssp/api/platform.proto && \
	protoc --go_out=plugins=grpc:. dfss/dfsst/api/resolution.proto

# Release internals
Loïck Bonniot's avatar
Loïck Bonniot committed
55
56
build_all:
	go get github.com/mitchellh/gox
57
	gox -os "linux darwin windows" -parallel 1 -output "release/dfss_${VERSION}_{{.OS}}_{{.Arch}}/{{.Dir}}" dfss/dfssc dfss/dfssp dfss/dfsst
Loïck Bonniot's avatar
Loïck Bonniot committed
58
59
60
61
62
63
64
65
66

package:
	echo "$(VERSION) $(REVISION)" > build/embed/VERSION
	cd release && ls -1 . | xargs -n1 -I {} cp ../build/embed/* {}/
	cd release && ls -1 . | xargs -n1 -I {} tar zcvf {}.tar.gz {}

deploy:
	mkdir -p /deploy/$(VERSION)
	cp release/*.tar.gz /deploy/$(VERSION)/
Axel's avatar
Axel committed
67

68
69
clean:
	rm -rf release
70
71

nocache: