File:  [mozdev] / checkyesss / src / Makefile
Revision 1.14: download - view: text, annotated - select for diffs - revision graph
Sat Aug 26 20:41:17 2006 UTC (13 years, 3 months ago) by treitmayr
Branches: MAIN
CVS tags: prerelease-0-5-7-20060909, HEAD
idl tools/definitions moved from mozilla to seamonkey directory

#   ***** BEGIN LICENSE BLOCK *****
#   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
#   -
#   - The contents of this file are subject to the Mozilla Public License Version
#   - 1.1 (the "License"); you may not use this file except in compliance with
#   - the License. You may obtain a copy of the License at
#   - http://www.mozilla.org/MPL/
#   -
#   - Software distributed under the License is distributed on an "AS IS" basis,
#   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
#   - for the specific language governing rights and limitations under the
#   - License.
#   -
#   - The Original Code is CheckYesss.
#   -
#   - The Initial Developer of the Original Code is
#   - Thomas Reitmayr <treitmayr@yahoo.com>.
#   - Portions created by the Initial Developer are Copyright (C) 2005
#   - the Initial Developer. All Rights Reserved.
#   -
#   - Contributor(s):
#   - -
#   -
#   - Alternatively, the contents of this file may be used under the terms of
#   - either the GNU General Public License Version 2 or later (the "GPL"), or
#   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
#   - in which case the provisions of the GPL or the LGPL are applicable instead
#   - of those above. If you wish to allow use of your version of this file only
#   - under the terms of either the GPL or the LGPL, and not to allow others to
#   - use your version of this file under the terms of the MPL, indicate your
#   - decision by deleting the provisions above and replace them with the notice
#   - and other provisions required by the LGPL or the GPL. If you do not delete
#   - the provisions above, a recipient may use your version of this file under
#   - the terms of any one of the MPL, the GPL or the LGPL.
#   -
#   - ***** END LICENSE BLOCK *****

PROJECT=checkyesss
INSTPATH=../downloads
OS=$(shell uname)
VERSION=$(shell grep em:version install.rdf | sed 's/.*> *\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
XPIVERSION=$(shell zipgrep em:version checkyesss.xpi install.rdf | sed 's/.*> *\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
ZIPOPT=-X -9 -q
JSLOPT=conf ./jsl.conf nologo nofilelisting nosummary

ifeq ($(OS), Linux)
  XPIDL.DIR=/usr/lib/seamonkey
  XPIDL.CMD=$(XPIDL.DIR)/xpidl -m typelib -w -v -I $(XPIDL.DIR)/idl -I components -o
else
  XPIDL.DIR=/cygdrive/c/Programme/Mozilla.org/Mozilla/base
  XPIDL.CMD=$(XPIDL.DIR)/xpidl -m typelib -w -v -I $(XPIDL.DIR) -o
endif

SRC.INST=$(shell find install.* | grep -v \~$) chrome.manifest
SRC.CHROME=$(shell find chrome/content chrome/skin chrome/locale -type f | \
             grep -v \~$ | grep -v CVS)
SRC.COMP.IDL=$(wildcard components/*.idl)
SRC.COMP.XPT=$(patsubst %.idl,%.xpt,$(SRC.COMP.IDL))
SRC.COMP=$(wildcard components/*.js) $(SRC.COMP.XPT)
SRC.DEF=$(shell find defaults -type f | grep -v CVS )
ALL.JS=$(wildcard components/cy*.js) \
       $(shell find chrome/content -name '*.js') \
       install.js

ifeq ($(HOST), de)
  DESTFILE=CheckYesss_$(VERSION)_de-DE
  HOSTNAME=erweiterungen.de
  UPDLINK=http://update.erweiterungen.de/update.php?id=%ITEM_ID%\&amp;version=%ITEM_VERSION%\&amp;appid=%APP_ID%\&amp;appversion=%APP_VERSION%\&amp;appos=%APP_OS%
else
  DESTFILE=$(PROJECT)
  ifeq ($(HOST), at)
    HOSTNAME=chello.at
    UPDLINK=http://members.chello.at/treitmayr/checkyesss/checkyesss-dev.xml
  else
    HOSTNAME=mozdev.org
    UPDLINK=http://downloads.mozdev.org/checkyesss/checkyesss.xml
  endif
endif


all : lint host $(DESTFILE).xpi

install : $(INSTPATH)/$(PROJECT).xpi $(INSTPATH)/$(PROJECT).xml
	@echo successfully installed version $(XPIVERSION)

clean :
	rm $(PROJECT).xpi chrome/$(PROJECT).jar $(SRC.COMP.XPT)

$(INSTPATH)/$(DESTFILE).xpi : $(DESTFILE).xpi
	cp $^ $(INSTPATH)

$(INSTPATH)/$(PROJECT).xml : $(PROJECT).xml
	cp $^ $(INSTPATH)

%.xpt : %.idl
	@echo compiling $<
	@$(XPIDL.CMD) $(basename $@) $<

chrome/$(PROJECT).jar : $(SRC.CHROME)
	@rm -rf $@
	@echo creating $@
	@cd chrome; zip $(ZIPOPT) -r $(PROJECT).jar $(patsubst chrome/%,%,$^)

$(DESTFILE).xpi : $(SRC.INST) $(SRC.COMP) chrome/$(PROJECT).jar $(SRC.DEF)
	@rm -rf $@
	@echo creating $@
	@zip $(ZIPOPT) -r $@ $^
	@echo successfully built version $(VERSION)

.PHONY: lint
lint:
	@echo checking Javascript code
	@if which jsl >/dev/null ; then \
	  jsl $(JSLOPT) $(patsubst %,process %,$(ALL.JS)); \
	fi

.PHONY: host
host:
	@sed 's#updateURL>.*<#updateURL>$(UPDLINK)<#' install.rdf > .tmp
	@if ! diff -q install.rdf .tmp >/dev/null ; then \
	  echo switching to update host $(HOSTNAME) ; \
	  cp .tmp install.rdf ; \
	else \
	  rm .tmp; \
	  echo using update host $(HOSTNAME); \
	fi

.PHONY: help
help:
	@echo "targets: all      build xpi archive (default), includes"
	@echo "                  running jslint and adjustment of update host"
	@echo "         clean    remove .xpi, .jar, .xpt"
	@echo "         install  copy $(PROJECT).xpi/.xml to download directory"
	@echo ""
	@echo "variables: HOST   update host to change in install.rdf; allowed values:"
	@echo "                  de: erweiterungen.de"
	@echo "                  at: chello.at"
	@echo "                  <none>: mozdev.org"


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>