Source

mefi-navigator / Makefile

Full commit
SED = gsed
CHROME = /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome
VERSION = 1.0.2

APPLICATION_NAME=mefi-navigator

all: $(APPLICATION_NAME)-$(VERSION).crx updates.xml



$(APPLICATION_NAME)-$(VERSION).crx: script.js manifest.json
	[ -d $(APPLICATION_NAME) ] && rm -rf $(APPLICATION_NAME) || true
	mkdir $(APPLICATION_NAME)
	cp manifest.json $$($(SED) -n -e 's/.*: [[ ]*"\([^ ]*\.\(png\|html\|js\)\)".*$$/\1/p' manifest.json) $(APPLICATION_NAME)
	$(CHROME) --pack-extension=$(APPLICATION_NAME) --pack-extension-key=$(APPLICATION_NAME).pem
	rm -Rf $(APPLICATION_NAME)
	cp $(APPLICATION_NAME).crx $@

updates.xml: Makefile
	$(SED) -n -e 's/@VERSION@/$(VERSION)/g' -e 's/^##UP //p' $< > $@
##UP <?xml version='1.0' encoding='UTF-8'?>
##UP <gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
##UP   <app appid='anadfmbemnidomdljfcdgdoomhghoclk'>
##UP      <updatecheck
##UP         codebase='http://cdn.bitbucket.org/m.23/flv_download/downloads/flv_download_@VERSION@.crx' version='@VERSION@' />
##UP   </app>
##UP </gupdate>

manifest.json: manifest.json.in Makefile
	$(SED) -e 's/@VERSION@/$(VERSION)/g' $< > $@

clean:
	rm -f *.log *.aux