diff options
author | lonkaars <loek@pipeframe.xyz> | 2023-10-07 16:06:55 +0200 |
---|---|---|
committer | lonkaars <loek@pipeframe.xyz> | 2023-10-07 16:06:55 +0200 |
commit | 9797e6fda53014bb099d63dfdb51a61fdd639b8b (patch) | |
tree | a17948849af2471a817cb35923e4cfdf6bde1295 /yomichan/makefile | |
parent | fa5f1e9f4b119cb1fdf5902801562daba34de91d (diff) |
renovate makefile and fix action popup css
Diffstat (limited to 'yomichan/makefile')
-rw-r--r-- | yomichan/makefile | 61 |
1 files changed, 38 insertions, 23 deletions
diff --git a/yomichan/makefile b/yomichan/makefile index 6ac8f6a..f8bc4a5 100644 --- a/yomichan/makefile +++ b/yomichan/makefile @@ -1,65 +1,80 @@ +.PHONY: clean patch download backup yomichan all: patch +download: yomichan +backup: download +patch: backup -.PHONY: clean patch download backup yomichan +# template rules in this file do not have explicit dependencies, this is to +# allow dependencies regardless of subdirectory. the dependencies are commented +# out instead for readability include ../common.mk -yomichan/images/%.svg: %.svg - cp $< $@ +yomichan-chrome.zip: + curl https://github.com/FooSoft/yomichan/releases/latest/download/$@ -Lso- > $@ -yomichan/css/%.css: %.css +yomichan/images/%.svg: # %.svg cp $< $@ -yomichan/js/%.js: %.js +yomichan/css/%.css: # %.css cp $< $@ -yomichan/%.patched: %.diff - patch -so - $(@:.patched=) < $< > $@ - -yomichan/%.bak: yomichan/% +yomichan/js/%.js: # %.js cp $< $@ -yomichan-chrome.zip: - curl https://github.com/FooSoft/yomichan/releases/latest/download/$@ -Lso- > $@ +yomichan/%.patched: # %.bak %.diff + patch -so - $(@:.patched=.bak) < $< > $@ + +# this rule must not depend on the original file, or the .bak will be made from +# an already patched file +yomichan/%.bak: # % + cp $(@:.bak=) $@ yomichan: yomichan-chrome.zip unzip -qo $< -d $@ -yomichan/manifest.json.bak: - cp yomichan/manifest.json $@ - -yomichan/search.html.bak: - cp yomichan/search.html $@ info.html.diff: info.html.diff.m4 +# .diff patches +backup: yomichan/search.html.bak yomichan/search.html.patched: search.html.diff +backup: yomichan/settings.html.bak yomichan/settings.html.patched: settings.html.diff +backup: yomichan/info.html.bak yomichan/info.html.patched: info.html.diff +backup: yomichan/css/action-popup.css.bak +yomichan/css/action-popup.css.patched: action-popup.css.diff + +# updated extension manifest (allow userscript loading) +backup: yomichan/manifest.json.bak yomichan/manifest.json.patched: yomichan/manifest.json.bak jq '.content_scripts[0].js[.content_scripts[0].js | length] |= .+ "js/userscript-loader.js"' $< |\ jq '.content_security_policy |= .+ "'"; script-src 'self' 'unsafe-eval'"'"' |\ jq '.content_security_policy |= sub("img-src";"img-src data:")' > $@ +# userscript loader files +yomichan/js/userscript-loader.js: userscript-loader.js +yomichan/images/script.svg: script.svg +yomichan/css/userscript-settings.css: userscript-settings.css -download: yomichan -backup: download -backup: yomichan/manifest.json.bak -backup: yomichan/search.html.bak -backup: yomichan/settings.html.bak -backup: yomichan/info.html.bak -patch: backup + +# install userscript loader patch: yomichan/js/userscript-loader.js patch: yomichan/images/script.svg patch: yomichan/css/userscript-settings.css +# .diff patches patch: yomichan/search.html.patched patch: yomichan/settings.html.patched patch: yomichan/manifest.json.patched patch: yomichan/info.html.patched +patch: yomichan/css/action-popup.css.patched +# move .patched to original filenames patch: mv yomichan/search.html.patched yomichan/search.html mv yomichan/settings.html.patched yomichan/settings.html mv yomichan/info.html.patched yomichan/info.html mv yomichan/manifest.json.patched yomichan/manifest.json + mv yomichan/css/action-popup.css.patched yomichan/css/action-popup.css yomichan-chrome-patched.zip: clean patch zip -qr $@ yomichan |