forked from Igalia/phpreport
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (57 loc) · 2.05 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
tgz: help minify
cp config/config.php config/config.defaults
VERSION=`./version.sh`; \
tar zcf phpreport_$${VERSION}.tar.gz --exclude=Makefile --exclude=*~ \
--exclude=version.sh --exclude=docs --exclude=config/config.php \
--exclude=web/APITest.php --exclude=web/js/APITest.js \
--exclude=*.tar.gz --exclude=*.zip *
zip: tgz
VERSION=`./version.sh`; \
tar tf phpreport_$${VERSION}.tar.gz | zip -@ phpreport_$${VERSION}.zip
help:
#create dirs
mkdir -p help/user
mkdir -p help/admin
mkdir -p help/developer
#copy images
cp -r docs/user/i help/user
cp -r docs/developer/i help/developer
#generate footer
echo -ne '\n.. class:: credits\n\n This file is part of PhpReport ' > footer
VERSION=`./version.sh`; echo -ne $${VERSION} >> footer
echo -e ' documentation.' >> footer
echo -ne ' Generated on ' >> footer
date >> footer
#parse rst
for i in `find -name *.rst` ; do \
#rename .rst for .html in links to other doc pages \
sed 's/\.rst/\.html/g' $$i > tmp; \
#append footer \
cat footer >> tmp; \
#extract file name to be used as the output file name \
FILE=`echo $$i | awk '{firstpart=substr($$i, 8);x=index(firstpart,".rst");print substr(firstpart, 1,x)}'`; \
#generate html file \
rst2html tmp help/$${FILE}html; \
done
rm tmp
rm footer
minify:
for i in `find -name "*.min.js" -not -path "*web/vuejs/*"`; do rm $$i; done
for i in `find -name "*.js" -not -path "*web/vuejs/*"` ; do \
#extract file name to be used in the uglify output \
FILE=`basename -s .js $$i`; \
DIR=`dirname $$i`; \
cd $$DIR; \
uglifyjs $${FILE}.js --output $${FILE}.min.js \
--source-map "filename=$${FILE}.min.js.map" -c -m; \
cd -; \
done
for i in `find web -name "*.php" -not -path "*web/holidayManagement.php"`; do \
#revert any previous minification changes \
sed 's/<script src="\(.*\).min.js">/<script src="\1.js">/' $$i > tmp; \
#modify script tags to link the minified file \
sed 's/<script src="\(.*\).js">/<script src="\1.min.js">/' tmp > $$i; \
done
rm tmp
#prevent makefile docs are up-to-date
.PHONY: help