-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
74 lines (66 loc) · 1.75 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
#!/usr/bin/make
#
# m3tior 2018
#
.PHONY: build deploy fix-deploy clean php
php:
@# NOTE:
@# For the record, make and php are the two most touchy systems
@# I have ever fucked with in my life, but god damn do I love them!
@# It's like figuring out a giant puzzle every time I make a new project!
@#
@# Which is why I'm going to let you know not to touch this...
@# If you value your life and your time YOU WILL NOT TOUCH THIS!
@#
@# PHP's json_decode doesn't like trailing commas on array elements
@# so please don't screw up the transfer from make to php...
@# It won't end well...
PHP_FLAGS='$(foreach flag,$(FLAGS),"$(flag)",)'; \
for file in $(wildcard src/php/*); do \
NODIR=$${file##*/}; \
FNAME=$${NODIR%.php}; \
if [ "$${NODIR#*.}" != "php" ]; then \
$(strip \
php -f $$file -- "{\
\"FLAGS\": [\
$${PHP_FLAGS%*,}\
]\
}" > build/$$FNAME; \
) \
fi; \
done;
build: php
@echo "Building..."
@mkdir -p build
@ \
while read line; do \
{ set -x; cp -u $line }; \
done < <(php -f ../tools/conglomerator.php);
@rsync -vr res/* build
@rsync -vr json/* build
@rsync -vr html/* build
@echo "Done!"
deploy: clean build
@echo "Uploading to github...";
@git push --delete origin master;
@git subtree push --prefix=build origin master;
@echo "Done!"
#fix-deploy:
# @echo "Refreshing Github..."
# @\
# git stash;\
# git checkout master;\
# git pull;\
# git commit --allow-empty -m "Trigger rebuild" master;\
# git push;\
# git checkout development;\
# git stash pop;
# @echo "Done!"
# Shouldn't need to use this any more
# since I have a gitignore to keep that directory
# from being pushed into the development branch.
# But just in case, I'm leaving it here.
clean:
@echo "Cleaning..."
@rm -rf build/*
@echo "Done!"