Makefile 1.91 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
14
15
install: nocache
	go install .
	go install ./dfssc
	go install ./dfssd
	go install ./dfssp
	go install ./dfsst

Loïck Bonniot's avatar
Loïck Bonniot committed
16
17
18
19
20
release: clean build_all package

clean:
	rm -rf release

21
22
23
24
25
# GUI Build (Docker required)

# 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
26
27
	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"
28
29
30
31
32
	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
33
34
35
	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 \
36
37
38
39
		go build -ldflags "-r ." -o ../bin/gui

# Release internals

Loïck Bonniot's avatar
Loïck Bonniot committed
40
41
build_all:
	go get github.com/mitchellh/gox
Richer Maximilien's avatar
Richer Maximilien committed
42
	gox -os "linux darwin windows" -parallel 1 -output "release/dfss_${VERSION}_{{.OS}}_{{.Arch}}/{{.Dir}}" dfss/dfssc dfss/dfssd dfss/dfssp dfss/dfsst
Loïck Bonniot's avatar
Loïck Bonniot committed
43
44
45
46
47
48
49
50
51

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
52
53
54
55
56

protobuf:
	cd .. && \
	protoc --go_out=plugins=grpc:. dfss/dfssc/api/client.proto && \
	protoc --go_out=plugins=grpc:. dfss/dfssd/api/demonstrator.proto && \
57
58
	protoc --go_out=plugins=grpc:. dfss/dfssp/api/platform.proto && \
	protoc --go_out=plugins=grpc:. dfss/dfsst/api/resolution.proto
59
60

nocache: