# GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
# 
# Copyright (C) 2011, 2012 Loic J. Duros
#
# 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  <http://www.gnu.org/licenses/>.



all: 
	cfx xpi

install: doinstall

doinstall: 
	@echo "Creating Mozilla directories for system-wide add-ons and extensions";

	if test ! -d "/usr/lib/mozilla"; then \
		echo "Creating Mozilla directory"; \
		mkdir "/usr/lib/mozilla";\
	fi;

	if test ! -d "/usr/lib/mozilla/extensions"; then \
		echo "Creating extensions directory"; \
		mkdir "/usr/lib/mozilla/extensions";\
	fi;


	if test ! -d "/usr/lib/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; then \
		echo "Creating Mozilla-browser uuid directory"; \
		mkdir "/usr/lib/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"; \
	fi;

	@echo "Installing LibreJS";

	cp librejs.xpi "/usr/lib/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/jid1-KtlZuoiikVfFew@jetpack.xpi";

	@echo "Depending on your version of the Mozilla-browser, if LibreJS is not enabled already, you may, inside your Mozilla-browser, need to go in the menu in Tools > Add-ons and click enable where you see LibreJS.";

uninstall:
	rm "/usr/lib/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}/jid1-KtlZuoiikVfFew@jetpack.xpi";

clean:
	rm "librejs.xpi";
