-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
161 lines (106 loc) · 3.85 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
## ------------------------------------------------------------------------ ##
## Build Project ##
## ------------------------------------------------------------------------ ##
# .SILENT:
.EXPORT_ALL_VARIABLES:
.IGNORE:
.ONESHELL:
## ------------------------------------------------------------------------ ##
APP_NAME := roulette-predictor
APP_LOGO := ./assets/BANNER
APP_REPO := $(shell git ls-remote --get-url)
APP_ENV := $(shell cat ./NODE_ENV)
CODE_VERSION := $(shell cat ./VERSION)
WD := $(shell pwd -P)
DT = $(shell date +'%Y%m%d%H%M%S')
## ------------------------------------------------------------------------ ##
DIR_SRC := src
DIR_BUILD := build-${CODE_VERSION}
DIR_DIST := dist-${CODE_VERSION}
DIR_WEB := webroot
APP_DIRS := $(addprefix ${WD}/,${DIR_BUILD} ${DIR_DIST} ${DIR_WEB})
## ------------------------------------------------------------------------ ##
# Query the default goal.
ifeq ($(.DEFAULT_GOAL),)
.DEFAULT_GOAL := default
endif
## ------------------------------------------------------------------------ ##
## INCLUDES ##
## ------------------------------------------------------------------------ ##
include ./bin/.bash_colors
include ./bin/Makefile.*
## ------------------------------------------------------------------------ ##
.PHONY: default
default: all;
## ------------------------------------------------------------------------ ##
.PHONY: test
test: banner state help banner;
## ------------------------------------------------------------------------ ##
.PHONY: banner
banner:
@ if [ -f "${APP_LOGO}" ]; then cat "${APP_LOGO}"; fi
## ------------------------------------------------------------------------ ##
.PHONY: clean clean-all
.PHONY: clean-src clean-deps
.PHONY: clean-build clean-dist clean-web clean-files
clean-all: clean clean-web clean-files
clean: clean-build clean-dist clean-files
clean-src:
@ rm -rf ${DIR_SRC}
clean-build:
@ rm -rf ${DIR_BUILD}
clean-dist:
@ rm -rf ${DIR_DIST}
clean-web:
@ rm -rf ${DIR_WEB}
clean-deps:
@ rm -rf \
bower_modules/ \
node_modules/ ;
clean-files:
@ rm -rf COMMIT \
bitbucket-pipelines.yml \
codeclimate-config.patch \
_config.yml \
_*.list ;
## ------------------------------------------------------------------------ ##
.PHONY: rights
rights:
@ find . -type f -exec chmod 664 {} 2>/dev/null \;
@ find . -type d -exec chmod 775 {} 2>/dev/null \;
@ find . -type f -name "*.sh" -exec chmod a+x {} 2>/dev/null \;
## ------------------------------------------------------------------------ ##
.PHONY: setup build build-engine build-assets deploy finish-msg
setup:
@ echo "APP_DIRS = [${APP_DIRS}]"
$(foreach dir,${APP_DIRS},$(shell mkdir -p $(dir)))
@ npm i
@ bower i
build: build-engine build-assets;
build-engine:
# @ ./setup.sh build
build-assets:
@ gulp sync:bower2src
@ gulp sync:src2build
# build:
# @ cp -pr ${DIR_SRC}/* ${DIR_BUILD}/ 2>/dev/null ;
release:
@ cp -rvuf ${DIR_BUILD}/* ${DIR_DIST}/ 2>/dev/null ;
deploy:
@ cp -rvuf ${DIR_BUILD}/* ${DIR_WEB}/ 2>/dev/null ;
@ rm -rf ${DIR_WEB}/resources 2>/dev/null ;
@ cp -rvuf ./data/ ${DIR_WEB}/ 2>/dev/null ;
finish-msg:
@ echo "PROCESS FINISHED" ;
## ------------------------------------------------------------------------ ##
.PHONY: rebuild redeploy
rebuild: build;
redeploy: banner rebuild deploy finish-msg;
## ------------------------------------------------------------------------ ##
.PHONY: all full cycle
#* means the word "all" doesn't represent a file name in this Makefile;
#* means the Makefile has nothing to do with a file called "all" in the same directory.
all: banner clean cycle;
full: clean-all all;
cycle: rights setup build deploy banner finish-msg;
## ------------------------------------------------------------------------ ##