-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
105 lines (75 loc) · 2.77 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
#!/usr/bin/make -f
#
# Detect OS
OS = $(shell uname -s)
# Defaults
ECHO = echo
# Make adjustments based on OS
# http://stackoverflow.com/questions/3466166/how-to-check-if-running-in-cygwin-mac-or-linux/27776822#27776822
ifneq (, $(findstring CYGWIN, $(OS)))
ECHO = /bin/echo -e
endif
# Colors and helptext
NO_COLOR = \033[0m
ACTION = \033[32;01m
OK_COLOR = \033[32;01m
ERROR_COLOR = \033[31;01m
WARN_COLOR = \033[33;01m
# Which makefile am I in?
WHERE-AM-I = $(CURDIR)/$(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
THIS_MAKEFILE := $(call WHERE-AM-I)
# Echo some nice helptext based on the target comment
HELPTEXT = $(ECHO) "$(ACTION)--->" `egrep "^\# target: $(1) " "$(THIS_MAKEFILE)" | sed "s/\# target: $(1)[ ]*-[ ]* / /g"` "$(NO_COLOR)"
# Check version and path to command and display on one line
CHECK_VERSION = printf "%-15s %-10s %s\n" "`basename $(1)`" "`$(1) --version $(2)`" "`which $(1)`"
# target: help - Displays help.
.PHONY: help
help:
@$(call HELPTEXT,$@)
@$(ECHO) "Usage:"
@$(ECHO) " make [target] ..."
@$(ECHO) "target:"
@egrep "^# target:" Makefile | sed 's/# target: / /g'
# target: clean-cache - Clear all cache files and set mode on cache dirs.
.PHONY: clean-cache
clean-cache:
@$(call HELPTEXT,$@)
rm -rf cache/*/*
install -d -m 777 cache/cimage cache/anax
# target: site-build - Copy default structure from Anax Flat.
.PHONY: site-build
site-build:
@$(call HELPTEXT,$@)
@$(ECHO) "$(ACTION)Copy from anax-flat$(NO_COLOR)"
rsync -a vendor/mos/anax-flat/htdocs/ htdocs/
rsync -a vendor/mos/anax-flat/config/ config/
rsync -a vendor/mos/anax-flat/content/ content/
rsync -a vendor/mos/anax-flat/view/ view/
@$(ECHO) "$(ACTION)Copy from CImage$(NO_COLOR)"
install -d htdocs/cimage
rsync -a vendor/mos/cimage/webroot/imgd.php htdocs/cimage/imgd.php
rsync -a vendor/mos/cimage/icc/ htdocs/cimage/icc/
@$(ECHO) "$(ACTION)Create the directory for the cache items$(NO_COLOR)"
install -d -m 777 cache/cimage cache/anax
# target: site-update - Make composer update and copy latest files.
.PHONY: site-update
site-update:
@$(call HELPTEXT,$@)
composer update
@$(ECHO) "$(ACTION)Copy Makefile$(NO_COLOR)"
rsync -av vendor/mos/anax-flat/Makefile .
@$(ECHO) "$(ACTION)Copy from CImage$(NO_COLOR)"
rsync -a vendor/mos/cimage/webroot/imgd.php htdocs/cimage/imgd.php
rsync -a vendor/mos/cimage/icc/ htdocs/cimage/icc/
@$(ECHO) "$(ACTION)Create/Update the directory for the cache items$(NO_COLOR)"
install -d -m 777 cache/cimage cache/anax
# target: theme - Do make in theme/ subfolder.
.PHONY: theme
theme:
@$(call HELPTEXT,$@)
[ ! -d theme ] || $(MAKE) -C theme less-install
# # target: test - Run tests.
# .PHONY: test
# test:
# @$(call HELPTEXT,$@)
# [ ! -d theme ] || $(MAKE) -C theme test