# Copyright (c) 2021 Teddy Wing # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . IMPORTS := peniquitous.js node_modules/mousetrap/tests/libs/key-event.js IMPORTS_BASENAME := $(notdir $(IMPORTS)) all: peniquitous.user.js build: mkdir -p $@ build/mousetrap-license.js: node_modules/mousetrap/LICENSE sed \ -e 's,^\(.\),// \1,' \ -e 's,^$$,//,' \ $< \ > $@ build/key-event.js: node_modules/mousetrap/tests/libs/key-event.js \ build/mousetrap-license.js \ | build sed -e '/^(function/d' -e '$$d' $< > $@ cat build/mousetrap-license.js $@ > $@.tmp mv $@.tmp $@ build/peniquitous.js: peniquitous.js | build sed -e '/^(function/d' -e '$$d' $< > $@ build/main.js: main.js.in $(addprefix build/,$(IMPORTS_BASENAME)) sed \ -e '/\$$KEY_EVENT/r build/key-event.js' \ -e '/\$$KEY_EVENT/d' \ -e '/\$$PENIQUITOUS/r build/peniquitous.js' \ -e '/\$$PENIQUITOUS/d' \ $< \ > $@ peniquitous.user.js: build/main.js cp $< $@ .PHONY: clean clean: rm -rf build