File:  [mozdev] / checkyesss / src / Makefile
Revision 1.25: download - view: text, annotated - select for diffs - revision graph
Sun Feb 17 15:25:24 2008 UTC (9 years, 9 months ago) by treitmayr
Branches: MAIN
CVS tags: release-0-6-34, release-0-6-33, release-0-6-32, release-0-6-31-20091123, release-0-6-31-20091122, release-0-6-31, release-0-6-30, release-0-6-29, release-0-6-28, release-0-6-27, release-0-6-26, release-0-6-25, release-0-6-24, release-0-6-23, release-0-6-22, release-0-6-20, release-0-6-19, release-0-6-18, release-0-6-17, release-0-6-16, HEAD
minor corrections

#   ***** 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-2007
#   - 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
VERSINFO.SRCPATH=chrome/locale/de-DE
VERSINFO.DSTPATH=~/websites/devbase/trunk/download/checkyesss/moz
VERSINFO.FILE=version_info.properties
OS=$(shell uname)
VERSION=$(shell grep em:version install.rdf | sed 's/.*> *\([0-9]*\.[0-9]*\(\.[0-9]*\)*\).*/\1/' | sed 's/.*em:version="\([0-9]*\.[0-9]*\(\.[0-9]*\)*\).*/\1/')
EXTID=$(shell grep "urn:mozilla:extension" checkyesss.xml | head -n 1 |  sed 's/.*\(urn:mozilla.*}\).*/\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=$(shell dirname `find /usr/lib/mozilla* /usr/lib/seamonkey -name xpidl 2>/dev/null | head -n 1` )
  XPIDL.CMD=$(XPIDL.DIR)/xpidl -m typelib -w -v -I $(XPIDL.DIR)/idl -I components -o
  SIGN.DIR=../3rd-party/spock
  SIGN.CMD=$(SIGN.DIR)/spock $(PROJECT).xml \
           -d ~/.mozilla/mccoy/m9st498l.default/ \
           -i "$(EXTID)" \
           | ( read a ; echo $$a ; cat LICENSE.xml ; cat )
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 | grep -v '/\.' )
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)_fx+ms+sm+tb_de-DE
  HOSTNAME=erweiterungen.de
  UPDLINK=https://www.erweiterungen.de/updates/?reqVersion=%REQ_VERSION%\&amp;id=%ITEM_ID%\&amp;version=%ITEM_VERSION%\&amp;maxAppVersion=%ITEM_MAXAPPVERSION%\&amp;status=%ITEM_STATUS%\&amp;appID=%APP_ID%\&amp;appVersion=%APP_VERSION%\&amp;appOS=%APP_OS%\&amp;appABI=%APP_ABI%
  PROJNAME=CheckYesss [de]
else
  PROJNAME=CheckYesss
  DESTFILE=$(PROJECT)
  ifeq ($(HOST), mozdev)
    HOSTNAME=mozdev.org
    UPDLINK=http://downloads.mozdev.org/checkyesss/checkyesss.xml
  else
    ifeq ($(HOST), local)
      HOSTNAME=localhost
      UPDLINK=http://localhost/update-cy.xml
    else
      HOSTNAME=devbase.at
      UPDLINK=http://download.devbase.at/update.php?reqversion=%REQ_VERSION%\&amp;id=%ITEM_ID%\&amp;version=%ITEM_VERSION%\&amp;appid=%APP_ID%\&amp;appversion=%APP_VERSION%\&amp;appos=%APP_OS%\&amp;appabi=%APP_ABI%\&amp;status=%ITEM_STATUS%
    endif
  endif
endif


all : lint host $(DESTFILE).xpi $(PROJECT).xml

install : $(INSTPATH)/$(PROJECT).xpi $(INSTPATH)/$(PROJECT).xml $(VERSINFO.DSTPATH)/$(VERSINFO.FILE)
	@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
	@echo generating signature
	@$(SIGN.CMD) > $(INSTPATH)/$^

$(VERSINFO.DSTPATH)/$(VERSINFO.FILE) : $(VERSINFO.SRCPATH)/$(VERSINFO.FILE)
	@echo installing $@
	@cp $^ $@

%.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)

$(PROJECT).xml : $(PROJECT).xpi
	@hash=`sha1sum -b $(PROJECT).xpi` ; \
	 hash=$${hash%% *} ; \
	 sed -i 's#em:updateHash>.*<#em:updateHash>'sha1:$${hash}'<#' $(PROJECT).xml ; \
	 echo updated hash $${hash}

.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#em:updateURL>.*<#em:updateURL>$(UPDLINK)<#' install.rdf \
	  | sed 's#em:name>.*<#em:name>$(PROJNAME)<#' \
	  > .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 "                  mozdev: mozdev.org"
	@echo "                  local:  localhost"
	@echo "                  <none>: devbase.at"


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