forked from pydio/cells
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
77 lines (63 loc) · 2.39 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
66
67
68
69
70
71
72
73
74
75
76
77
GOBUILD=go build
ENV=env GOOS=linux
TODAY=`date -u +%Y-%m-%dT%H:%M:%S`
GITREV=`git rev-parse HEAD`
.PHONY: all clean build front main client static
all: clean build
build: generate main
front:
find assets/src/pydio -name composer.json -not -path "*vendor*" -execdir composer install \;
find assets/src/pydio -name package.json -not -path "*/node_modules/*" -execdir npm install \;
find assets/src/pydio -name Gruntfile.js -not -path "*/node_modules/*" -execdir grunt \;
# Removing everything that's used for building dependency but is not necessary for the frontend to run
find assets/src/pydio \
-type l -o \
-path "*/.git/*" -o \
-path "*/res/js/*" -o \
-path "*/js/react/*" -o \
-path "*/tests/*" -o \
-name .git -o \
-name .gitignore | xargs rm -rf
find assets/src/pydio \
-maxdepth 3 \
-name node_modules -o \
-name package.json -o \
-name composer.json -o \
-name Gruntfile.js | xargs rm -rf
generate:
# Removing existing packr files and running packr
find . -name *-packr.go | xargs rm -f
grep -ri -l "packr.NewBox" */* | while read -r line; do cd `dirname "$$line"`; echo "Run packr for $$line" ; ${GOPATH}/bin/packr --compress --input=. ; cd -; done
main:
go build -a\
-ldflags "-X github.com/pydio/cells/common.version=${CELLS_VERSION}\
-X github.com/pydio/cells/common.BuildStamp=${TODAY}\
-X github.com/pydio/cells/common.BuildRevision=${GITREV}\
-X github.com/pydio/cells/vendor/github.com/pydio/minio-srv/cmd.Version=${GITREV}\
-X github.com/pydio/cells/vendor/github.com/pydio/minio-srv/cmd.ReleaseTag=${GITREV}"\
-o cells\
.
dev:
go build\
-tags dev\
-ldflags "-X github.com/pydio/cells/common.version=0.2.0\
-X github.com/pydio/cells/common.BuildStamp=2018-01-01T00:00:00\
-X github.com/pydio/cells/common.BuildRevision=dev"\
-o cells\
.
ctl:
go build\
-ldflags "-X github.com/pydio/cells/common.version=${CELLS_VERSION}\
-X github.com/pydio/cells/common.BuildStamp=`date -u +%Y-%m-%dT%H:%M:%S`\
-X github.com/pydio/cells/common.BuildRevision=`git rev-parse HEAD`"\
-o cells-ctl\
cmd/ctl/main.go
start:
./cells start
ds: dev start
linux:
CC=x86_64-pc-linux-gcc GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -ldflags "-X main.version=0.2 -X main.buildStamp=`date -u +%Y-%m-%dT%H:%M:%S` -X main.buildRevision=`git rev-parse HEAD`" -o dist/linux/cells main.go
cleanall: stop clean rm
clean:
rm -f cells cells-ctl
${GOPATH}/bin/packr clean