-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
66 lines (52 loc) · 1.51 KB
/
Makefile
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
61
62
63
64
65
SHELL := /bin/bash
# This would be a nice discover plugin that would traverse the code base and vendor external packages
GO_DEPS = github.com/GeertJohan/go.rice github.com/GeertJohan/go.rice/rice github.com/Sirupsen/logrus
all: build ui-build embed
clean:
rm bin/*_gopolymerd
ui-deps:
npm install -g bower
npm install -g vulcanize # TODO figure out a way to get polymer to be packagable
ui-build:
cd src/cmd/gopolyd/ui/ && \
bower install ; \
ls bower_components
deps:
go get github.com/constabulary/gb/...
go get github.com/GeertJohan/go.rice
vendor-update:
for dep in $(GO_DEPS) ; do \
echo $$dep ; \
gb vendor update $$dep ; \
done
vendor: deps
for dep in $(GO_DEPS) ; do \
echo $$dep ; \
gb vendor fetch $$dep ; \
done
build: deps
mkdir -p bin
# Linux build
GOARCH=amd64 GOOS=linux gb build
if [ -a bin/gopolyd ]; \
then \
mv bin/gopolyd bin/linux_gopolymerd; \
else \
mv bin/gopolyd-linux-amd64 bin/linux_gopolymerd; \
fi;
# OS X build
GOARCH=amd64 GOOS=darwin gb build
if [ -a bin/gopolyd ]; \
then \
mv bin/gopolyd bin/darwin_gopolymerd; \
else \
mv bin/gopolyd-darwin-amd64 bin/darwin_gopolymerd; \
fi;
embed: build ui-build
cd src/cmd/gopolyd/ && rice append --exec ../../../bin/linux_gopolymerd
cd src/cmd/gopolyd/ && rice append --exec ../../../bin/darwin_gopolymerd
# Crosscompile sadness :(
build-linux: deps
cd src/cmd/gopolyd && env GOOS=linux go build -o ../../../bin/gopolyd
embed-linux: build-linux
cd src/cmd/gopolyd/ && rice append --exec ../../../bin/gopolyd