#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

DEPTH      = ../../../..
topsrcdir  = @top_srcdir@
srcdir     = @srcdir@
VPATH      = @srcdir@

DISTROEXT = $(call core_abspath,$(DIST))/bin/distribution/extensions

include $(DEPTH)/config/autoconf.mk

DIRS = \
  {972ce4c6-7e08-4474-a285-3208198ce6fd} \
  $(NULL)

include $(topsrcdir)/config/rules.mk

ifneq (,$(filter aurora beta,$(MOZ_UPDATE_CHANNEL)))
EXTENSIONS = \
  testpilot@labs.mozilla.com \
  $(NULL)

define _INSTALL_EXTENSION
$(NSINSTALL) -D $(dir) && \
  $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(srcdir)/$(dir)/install.rdf.in > $(dir)/install.rdf && \
  cd $(dir) && \
  $(ZIP) -r9XD $(DISTROEXT)/$(dir).xpi install.rdf && \
  cd $(call core_abspath,$(srcdir)/$(dir)) && \
  $(ZIP) -r9XD $(DISTROEXT)/$(dir).xpi * -x install.rdf.in

endef # do not remove the blank line!

libs::
	$(NSINSTALL) -D $(DISTROEXT)
	$(foreach dir,$(EXTENSIONS),$(_INSTALL_EXTENSION))
endif
