-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmakefile
133 lines (109 loc) · 4.59 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
# makefile
#
# Based on ideas by Joel Dueck, see: https://github.com/otherjoel/try-pollen
# Fist: make libs
# Then: make all
# Help: make
# Requires: GNU make, curl
SHELL = /bin/bash
# This was tested to work with version 4.1 of GNU Make
ifneq ($(findstring GNU, $(shell $(MAKE) -v)), GNU)
$(error Not a GNU Make)
endif
# ANSI encoded colors for the help screen
BOLD = \x1b[1m
NC = \x1b[0m
# TODO: Split into an include file -- deps.mak
lib/bootstrap-3.2.0-dist/js/bootstrap.js:
mkdir -p lib
@echo "[ Downloading bootstrap.js ]"
cd lib && curl --silent --remote-name --location \
"https://github.com/twbs/bootstrap/releases/download/v3.2.0/bootstrap-3.2.0-dist.zip"
cd lib && unzip bootstrap-3.2.0-dist.zip
cd lib && rm bootstrap-3.2.0-dist.zip
lib/jquery-3.7.1.js:
mkdir -p lib
@echo "[ Downloading jquery.js ]"
cd lib && curl --silent --remote-name --location "https://code.jquery.com/jquery-3.7.1.js"
lib/components/sha1.js:
mkdir -p lib
@echo "[ Downloading sha1.js ]"
cd lib && curl --silent --remote-name --location \
"https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/crypto-js/CryptoJS%20v3.1.2.zip"
cd lib && unzip CryptoJS%20v3.1.2.zip components/sha1-min.js components/sha1.js \
components/core-min.js components/core.js
cd lib && rm CryptoJS%20v3.1.2.zip
lib/loglevel.js:
mkdir -p lib
@echo "[ Downloading loglevel.js ]"
cd lib && curl --silent --remote-name --location \
"https://raw.github.com/pimterry/loglevel/0.5.0/dist/loglevel.js"
Caja-HTML-Sanitezer-URL = \
https://raw.githubusercontent.com/theSmaw/Caja-HTML-Sanitizer/0b682371621e097581b1b5ddfa9d4042baa1683f
lib/sanitizer.js:
mkdir -p lib
@echo "[ Downloading sanitizer.js ]"
cd lib && curl --silent --remote-name --location "$(Caja-HTML-Sanitezer-URL)/sanitizer.js"
cd lib && curl --silent --remote-name --location "$(Caja-HTML-Sanitezer-URL)/lib/uri.js"
cd lib && curl --silent --remote-name --location "$(Caja-HTML-Sanitezer-URL)/lib/html4.js"
cd lib && patch -u sanitizer.js < ../sanitizer.js.patch
lib/prism.js:
mkdir -p lib
@echo "[ Downloading prism.js ]"
cd lib && curl --silent --remote-name --location \
"https://github.com/pmarinov/rrss/releases/download/v0.6.3-pre1/prism_for_rrss.tar.gz"
cd lib && tar -xzvf prism_for_rrss.tar.gz
cd lib && rm prism_for_rrss.tar.gz
lib/Dropbox-sdk.js:
mkdir -p lib
@echo "[ Downloading Dropbox-sdk.js ]"
cd lib && curl --silent --remote-name --location \
"https://unpkg.com/[email protected]/dist/Dropbox-sdk.js"
cd lib && curl --silent --remote-name --location \
"https://unpkg.com/[email protected]/dist/Dropbox-sdk.js.map"
JS_LIBS = lib/bootstrap-3.2.0-dist/js/bootstrap.js \
lib/jquery-3.7.1.js \
lib/components/sha1.js \
lib/loglevel.js \
lib/sanitizer.js \
lib/prism.js \
lib/Dropbox-sdk.js \
lib/Dropbox-sdk.js.map
# Recursively list all web files
# TODO: Move oauth_receiver files into a sub folder (if possible)
find-web-files := -name "*.js" -o -name "*.js.map" -o \
-name "*.html" -o -name "*.css" -o -name "*.css.map" -o \
-name "*.png" -o -name "*.svg" -o \
-name "*.eot" -o -name "*.ttf" -o -name "*.woff"
app-files-find := $(shell find ./lib $(find-web-files)) \
$(shell find ./chrome $(find-web-files)) \
$(shell find ./qfeeds $(find-web-files))
# Output of `find` begins with './', remove it
app-files := $(subst ./,,$(app-files-find))
# App files for specific browsers in individual folders
app-files-firefox := $(subst ./,firefox-qfeeds/,$(app-files-find))
app-files-chrome := $(subst ./,chrome-qfeeds/,$(app-files-find))
# All files in ./chrome-qfeeds, depends on corresponding files in main folder ./
$(app-files-chrome): chrome-qfeeds/%:%
mkdir -p $(dir $@)
cp -p $(subst chrome-qfeeds/,./,$@) $@
chrome-qfeeds/manifest.json: manifest_chrome.json
@echo "[ Preparing $@ ]"
cp -p $< $@
# All files in ./firefox-qfeeds, depends on corresponding files in main folder ./
$(app-files-firefox): firefox-qfeeds/%:%
mkdir -p $(dir $@)
cp -p $(subst firefox-qfeeds/,./,$@) $@
firefox-qfeeds/manifest.json: manifest_firefox.json
@echo "[ Preparing $@ ]"
cp -p $< $@
libs: $(JS_LIBS)
@echo "[ $@ Done ]"
libs: ## Download external libs into folder "libs/"
all: $(app-files-chrome) chrome-qfeeds/manifest.json \
$(app-files-firefox) firefox-qfeeds/manifest.json
all: ## Regenerate browser extensions into folders "chrome-qfeeds/" and "firefox-qfeeds/"
# Self-documenting make file (http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html)
help: ## Displays this help screen
@sed -E -n -e "s%^([-a-zA-Z_ ]+:).*## (.*)%${BOLD}\1${NC}\t\2%p" makefile
.DEFAULT_GOAL := help